qid int64 4 8.14M | question stringlengths 20 48.3k | answers list | date stringlengths 10 10 | metadata list | input stringlengths 12 45k | output stringlengths 2 31.8k |
|---|---|---|---|---|---|---|
3,139 | <p>I'm pulling my hair out over this. In the Links manager, you can enter a description for the category (in addition to the link itself). However, in wp_list_bookmarks, there is no way to call this value anywhere. So how can I get it?</p>
<p>I know it's in the term_taxonomy table, under link_category. So is there a f... | [
{
"answer_id": 3145,
"author": "Flávio Ricardo",
"author_id": 444,
"author_profile": "https://wordpress.stackexchange.com/users/444",
"pm_score": 0,
"selected": false,
"text": "<p>Not the best solution for this case, but you can use it for now:</p>\n\n<pre><code><?php $cat = get_categ... | 2010/10/21 | [
"https://wordpress.stackexchange.com/questions/3139",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/403/"
] | I'm pulling my hair out over this. In the Links manager, you can enter a description for the category (in addition to the link itself). However, in wp\_list\_bookmarks, there is no way to call this value anywhere. So how can I get it?
I know it's in the term\_taxonomy table, under link\_category. So is there a functio... | OK, with the help of a friend I was able to get this done. I ditched the wp\_list\_bookmarks and went with a combination of get\_terms and get\_bookmarks.
```
function blogroll_page( $args = array() ) {
if(is_page('blogroll')) {
if( $terms = get_terms( 'link_category', $args = array('exclude' => 16) ) )
... |
3,141 | <p><em>(<strong>Moderator's note:</strong> The original title was "Is there a way to get post comments by post ID on a custom loop using WP-Query()?")</em></p>
<p>Hi! I'm running a custom loop <strong>using WP_Query</strong>, that only displays one post from a specific category on the <strong>home.php</strong> page, l... | [
{
"answer_id": 3190,
"author": "John P Bloch",
"author_id": 11,
"author_profile": "https://wordpress.stackexchange.com/users/11",
"pm_score": 1,
"selected": false,
"text": "<p>By default, WP_Query will only load comments WITH THE QUERY if you're</p>\n\n<ol>\n<li>looking at a comments fee... | 2010/10/21 | [
"https://wordpress.stackexchange.com/questions/3141",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1344/"
] | *(**Moderator's note:** The original title was "Is there a way to get post comments by post ID on a custom loop using WP-Query()?")*
Hi! I'm running a custom loop **using WP\_Query**, that only displays one post from a specific category on the **home.php** page, like so:
```
<?php $pr_q = "cat=11&posts_per_page=1"; $... | To be able to use the comments template in your loops, add
```
global $withcomments; $withcomments = true;
``` |
3,143 | <p>I have this bit of code in my <a href="http://wordpress.org/extend/plugins/meteor-slides/" rel="nofollow">Meteor Slides</a> plugin that loads a stylesheet on the admin pages of just the slides custom post type:</p>
<pre><code> add_action('admin_head', 'meteorslides_admin_css');
function meteorslides_admin_css()... | [
{
"answer_id": 3154,
"author": "John P Bloch",
"author_id": 11,
"author_profile": "https://wordpress.stackexchange.com/users/11",
"pm_score": 4,
"selected": true,
"text": "<p>You need to check for the presence of <code>'post_type'</code> as an index of <code>$_GET</code> before using it:... | 2010/10/21 | [
"https://wordpress.stackexchange.com/questions/3143",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1059/"
] | I have this bit of code in my [Meteor Slides](http://wordpress.org/extend/plugins/meteor-slides/) plugin that loads a stylesheet on the admin pages of just the slides custom post type:
```
add_action('admin_head', 'meteorslides_admin_css');
function meteorslides_admin_css() {
global $post_type;
if (($_G... | You need to check for the presence of `'post_type'` as an index of `$_GET` before using it:
```
if ((isset($_GET['post_type']) && $_GET['post_type'] == 'slide') || (isset($post_type) && $post_type == 'slide')) :
```
Also, you should be using the `wp_enqueue_style` function instead of echoing your stylesheet at `'adm... |
3,147 | <p>Currently I have a small amount of 100 categories and my MENU goes crazy big and I would like to be able to do 2 things if possible:</p>
<ul>
<li>First category menu with limited amount categories sorted by hits</li>
<li>Second category menu with limited amount of categories choose by myself</li>
</ul>
<p>Is there... | [
{
"answer_id": 3154,
"author": "John P Bloch",
"author_id": 11,
"author_profile": "https://wordpress.stackexchange.com/users/11",
"pm_score": 4,
"selected": true,
"text": "<p>You need to check for the presence of <code>'post_type'</code> as an index of <code>$_GET</code> before using it:... | 2010/10/21 | [
"https://wordpress.stackexchange.com/questions/3147",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1332/"
] | Currently I have a small amount of 100 categories and my MENU goes crazy big and I would like to be able to do 2 things if possible:
* First category menu with limited amount categories sorted by hits
* Second category menu with limited amount of categories choose by myself
Is there any simple way to acomplish this e... | You need to check for the presence of `'post_type'` as an index of `$_GET` before using it:
```
if ((isset($_GET['post_type']) && $_GET['post_type'] == 'slide') || (isset($post_type) && $post_type == 'slide')) :
```
Also, you should be using the `wp_enqueue_style` function instead of echoing your stylesheet at `'adm... |
3,166 | <p><em>(<strong>Moderator's note:</strong> The original title was "The count of my custom taxonomy is incorrect; it's counting revisions")</em></p>
<p>Has anybody run into this before? I've added two custom taxonomies, and the <code>count</code> column of the <code>wp_term_taxonomy</code> table is being set incorrectl... | [
{
"answer_id": 3168,
"author": "MikeSchinkel",
"author_id": 89,
"author_profile": "https://wordpress.stackexchange.com/users/89",
"pm_score": 2,
"selected": false,
"text": "<p>Hi <strong>@berkleebassist</strong>:</p>\n\n<p>It's hard to verify your issue without admin access to your site ... | 2010/10/21 | [
"https://wordpress.stackexchange.com/questions/3166",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3831/"
] | *(**Moderator's note:** The original title was "The count of my custom taxonomy is incorrect; it's counting revisions")*
Has anybody run into this before? I've added two custom taxonomies, and the `count` column of the `wp_term_taxonomy` table is being set incorrectly. It appears to be counting revisions in addition t... | Hi **@berkleebassist**:
It's hard to verify your issue without admin access to your site and your database but I can give you some direction that might help.
There are two functions in `/wp-includes/taxonomy.php` that update taxonomy term count: `wp_update_term_count_now()` and `_update_post_term_count()`. They are l... |
3,170 | <p>So, for the thousands using WP as CMS, a typical approach is that of using the 'A Static Page' option from the Settings > Reading admin page.</p>
<p>However, I'm in a different scenario: our front page is displaying static content (<em>home.php</em> template drives that), and we have a secondary static page (called... | [
{
"answer_id": 3172,
"author": "Adam Thompson",
"author_id": 1333,
"author_profile": "https://wordpress.stackexchange.com/users/1333",
"pm_score": 3,
"selected": true,
"text": "<p>The way I retrieve posts on my blog is to use the following:</p>\n\n<pre><code><?php $recentPosts = new W... | 2010/10/22 | [
"https://wordpress.stackexchange.com/questions/3170",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/456/"
] | So, for the thousands using WP as CMS, a typical approach is that of using the 'A Static Page' option from the Settings > Reading admin page.
However, I'm in a different scenario: our front page is displaying static content (*home.php* template drives that), and we have a secondary static page (called *News*) which sh... | The way I retrieve posts on my blog is to use the following:
```
<?php $recentPosts = new WP_Query(); $recentPosts->query('showposts=5&cat=CAT_ID_GOES_HERE'); while($recentPosts->have_posts()): $recentPosts->the_post(); ?>
```
Then you would go and create the code to control the display of each post. So for a really... |
3,179 | <p>Do you know how to prevent indexing of pages past the home page in WP?
I mean I don't want <code>mysite.com/page/2</code>, <code>mysite.com/page/3</code> to be indexed.</p>
<p>This is because I use <code>home.php</code> for my theme, so that <code>page/2</code>, <code>page/3</code>
are all the same.</p>
<p>Please ... | [
{
"answer_id": 3181,
"author": "Roswell Balentien",
"author_id": 706,
"author_profile": "https://wordpress.stackexchange.com/users/706",
"pm_score": 0,
"selected": false,
"text": "<p>If you're trying to prevent duplicate content you should look at the root of the problem. You state that ... | 2010/10/22 | [
"https://wordpress.stackexchange.com/questions/3179",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1349/"
] | Do you know how to prevent indexing of pages past the home page in WP?
I mean I don't want `mysite.com/page/2`, `mysite.com/page/3` to be indexed.
This is because I use `home.php` for my theme, so that `page/2`, `page/3`
are all the same.
Please give me a hint or a code snippet please, I don't want to add another plu... | How exactly are you setting up your home page? I think the problem is with it having unwanted pagination in first place and not that pagination being indexed.
In general `robots.txt` file is good way to prevent indexing in bulk. I think it would be following directive in your case (please test it so it doesn't affec p... |
3,184 | <p>having trouble educating clients to compress their images, and would quite like wordpress to compress images to predefined size (normally, 800px long edge, 72dpi) and discard the original</p>
| [
{
"answer_id": 3191,
"author": "Denis de Bernardy",
"author_id": 1208,
"author_profile": "https://wordpress.stackexchange.com/users/1208",
"pm_score": 2,
"selected": false,
"text": "<p>Tried this plugin?</p>\n\n<p><a href=\"http://wordpress.org/extend/plugins/auto-image-resizer/\" rel=\"... | 2010/10/22 | [
"https://wordpress.stackexchange.com/questions/3184",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/784/"
] | having trouble educating clients to compress their images, and would quite like wordpress to compress images to predefined size (normally, 800px long edge, 72dpi) and discard the original | Use <http://wordpress.org/extend/plugins/auto-image-resizer/>
Add this to your functions.php:
```
function prune_image_sizes($sizes) {
// You can add other size like that for remove those sizes
// unset($sizes['medium']);
unset($sizes['large']);
return $sizes;
}
add_filter('intermediate_image_sizes_adva... |
3,200 | <p>In an effort to combat comment spam, I'd like to hide or remove the <em>"Website"</em> field from the <em>"Leave a Reply"</em> section for page and site comments. </p>
<p>I have no desire to increase others page rankings by having them embed their URLs in my sites comments, which seems to be what 99% of the comment... | [
{
"answer_id": 3201,
"author": "John P Bloch",
"author_id": 11,
"author_profile": "https://wordpress.stackexchange.com/users/11",
"pm_score": 5,
"selected": true,
"text": "<p>Create a file in <code>wp-content/plugins/</code> with this code:</p>\n\n<pre><code><?php\n/*\nPlugin Name: Ge... | 2010/10/22 | [
"https://wordpress.stackexchange.com/questions/3200",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/506/"
] | In an effort to combat comment spam, I'd like to hide or remove the *"Website"* field from the *"Leave a Reply"* section for page and site comments.
I have no desire to increase others page rankings by having them embed their URLs in my sites comments, which seems to be what 99% of the comments on my site are wanting... | Create a file in `wp-content/plugins/` with this code:
```
<?php
/*
Plugin Name: Get Rid of Comment Websites
*/
function my_custom_comment_fields( $fields ){
if(isset($fields['url']))
unset($fields['url']);
return $fields;
}
add_filter( 'comment_form_default_fields', 'my_custom_comment_fields' );
```
Normal... |
3,203 | <p><em>(<strong>Moderator's note:</strong> Title was originally "What are all the variables in the wordpress post object?")</em></p>
<p>Does anyone know the variables that are stored in the WordPress Post object?</p>
| [
{
"answer_id": 3204,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 5,
"selected": true,
"text": "<p>Post object is mostly queried row of <code>wp_posts</code> database table with some extras. It is easy to dump content... | 2010/10/22 | [
"https://wordpress.stackexchange.com/questions/3203",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/151/"
] | *(**Moderator's note:** Title was originally "What are all the variables in the wordpress post object?")*
Does anyone know the variables that are stored in the WordPress Post object? | Post object is mostly queried row of `wp_posts` database table with some extras. It is easy to dump content of one and see:
```
object(stdClass)
public 'ID' => int
public 'post_author' => string
public 'post_date' => string
public 'post_date_gmt' => string
public 'post_content' => string
... |
3,208 | <p>I was wondering if there is a simple way to replicate my configurations for all the subsites once i have activated a network plugin without having to go thru each and configure it manually ?</p>
<ul>
<li>Upgrade a set or single network plugin(s) with the same configuration to all subsites</li>
</ul>
| [
{
"answer_id": 3204,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 5,
"selected": true,
"text": "<p>Post object is mostly queried row of <code>wp_posts</code> database table with some extras. It is easy to dump content... | 2010/10/22 | [
"https://wordpress.stackexchange.com/questions/3208",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1332/"
] | I was wondering if there is a simple way to replicate my configurations for all the subsites once i have activated a network plugin without having to go thru each and configure it manually ?
* Upgrade a set or single network plugin(s) with the same configuration to all subsites | Post object is mostly queried row of `wp_posts` database table with some extras. It is easy to dump content of one and see:
```
object(stdClass)
public 'ID' => int
public 'post_author' => string
public 'post_date' => string
public 'post_date_gmt' => string
public 'post_content' => string
... |
3,211 | <p>I changed a custom post_type to a different name. Now when I view a single page with the post_type I receive a 404 page. </p>
<p>How do I debug? Is there a WP log I can view the functions call?</p>
| [
{
"answer_id": 3204,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 5,
"selected": true,
"text": "<p>Post object is mostly queried row of <code>wp_posts</code> database table with some extras. It is easy to dump content... | 2010/10/23 | [
"https://wordpress.stackexchange.com/questions/3211",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1353/"
] | I changed a custom post\_type to a different name. Now when I view a single page with the post\_type I receive a 404 page.
How do I debug? Is there a WP log I can view the functions call? | Post object is mostly queried row of `wp_posts` database table with some extras. It is easy to dump content of one and see:
```
object(stdClass)
public 'ID' => int
public 'post_author' => string
public 'post_date' => string
public 'post_date_gmt' => string
public 'post_content' => string
... |
3,221 | <p><em>(<strong>Moderator's note:</strong> The question's original title was: "Custom query: Show custom post types plus custom post type with post meta on blog homepage")</em></p>
<p>I'm in need of help with a custom query. I have three custom post types: <em>"News"</em>, <em>"Events"</em>, <em>"Stories"</em>. On the... | [
{
"answer_id": 3227,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 0,
"selected": false,
"text": "<p>What you want is easy to describe, but hard to get working with WP API. I hadn't seen nice and tidy solution so far.<... | 2010/10/23 | [
"https://wordpress.stackexchange.com/questions/3221",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1360/"
] | *(**Moderator's note:** The question's original title was: "Custom query: Show custom post types plus custom post type with post meta on blog homepage")*
I'm in need of help with a custom query. I have three custom post types: *"News"*, *"Events"*, *"Stories"*. On the main blog page, only News and Events will show. Th... | Hi **@webcodeslinger:**
Here's what a basic MySQL query for loading News and Events would look like *(this is greatly simplified from what WordPress actually does):*
```
SELECT * FROM wp_posts WHERE post_type IN ('news','events')
```
What you want instead is something like this *(there are more performant ways to ... |
3,224 | <p>I recently started a WordPress blog, and now I get an ajax-loaded toolbar showing up at the top of tonnes of pages. It's all links to my WordPress accounts and blogs and stuff. It's fine that it shows up when I'm on WordPress or working with my blog, but I see it now on all sites that (I'm presuming) are built on ... | [
{
"answer_id": 3226,
"author": "sorich87",
"author_id": 473,
"author_profile": "https://wordpress.stackexchange.com/users/473",
"pm_score": 1,
"selected": false,
"text": "<p>There is no way to turn off that admin bar.</p>\n\n<p>Sites like \"failblog.org\" are actually wordpress.com blogs... | 2010/10/23 | [
"https://wordpress.stackexchange.com/questions/3224",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1362/"
] | I recently started a WordPress blog, and now I get an ajax-loaded toolbar showing up at the top of tonnes of pages. It's all links to my WordPress accounts and blogs and stuff. It's fine that it shows up when I'm on WordPress or working with my blog, but I see it now on all sites that (I'm presuming) are built on WordP... | Add the following code to your user stylesheet:
```
#wpcombar
{
height: 2px !important;
overflow: hidden !important;
}
#wpcombar:hover,
#wpcombar:focus
{
height: 28px !important;
}
```
This will shrink down the toolbar to a 2px line. You may use `display:none` to remove it c... |
3,233 | <p>I'm trying to figure out how to hook into the <code>/wp-admin/users.php</code> manage page to
create custom columns for showing the number of posts users have for the custom post types on <a href="http://2010.wphonors.com/"><strong>WPHonors.com</strong></a>. </p>
<p>I created a <a href="http://core.trac.wordpress.o... | [
{
"answer_id": 3234,
"author": "sorich87",
"author_id": 473,
"author_profile": "https://wordpress.stackexchange.com/users/473",
"pm_score": 1,
"selected": false,
"text": "<p>The following will add it:</p>\n\n<pre><code>function my_manage_users_custom_column($output = '', $column_name, $u... | 2010/10/24 | [
"https://wordpress.stackexchange.com/questions/3233",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1366/"
] | I'm trying to figure out how to hook into the `/wp-admin/users.php` manage page to
create custom columns for showing the number of posts users have for the custom post types on [**WPHonors.com**](http://2010.wphonors.com/).
I created a [trac ticket](http://core.trac.wordpress.org/ticket/15200) for this but [@nacin](h... | Here's an expansion of Mike's tutorial answer. I added links to the types listed so you can click on one and be taken right to a listing of all the posts in that type for that author, which required an additional variable for `$counts` and some extra output for `$custom_column[]`
```
add_action('manage_users_columns',... |
3,247 | <p>I have a set of custom post types with the <code>capability_type</code> argument set to <code>'page'</code></p>
<p>I want to include these in <code>wp_list_pages()</code> or similar so I can use the dynamic classes (such as <code>.current_page_item</code> and the like).</p>
<p>I've read <a href="https://wordpress.... | [
{
"answer_id": 3270,
"author": "goldenapples",
"author_id": 290,
"author_profile": "https://wordpress.stackexchange.com/users/290",
"pm_score": 4,
"selected": true,
"text": "<p>The <code>wp_list_pages()</code> function calls <code>get_pages()</code>, which can't be easily overridden with... | 2010/10/24 | [
"https://wordpress.stackexchange.com/questions/3247",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1298/"
] | I have a set of custom post types with the `capability_type` argument set to `'page'`
I want to include these in `wp_list_pages()` or similar so I can use the dynamic classes (such as `.current_page_item` and the like).
I've read [this post](https://wordpress.stackexchange.com/questions/1929/menu-with-automatic-pages... | The `wp_list_pages()` function calls `get_pages()`, which can't be easily overridden with a different post type. Here's a basic modification of that function which calls `get_posts()` instead. This takes basically the same arguments as **wp\_list\_pages**, with one additional: \*post\_type\* (set as the name of your po... |
3,253 | <p>As some of you know, there's an <a href="http://en.wikipedia.org/wiki/Easter_egg_(media)" rel="nofollow noreferrer">Easter Egg</a> hidden in the WordPress post revision system that will display a message from the movie <a href="http://www.imdb.com/title/tt0133093/" rel="nofollow noreferrer"><em>The Matrix</em></a> i... | [
{
"answer_id": 3258,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 0,
"selected": false,
"text": "<p>I adore how code goes extra mile to include easter egg in obfuscated and inflexible way. :(</p>\n\n<p>I suck with adm... | 2010/10/25 | [
"https://wordpress.stackexchange.com/questions/3253",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/46/"
] | As some of you know, there's an [Easter Egg](http://en.wikipedia.org/wiki/Easter_egg_(media)) hidden in the WordPress post revision system that will display a message from the movie [*The Matrix*](http://www.imdb.com/title/tt0133093/) if you perform a specific action (if you don't know, I won't spoil the surprise ... p... | The following plugin dynamically hides the two offending radios using jQuery, and kills revision self-comparisons.
```
<?php
# Plugin Name: Pest Control
# Plugin URI: http://www.semiologic.com/
# Description: Kills the Easter Bunny
# Version: 1.0
# Author: Denis de Bernardy
# License: Public Domain
class PestControl ... |
3,255 | <p>I have a site that I am migrating to WordPress, and I have a need to add properties that each of the users can edit (e.g., Address, City, State, Business Name, etc), along with some properties that Administrators can edit (IsActive, CanEmail) that wouldn't be displayed to the user. In addition, I need to be able to... | [
{
"answer_id": 3549,
"author": "Jan Fabry",
"author_id": 8,
"author_profile": "https://wordpress.stackexchange.com/users/8",
"pm_score": 0,
"selected": false,
"text": "<p>The basic idea is that you <a href=\"http://codex.wordpress.org/Function_Reference/add_user_meta\" rel=\"nofollow nor... | 2010/10/25 | [
"https://wordpress.stackexchange.com/questions/3255",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1371/"
] | I have a site that I am migrating to WordPress, and I have a need to add properties that each of the users can edit (e.g., Address, City, State, Business Name, etc), along with some properties that Administrators can edit (IsActive, CanEmail) that wouldn't be displayed to the user. In addition, I need to be able to dis... | To answer the first part of your question, I have just put my [class TTT\_User\_Profile\_Addon on GitHub](https://gist.github.com/762247). The class offers a simple interface to add a field to a profile page. I have added an example for a checkbox subclass and some code to initialize it per functions.php. This works in... |
3,262 | <p>I need to get the total number of posts that are not in selected categories.
I have category IDs of the categories that I want to exclude from count (in the variable <code>$folio_cat_ids</code>)</p>
<p>So far I have this code which is not working,</p>
<pre><code>$numposts = $wpdb->get_var("SELECT COUNT(*) FROM ... | [
{
"answer_id": 3549,
"author": "Jan Fabry",
"author_id": 8,
"author_profile": "https://wordpress.stackexchange.com/users/8",
"pm_score": 0,
"selected": false,
"text": "<p>The basic idea is that you <a href=\"http://codex.wordpress.org/Function_Reference/add_user_meta\" rel=\"nofollow nor... | 2010/10/25 | [
"https://wordpress.stackexchange.com/questions/3262",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1349/"
] | I need to get the total number of posts that are not in selected categories.
I have category IDs of the categories that I want to exclude from count (in the variable `$folio_cat_ids`)
So far I have this code which is not working,
```
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts
WHERE post_status =... | To answer the first part of your question, I have just put my [class TTT\_User\_Profile\_Addon on GitHub](https://gist.github.com/762247). The class offers a simple interface to add a field to a profile page. I have added an example for a checkbox subclass and some code to initialize it per functions.php. This works in... |
3,279 | <p>I am almost completely happy with a new site I built - see <a href="http://www.fatasbutter.com.au/gallery/the-music/attachment/019/" rel="nofollow">http://www.fatasbutter.com.au/gallery/the-music/attachment/019/</a></p>
<p>As a final touch, I want to add <code>#content</code> to the end of the link location for eac... | [
{
"answer_id": 3549,
"author": "Jan Fabry",
"author_id": 8,
"author_profile": "https://wordpress.stackexchange.com/users/8",
"pm_score": 0,
"selected": false,
"text": "<p>The basic idea is that you <a href=\"http://codex.wordpress.org/Function_Reference/add_user_meta\" rel=\"nofollow nor... | 2010/10/25 | [
"https://wordpress.stackexchange.com/questions/3279",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1309/"
] | I am almost completely happy with a new site I built - see <http://www.fatasbutter.com.au/gallery/the-music/attachment/019/>
As a final touch, I want to add `#content` to the end of the link location for each `previous_image_link()` and `next_image_link()`.
Any ideas on how to do this? | To answer the first part of your question, I have just put my [class TTT\_User\_Profile\_Addon on GitHub](https://gist.github.com/762247). The class offers a simple interface to add a field to a profile page. I have added an example for a checkbox subclass and some code to initialize it per functions.php. This works in... |
3,291 | <p><em>(<strong>Moderators note:</strong> The original title was: "Need help identifying and looping through categories where posts have custom field set")</em></p>
<p>I need to loop through my categories however I need to limit the categories
to those categories that include posts where the custom field of <code>pric... | [
{
"answer_id": 3294,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 1,
"selected": false,
"text": "<p>Do not use <code>query_posts()</code> for this. Always use <code>get_posts()</code> or <code>WP_Query</code> for seco... | 2010/10/26 | [
"https://wordpress.stackexchange.com/questions/3291",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | *(**Moderators note:** The original title was: "Need help identifying and looping through categories where posts have custom field set")*
I need to loop through my categories however I need to limit the categories
to those categories that include posts where the custom field of `price != 0`
or `null`.
What is the bes... | Hi **@Brian Fidler**:
There are several ways to solve this problem. I picked one that may appear more complex but is easier on the theme code, and also self-contained and probably more performant than some other approaches *(certainly more performant than doing repeated `query_posts()` for each category.)*
Basically ... |
3,293 | <p>Typically in my theme function file I'll require other files to keep things neat.</p>
<pre><code>require_once("foo.php");
</code></pre>
<p>Now working in a child theme I'd like to do that same. I'm adding custom admin options and it seems impossible to include code. I've echoed out the path to make sure I'm callin... | [
{
"answer_id": 3295,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 0,
"selected": false,
"text": "<p>It is completely possible and normal to do includes in <code>functions.php</code>.</p>\n\n<p>I do it like this in my ... | 2010/10/26 | [
"https://wordpress.stackexchange.com/questions/3293",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/141/"
] | Typically in my theme function file I'll require other files to keep things neat.
```
require_once("foo.php");
```
Now working in a child theme I'd like to do that same. I'm adding custom admin options and it seems impossible to include code. I've echoed out the path to make sure I'm calling the right file and it is... | Child themes reference parent themes by directory name, and in a normal install all your themes live in `wp-content/themes/`, so I'd say it's fine to reference those themes by their relative path:
```
include '../parent-theme/some-file.php';
```
If that makes you uncomfortable, I observe the following constants in W... |
3,305 | <p>I'm building a site for a photographer who uploads pictures that are normally large for todays digital cameras. Images are quite memory intensive, especially the image operations like creating thumbnails.</p>
<p>So I wanted to raise the memory limit in the admin above 256MB - how can this be done? I allowed CGI and... | [
{
"answer_id": 3306,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 0,
"selected": false,
"text": "<p>By your description I think this code in <code>admin.php</code> is the issue:</p>\n\n<pre><code>if ( current_user_can... | 2010/10/26 | [
"https://wordpress.stackexchange.com/questions/3305",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178/"
] | I'm building a site for a photographer who uploads pictures that are normally large for todays digital cameras. Images are quite memory intensive, especially the image operations like creating thumbnails.
So I wanted to raise the memory limit in the admin above 256MB - how can this be done? I allowed CGI and PHP to us... | Theoretically, editing your config.php and add this line **before** wp-settings.php inclusion.
```
define('WP_MEMORY_LIMIT', '256M');
```
**should** raise your memory limit for WordPress to 256MB or whatever value you set. And this will work sitewide. However, as [sorich87 pointed out](https://wordpress.stackexchang... |
3,316 | <p>I've used add_meta_box() to add a custom meta box to the WordPress edit window on both pages and posts.</p>
<p>How can I make this meta box also show on the "Quick Edit" screen?</p>
<p>Ideally, I'd like it to appear just to the right of the Categories selector.</p>
| [
{
"answer_id": 3325,
"author": "Jan Fabry",
"author_id": 8,
"author_profile": "https://wordpress.stackexchange.com/users/8",
"pm_score": 6,
"selected": true,
"text": "<p>There seems to be no easy way to do this, you must add all code yourself. <a href=\"http://core.trac.wordpress.org/bro... | 2010/10/26 | [
"https://wordpress.stackexchange.com/questions/3316",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/366/"
] | I've used add\_meta\_box() to add a custom meta box to the WordPress edit window on both pages and posts.
How can I make this meta box also show on the "Quick Edit" screen?
Ideally, I'd like it to appear just to the right of the Categories selector. | There seems to be no easy way to do this, you must add all code yourself. [`inline_edit_row()`](http://core.trac.wordpress.org/browser/branches/3.0/wp-admin/includes/template.php#L849), the function that draws the Quick Edit and Bulk Edit screens, seems to have only one action that you can hook into: [`quick_edit_custo... |
3,318 | <p>Is there an easy way to paginate the result set coming from $wpdb->get_results()?</p>
<p>I want to get a paginated list of a user's comments on the author_archive page - some of the users of the community have > 500 comments, so pagination is important.</p>
<p>Is there an in-built way of doing this with WordPress,... | [
{
"answer_id": 3319,
"author": "sorich87",
"author_id": 473,
"author_profile": "https://wordpress.stackexchange.com/users/473",
"pm_score": 4,
"selected": true,
"text": "<p>You can use the function <a href=\"http://codex.wordpress.org/Function_Reference/paginate_links\" rel=\"nofollow\">... | 2010/10/26 | [
"https://wordpress.stackexchange.com/questions/3318",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/490/"
] | Is there an easy way to paginate the result set coming from $wpdb->get\_results()?
I want to get a paginated list of a user's comments on the author\_archive page - some of the users of the community have > 500 comments, so pagination is important.
Is there an in-built way of doing this with WordPress, or do I need t... | You can use the function [paginate\_links()](http://codex.wordpress.org/Function_Reference/paginate_links) for any pagination.
For your specific case:
```
$total = $wpdb->get_var("
SELECT COUNT(comment_ID)
FROM $wpdb->comments
WHERE user_id = $thisauthor->ID
AND comment_post_id = ID
AND comment_ap... |
3,320 | <p>I am presently trying to call the fields of a custom widget using get_option and loop through the array created from the get_option() call. The issue is that it is outputting a blank one at the end, resulting in one extra than what I have enabled. Here is the code I have at the moment:</p>
<pre><code> $t... | [
{
"answer_id": 3321,
"author": "sorich87",
"author_id": 473,
"author_profile": "https://wordpress.stackexchange.com/users/473",
"pm_score": 0,
"selected": false,
"text": "<p>I think the issue is due to an empty record in the database.</p>\n\n<p>You can verify if $team_member is empty. Ad... | 2010/10/26 | [
"https://wordpress.stackexchange.com/questions/3320",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1006/"
] | I am presently trying to call the fields of a custom widget using get\_option and loop through the array created from the get\_option() call. The issue is that it is outputting a blank one at the end, resulting in one extra than what I have enabled. Here is the code I have at the moment:
```
$the_team = ge... | No further help is needed.
unset($the\_team['\_multiwidget']); worked, and was the element in the array that was showing up at the end of the call.
Will have to research what that part is exactly for future reference. |
3,344 | <p>I'm stucked at some point developing my theme.</p>
<p>I created a custom posts types to support an image gallery. So far, it's working great (have a look on 'galeria' on psaikali.com).
I registered this custom post type (register_post_type( 'artwork', $args )) and activated the 'page attributes' function, to defin... | [
{
"answer_id": 3349,
"author": "curtismchale",
"author_id": 141,
"author_profile": "https://wordpress.stackexchange.com/users/141",
"pm_score": 2,
"selected": false,
"text": "<p>You should be able to create a single-your-post-type-name.php file and have it work. I currently have it worki... | 2010/10/27 | [
"https://wordpress.stackexchange.com/questions/3344",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I'm stucked at some point developing my theme.
I created a custom posts types to support an image gallery. So far, it's working great (have a look on 'galeria' on psaikali.com).
I registered this custom post type (register\_post\_type( 'artwork', $args )) and activated the 'page attributes' function, to define a diff... | You should be able to create a single-your-post-type-name.php file and have it work. I currently have it working fine on 3 or 4 sites so if it's not working for you you're doing something wrong.
Based on your code sample single-artwork.php should work as a single page post template. You could also redirect on single.p... |
3,346 | <p>Anyone know a way round this?</p>
<p><a href="http://wordpress.org/support/topic/set-draft-page-as-parent">http://wordpress.org/support/topic/set-draft-page-as-parent</a></p>
<p>I can't risk publishing as a public-facing system updates periodically from the same install.</p>
| [
{
"answer_id": 3356,
"author": "eileencodes",
"author_id": 1352,
"author_profile": "https://wordpress.stackexchange.com/users/1352",
"pm_score": 2,
"selected": false,
"text": "<p>There is one way to do this, but it's kind of wonky. Instead of not publishing the page, you can hide the con... | 2010/10/27 | [
"https://wordpress.stackexchange.com/questions/3346",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/500/"
] | Anyone know a way round this?
<http://wordpress.org/support/topic/set-draft-page-as-parent>
I can't risk publishing as a public-facing system updates periodically from the same install. | This works for me:
```
add_filter('page_attributes_dropdown_pages_args', 'my_attributes_dropdown_pages_args', 1, 1);
function my_attributes_dropdown_pages_args($dropdown_args) {
$dropdown_args['post_status'] = array('publish','draft');
return $dropdown_args;
}
``` |
3,347 | <p>So I just setup my website <code>fightify.com</code> and as you will see, visitors are automatically redirected to a signup page, which shouldnt be happening.</p>
<p>This only occurs if the domain is typed without the www. prefix. <code>www.fightify.com</code> yields no errors.</p>
<p>I have a feeling that it has ... | [
{
"answer_id": 3348,
"author": "John P Bloch",
"author_id": 11,
"author_profile": "https://wordpress.stackexchange.com/users/11",
"pm_score": 4,
"selected": false,
"text": "<p>Yes, I've dealt with this before. You have to specify a <code>NOBLOGREDIRECT</code> in your <code>wp-config.php<... | 2010/10/27 | [
"https://wordpress.stackexchange.com/questions/3347",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | So I just setup my website `fightify.com` and as you will see, visitors are automatically redirected to a signup page, which shouldnt be happening.
This only occurs if the domain is typed without the www. prefix. `www.fightify.com` yields no errors.
I have a feeling that it has something to do with the .htaccess file... | Yes, I've dealt with this before. You have to specify a `NOBLOGREDIRECT` in your `wp-config.php` file:
```
define( 'NOBLOGREDIRECT', 'http://www.fightify.com' );
```
If there's no site, WP has to redirect visitors somewhere. By default, that's the signup page. Adding that constant tells it where to go. |
3,351 | <p>I'm updating programmatically posts in a WP 3.01 install, using custom made tools.
Sometimes I do change programmatically <code>post_status</code> from DRAFT to PUBLISHED using custom <code>SELECT</code> queries, however this seems spoiling posts permalinks.</p>
<p>When in a DRAFT state, posts have the following li... | [
{
"answer_id": 3360,
"author": "Denis de Bernardy",
"author_id": 1208,
"author_profile": "https://wordpress.stackexchange.com/users/1208",
"pm_score": 3,
"selected": true,
"text": "<p>You need to programmatically set the slug as you do so. An SQL trigger could do the trick. Don't forget ... | 2010/10/27 | [
"https://wordpress.stackexchange.com/questions/3351",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1210/"
] | I'm updating programmatically posts in a WP 3.01 install, using custom made tools.
Sometimes I do change programmatically `post_status` from DRAFT to PUBLISHED using custom `SELECT` queries, however this seems spoiling posts permalinks.
When in a DRAFT state, posts have the following link structure
```
http://myblog.... | You need to programmatically set the slug as you do so. An SQL trigger could do the trick. Don't forget to mind duplicate slugs as you write it.
Else, instead of publishing using the database, write a php script that calls the WP API. |
3,357 | <p>I have a custom hierarchical taxonomy that is called 'Categories', but serves a different area of the site than the default "Categories" taxonomy. The problem I'm having is with selecting children terms in the interface while posting content. If the user selects and children terms, they move to the top of the Catego... | [
{
"answer_id": 3375,
"author": "Jan Fabry",
"author_id": 8,
"author_profile": "https://wordpress.stackexchange.com/users/8",
"pm_score": 2,
"selected": true,
"text": "<p>This seems to be normal, it also happens for categories. The <a href=\"http://core.trac.wordpress.org/browser/branches... | 2010/10/27 | [
"https://wordpress.stackexchange.com/questions/3357",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1099/"
] | I have a custom hierarchical taxonomy that is called 'Categories', but serves a different area of the site than the default "Categories" taxonomy. The problem I'm having is with selecting children terms in the interface while posting content. If the user selects and children terms, they move to the top of the Categorie... | This seems to be normal, it also happens for categories. The [`wp_terms_checklist()`](http://core.trac.wordpress.org/browser/branches/3.0/wp-admin/includes/template.php#L245), which creates the checklist, has an argument `checked_ontop`, enabled by default. The metabox [does not override this](http://core.trac.wordpres... |
3,366 | <p>Is there a way to show no gravatar in comment list for the commenters that are not registered at gravatar.com?
As much as I saw, gravatar.com doesn't return a special code when no avatar is registered.</p>
<p>The temporary, not so elegant solution I applied for the moment is displaying a transparent 1x1px gif but ... | [
{
"answer_id": 3367,
"author": "pax",
"author_id": 967,
"author_profile": "https://wordpress.stackexchange.com/users/967",
"pm_score": 0,
"selected": false,
"text": "<p>I have modified a tiny bit of the <a href=\"http://en.gravatar.com/site/implement/images/php/\" rel=\"nofollow\">offici... | 2010/10/27 | [
"https://wordpress.stackexchange.com/questions/3366",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/967/"
] | Is there a way to show no gravatar in comment list for the commenters that are not registered at gravatar.com?
As much as I saw, gravatar.com doesn't return a special code when no avatar is registered.
The temporary, not so elegant solution I applied for the moment is displaying a transparent 1x1px gif but I'd like t... | This plugin hides all avatar images, and preloads them in Javascript, so client side, which should activate the browser cache. If the image exists, the avatar is replaced and made visible. If it does not exist, nothing happens and the avatar image stays hidden. Tested in Safari and Firefox on Mac.
```
<?php
/*
Plugin ... |
3,374 | <p>I'd like to be able to autopost from my wordpress site (private wordpress.org, not on wordpress.com) to multiple sites with one plugin/hack from within wordpress. I'd like my posts to be able to be auto-posted (linked to) on facebook, identi.ca, twitter, posterous, etc. without multiple plugins. I've looked everywhe... | [
{
"answer_id": 3367,
"author": "pax",
"author_id": 967,
"author_profile": "https://wordpress.stackexchange.com/users/967",
"pm_score": 0,
"selected": false,
"text": "<p>I have modified a tiny bit of the <a href=\"http://en.gravatar.com/site/implement/images/php/\" rel=\"nofollow\">offici... | 2010/10/28 | [
"https://wordpress.stackexchange.com/questions/3374",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1405/"
] | I'd like to be able to autopost from my wordpress site (private wordpress.org, not on wordpress.com) to multiple sites with one plugin/hack from within wordpress. I'd like my posts to be able to be auto-posted (linked to) on facebook, identi.ca, twitter, posterous, etc. without multiple plugins. I've looked everywhere ... | This plugin hides all avatar images, and preloads them in Javascript, so client side, which should activate the browser cache. If the image exists, the avatar is replaced and made visible. If it does not exist, nothing happens and the avatar image stays hidden. Tested in Safari and Firefox on Mac.
```
<?php
/*
Plugin ... |
3,393 | <p>Is there a way to temporarily disable revisions.... I have noticed that <code>wp_update_post</code> is very slow and creates revisions I don't need.
The fix could be to disable revisions before issuing <code>wp_update_post</code> and re-enable the feature once done....</p>
| [
{
"answer_id": 3398,
"author": "Riccardo",
"author_id": 1210,
"author_profile": "https://wordpress.stackexchange.com/users/1210",
"pm_score": 3,
"selected": false,
"text": "<p>Seems this will do the job:</p>\n\n<pre><code>remove_action('pre_post_update', 'wp_save_post_revision');// stop ... | 2010/10/28 | [
"https://wordpress.stackexchange.com/questions/3393",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1210/"
] | Is there a way to temporarily disable revisions.... I have noticed that `wp_update_post` is very slow and creates revisions I don't need.
The fix could be to disable revisions before issuing `wp_update_post` and re-enable the feature once done.... | To keep posts updated, I am working with WordPress 4.4 and to enable/disable post revisions programmatically use:
```
remove_action( 'post_updated', 'wp_save_post_revision' );
$post_id = wp_update_post( $arg );
add_action( 'post_updated', 'wp_save_post_revision' );
``` |
3,394 | <p><em>(<strong>Moderator's note:</strong> The original title was "How to know the number of custom type posts having a specific taxonomy")</em></p>
<p>I'm stuck with the function <code>wp_count_posts()</code>!</p>
<p>I created custom post types called <code>'artwork'</code> to display artworks in a gallery. I also c... | [
{
"answer_id": 3397,
"author": "sorich87",
"author_id": 473,
"author_profile": "https://wordpress.stackexchange.com/users/473",
"pm_score": 2,
"selected": false,
"text": "<p><code>wp_count_posts()</code> will not work for this, it does not accept a taxonomy parameter. You can do the foll... | 2010/10/28 | [
"https://wordpress.stackexchange.com/questions/3394",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | *(**Moderator's note:** The original title was "How to know the number of custom type posts having a specific taxonomy")*
I'm stuck with the function `wp_count_posts()`!
I created custom post types called `'artwork'` to display artworks in a gallery. I also created a custom taxonomy called `'artworkcat'` to sort each... | `wp_count_posts()` will not work for this, it does not accept a taxonomy parameter. You can do the following:
```
$taxonomy = 'artworkcat';
$term_slug = 'webdesign';
$post_type = 'artwork';
$term = get_term_by( 'slug', $term_slug, $taxonomy_type );
$count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $wpdb->... |
3,396 | <p>Is it possible to make custom page templates available from a plugin?</p>
| [
{
"answer_id": 3558,
"author": "Jan Fabry",
"author_id": 8,
"author_profile": "https://wordpress.stackexchange.com/users/8",
"pm_score": 8,
"selected": true,
"text": "<p><a href=\"http://core.trac.wordpress.org/browser/branches/3.0/wp-includes/theme.php#L917\"><code>get_page_template()</... | 2010/10/28 | [
"https://wordpress.stackexchange.com/questions/3396",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1341/"
] | Is it possible to make custom page templates available from a plugin? | [`get_page_template()`](http://core.trac.wordpress.org/browser/branches/3.0/wp-includes/theme.php#L917) can be overridden via the `page_template` filter. If your plugin is a directory with the templates as files in them, it's just a matter of passing the names of these files. If you want to create them "on the fly" (ed... |
3,405 | <p>Trying to print my custom post type's taxonomy but without the link. Tried this, but doesn't seem to work, any suggestions?</p>
<pre><code>$text = the_terms($post->ID,'type','','','');
echo strip_tags($text);
</code></pre>
<p>Any help would be greatly appreciated... I'm about to start punching babies.</p>
| [
{
"answer_id": 3406,
"author": "prettyboymp",
"author_id": 203,
"author_profile": "https://wordpress.stackexchange.com/users/203",
"pm_score": 1,
"selected": false,
"text": "<p>the_terms() echos the output and returns null. So your first line is echoing the terms with the anchor tags an... | 2010/10/28 | [
"https://wordpress.stackexchange.com/questions/3405",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1388/"
] | Trying to print my custom post type's taxonomy but without the link. Tried this, but doesn't seem to work, any suggestions?
```
$text = the_terms($post->ID,'type','','','');
echo strip_tags($text);
```
Any help would be greatly appreciated... I'm about to start punching babies. | You *could* use a filter and `strip_tags()`, as you suggested. Example using post tags, since that's the taxonomy I had available:
```
function my_remove_links( $term_links ) {
return array_map('strip_tags', $term_links);
}
add_filter('term_links-post_tag', 'my_remove_links');
```
Really though, I would just [`... |
3,407 | <p><em>(<strong>Moderator's note:</strong> The original title was: "Shrink full size images in post")</em></p>
<p>I built a WordPress site for someone and they entered a ton of posts with images that are wider than the content area. Is there a way to shrink all of the image attachements to use a max width? They are en... | [
{
"answer_id": 3413,
"author": "mireille raad",
"author_id": 692,
"author_profile": "https://wordpress.stackexchange.com/users/692",
"pm_score": 0,
"selected": false,
"text": "<p>I would suggest you fix this using the operating system or software.</p>\n\n<p>What i would do is download th... | 2010/10/28 | [
"https://wordpress.stackexchange.com/questions/3407",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1136/"
] | *(**Moderator's note:** The original title was: "Shrink full size images in post")*
I built a WordPress site for someone and they entered a ton of posts with images that are wider than the content area. Is there a way to shrink all of the image attachements to use a max width? They are entered as "full size", not as t... | **Great question!** WordPress lacks some of the higher level imaging management features that would make it file maintenance like you need so much easier. The core WordPress team has been threatening to add enhance image features for many versions; eventually they might actually do it! Until then you'll have to use a p... |
3,422 | <p>Please look at it here TAG page morsblog [dot] dk/tag/stranden/</p>
<p>For THIS TAG, I want to write some text in WordPress (it should have possibility to add defined text to any defined tag).
It should look something like this: <a href="http://farblog.dk/tag/motorsav-bukser/" rel="nofollow">http://farblog.dk/tag/m... | [
{
"answer_id": 3425,
"author": "sorich87",
"author_id": 473,
"author_profile": "https://wordpress.stackexchange.com/users/473",
"pm_score": 1,
"selected": false,
"text": "<p>You can add a tag description by editing the tag in your WordPress admin (Posts > Post Tags), then use the followi... | 2010/10/29 | [
"https://wordpress.stackexchange.com/questions/3422",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | Please look at it here TAG page morsblog [dot] dk/tag/stranden/
For THIS TAG, I want to write some text in WordPress (it should have possibility to add defined text to any defined tag).
It should look something like this: <http://farblog.dk/tag/motorsav-bukser/>
Is it possible to make a little plugin that make the te... | You can add a tag description by editing the tag in your WordPress admin (Posts > Post Tags), then use the following code to display the description in your template file:
```
$tag = $wp_query->get_queried_object();
echo $tag->description;
``` |
3,426 | <p>I'm in the process of setting up a (potentially) large multisite network, and I'm looking to make it as easy as possible now to add and configure sites when needed. I'm currently at the phase where I'm dealing with plugins.</p>
<p>With multisite I am aware of several different ways you can activate plugins</p>
<ul... | [
{
"answer_id": 3429,
"author": "Denis de Bernardy",
"author_id": 1208,
"author_profile": "https://wordpress.stackexchange.com/users/1208",
"pm_score": 0,
"selected": false,
"text": "<p>Not out of the box in WP 3, but it would be possible, I think, to override the option using the option_... | 2010/10/29 | [
"https://wordpress.stackexchange.com/questions/3426",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/25/"
] | I'm in the process of setting up a (potentially) large multisite network, and I'm looking to make it as easy as possible now to add and configure sites when needed. I'm currently at the phase where I'm dealing with plugins.
With multisite I am aware of several different ways you can activate plugins
* Put the plugin ... | You can use the filter `site_option_*`.
E.g. the following will disable akismet on blog with id 2.
```
add_filter('site_option_active_sitewide_plugins', 'modify_sitewide_plugins');
function modify_sitewide_plugins($value) {
global $current_blog;
if( $current_blog->blog_id == 2 ) {
unset($value['akis... |
3,431 | <p>I have read the discussion on the performance of different permalinks on the wp hackers mailinglist, THIS forum and around Google.</p>
<p>I could however not really deduce if the permalink structure I have been using for the past years is good or not:</p>
<pre><code>/%postname%-%year%%monthnum%%day%.html
</code></... | [
{
"answer_id": 3437,
"author": "Denis de Bernardy",
"author_id": 1208,
"author_profile": "https://wordpress.stackexchange.com/users/1208",
"pm_score": 4,
"selected": true,
"text": "<p>You can check by looking at the size of the rewrite_rules option in the database. If it's small (which I... | 2010/10/29 | [
"https://wordpress.stackexchange.com/questions/3431",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/576/"
] | I have read the discussion on the performance of different permalinks on the wp hackers mailinglist, THIS forum and around Google.
I could however not really deduce if the permalink structure I have been using for the past years is good or not:
```
/%postname%-%year%%monthnum%%day%.html
```
This combination put the... | You can check by looking at the size of the rewrite\_rules option in the database. If it's small (which I believe it should with this structure), you're not using verbose rules. By contrast, if you see several lines per static page, you're using verbose rules and it's not good. |
3,443 | <p>After we upgraded to Wordpress 3.0.1 (from Wordpress MU 2.9.2) we began getting an error message whenever we tried to upload media.</p>
<p><strong>"Missing a temporary folder"</strong></p>
<p>Various articles around the web mention the php setting <code>upload_tmp_dir</code> needing to be set in <code>php.ini</cod... | [
{
"answer_id": 3444,
"author": "leff",
"author_id": 1419,
"author_profile": "https://wordpress.stackexchange.com/users/1419",
"pm_score": 2,
"selected": false,
"text": "<p><code>upload_tmp_dir</code> is an optional setting in <code>php.ini</code>. Php will attempt to use the system defau... | 2010/10/29 | [
"https://wordpress.stackexchange.com/questions/3443",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1419/"
] | After we upgraded to Wordpress 3.0.1 (from Wordpress MU 2.9.2) we began getting an error message whenever we tried to upload media.
**"Missing a temporary folder"**
Various articles around the web mention the php setting `upload_tmp_dir` needing to be set in `php.ini`. This is not actually a requirement. I know becau... | `upload_tmp_dir` is an optional setting in `php.ini`. Php will attempt to use the system default temp directory. So it should *just work*.
If something happens to the permissions on your temp directory, regardless of wether you set it in `php.ini` or use the system default (usually `/tmp` on unix like systems), then m... |
3,458 | <p>I'm looking for a solution that would allow me to write tags inside posts and be sure that the visual editor or wordpress will not alter them.</p>
<p>The same problem can apply for other specific HTML code that I may want to use.</p>
<p>Disabling the visual editor is not an option, because in will render most edi... | [
{
"answer_id": 3460,
"author": "sorich87",
"author_id": 473,
"author_profile": "https://wordpress.stackexchange.com/users/473",
"pm_score": 4,
"selected": true,
"text": "<p>Add the following to your theme functions.php:</p>\n\n<pre><code>function fb_change_mce_options($initArray) {\n ... | 2010/10/30 | [
"https://wordpress.stackexchange.com/questions/3458",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/944/"
] | I'm looking for a solution that would allow me to write tags inside posts and be sure that the visual editor or wordpress will not alter them.
The same problem can apply for other specific HTML code that I may want to use.
Disabling the visual editor is not an option, because in will render most edit operation too ha... | Add the following to your theme functions.php:
```
function fb_change_mce_options($initArray) {
$ext = 'script[charset|defer|language|src|type]';
if ( isset( $initArray['extended_valid_elements'] ) ) {
$initArray['extended_valid_elements'] .= ',' . $ext;
} else {
$initArray['extended_valid... |
3,461 | <p>It looks that by default WordPress had hierarchy only for page/post categories and not for links categories.</p>
<p>How can I enable that?</p>
| [
{
"answer_id": 3460,
"author": "sorich87",
"author_id": 473,
"author_profile": "https://wordpress.stackexchange.com/users/473",
"pm_score": 4,
"selected": true,
"text": "<p>Add the following to your theme functions.php:</p>\n\n<pre><code>function fb_change_mce_options($initArray) {\n ... | 2010/10/30 | [
"https://wordpress.stackexchange.com/questions/3461",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/944/"
] | It looks that by default WordPress had hierarchy only for page/post categories and not for links categories.
How can I enable that? | Add the following to your theme functions.php:
```
function fb_change_mce_options($initArray) {
$ext = 'script[charset|defer|language|src|type]';
if ( isset( $initArray['extended_valid_elements'] ) ) {
$initArray['extended_valid_elements'] .= ',' . $ext;
} else {
$initArray['extended_valid... |
3,462 | <p>FeedWordPress is pulling in two, three, four, and as many as 15 copies of the same post when it updates (via manual cron triggers or via auto updates). </p>
<p>It doesn't happen all the time, and it doesn't happen with every post. I also noticed that it occasionally says that a FWP post was "created locally on this... | [
{
"answer_id": 3505,
"author": "Denis de Bernardy",
"author_id": 1208,
"author_profile": "https://wordpress.stackexchange.com/users/1208",
"pm_score": 1,
"selected": false,
"text": "<p>Do all of the posts have the same guid? If memory serves, that's what FWP looks at to check for dups.</... | 2010/10/30 | [
"https://wordpress.stackexchange.com/questions/3462",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1427/"
] | FeedWordPress is pulling in two, three, four, and as many as 15 copies of the same post when it updates (via manual cron triggers or via auto updates).
It doesn't happen all the time, and it doesn't happen with every post. I also noticed that it occasionally says that a FWP post was "created locally on this site", ev... | You can use the "syndicated\_post" hook that's available in FWP and hook in a function that checks for duplicate posts.
```
add_action('syndicated_post', 'fwp_check_duplicate');
```
I started working on this a few months back but did not complete it. I basically got to the point of flagging potential duplicates and... |
3,463 | <p><em>(<strong>Moderator's note:</strong> The original title was "wp_insert_post() and plugins")</em></p>
<p>I use <code>wp_insert_post()</code> like this:</p>
<pre><code> $my_post = array(
'post_title' => 'title',
'post_content' => $post,
'post_status' => 'publish',
'post_author' => 1,
'post_date' ... | [
{
"answer_id": 3464,
"author": "sorich87",
"author_id": 473,
"author_profile": "https://wordpress.stackexchange.com/users/473",
"pm_score": 1,
"selected": false,
"text": "<p>All-in-one SEO data are saved as post metas. You will need to use <code>add_post_meta</code>:</p>\n\n<pre><code>$m... | 2010/10/30 | [
"https://wordpress.stackexchange.com/questions/3463",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | *(**Moderator's note:** The original title was "wp\_insert\_post() and plugins")*
I use `wp_insert_post()` like this:
```
$my_post = array(
'post_title' => 'title',
'post_content' => $post,
'post_status' => 'publish',
'post_author' => 1,
'post_date' => date('Y-m-d H:i:s', $oldtime),
'post_category' => array(3,... | *@sorich87's* answer is 99% there. The difference is that [**All-in-One SEO Pack**](http://wordpress.org/extend/plugins/all-in-one-seo-pack/) follows certain best practices and uses a prefix of `'_aioseop_'` on its meta keys. That makes the actual working code look more like this:
```
$my_post = array(
'post_title' ... |
3,468 | <p>I'm trying to create a custom meta box with multiple text fields. The idea is that there is initially one text box, then you can click the button 'Add New' and a another text box is added (using Ajax; no need to publish or update the post for the text box to be created). I'm using the following code (below), but it ... | [
{
"answer_id": 4086,
"author": "Jeff Stieler",
"author_id": 1579,
"author_profile": "https://wordpress.stackexchange.com/users/1579",
"pm_score": 4,
"selected": true,
"text": "<p>If you end goal is to add text boxes dynamically, but still require the user to save/update the post, you don... | 2010/10/31 | [
"https://wordpress.stackexchange.com/questions/3468",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/13081/"
] | I'm trying to create a custom meta box with multiple text fields. The idea is that there is initially one text box, then you can click the button 'Add New' and a another text box is added (using Ajax; no need to publish or update the post for the text box to be created). I'm using the following code (below), but it jus... | If you end goal is to add text boxes dynamically, but still require the user to save/update the post, you don't need to use AJAX at all.
Just name the text fields appropriately so an array of values is POSTed, then handle it in your save action.
It may be helpful to save this array in a single post meta key, so you c... |
3,469 | <p>I'm trying to have spacing show up between a paragraph and heading in the following excerpt:</p>
<p>In my <a href="http://theuniversityblog.co.uk/2010/09/21/clubs-societies-zen/" rel="nofollow">article</a> <a href="http://blog.sysil.com/2010/09/21/extracurricular-club-handling-sovereign-zen-style-part-2/" rel="nofo... | [
{
"answer_id": 4086,
"author": "Jeff Stieler",
"author_id": 1579,
"author_profile": "https://wordpress.stackexchange.com/users/1579",
"pm_score": 4,
"selected": true,
"text": "<p>If you end goal is to add text boxes dynamically, but still require the user to save/update the post, you don... | 2010/10/31 | [
"https://wordpress.stackexchange.com/questions/3469",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/598/"
] | I'm trying to have spacing show up between a paragraph and heading in the following excerpt:
In my [article](http://theuniversityblog.co.uk/2010/09/21/clubs-societies-zen/) [series](http://blog.sysil.com/2010/09/21/extracurricular-club-handling-sovereign-zen-style-part-2/) on handling extracurriculars, I coined the te... | If you end goal is to add text boxes dynamically, but still require the user to save/update the post, you don't need to use AJAX at all.
Just name the text fields appropriately so an array of values is POSTed, then handle it in your save action.
It may be helpful to save this array in a single post meta key, so you c... |
3,479 | <p>I want to install WP in 3 languages: en, ro, ru</p>
<pre><code>mysite.com/en
mysite.com/ro
mysite.com/ru
</code></pre>
<p>I was not sure, but installed WP in the root folder.</p>
<p>Now I need to redirect visitors to default language. Say "en".
AND I don't need having 4 sites actually: <code>/</code>, <code>/en/<... | [
{
"answer_id": 3481,
"author": "edelwater",
"author_id": 576,
"author_profile": "https://wordpress.stackexchange.com/users/576",
"pm_score": 2,
"selected": false,
"text": "<p>just leave it and place a redirect on it?</p>\n"
},
{
"answer_id": 3488,
"author": "bueltge",
"au... | 2010/10/31 | [
"https://wordpress.stackexchange.com/questions/3479",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1431/"
] | I want to install WP in 3 languages: en, ro, ru
```
mysite.com/en
mysite.com/ro
mysite.com/ru
```
I was not sure, but installed WP in the root folder.
Now I need to redirect visitors to default language. Say "en".
AND I don't need having 4 sites actually: `/`, `/en/`, `/ro/`, `/ru/`, but 3.
The situation is actual... | I use on the root site a small theme for redirect to the languages. A very small theme for locate the language of the users and redirect to the blog of this language.
```
<?php
// Browsersprache ermitteln
function lang_get_from_browser($allowed_languages, $default_language, $lang_variable = NULL, $strict_mode = TRUE) ... |
3,480 | <p>I would like to add a "Click to download" button to one of my WordPress plugins, and I'm not sure which hook to use. So far, hooking 'admin_init' to this code seems to work:</p>
<pre><code> header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=data.csv");
header("Prag... | [
{
"answer_id": 3499,
"author": "MikeSchinkel",
"author_id": 89,
"author_profile": "https://wordpress.stackexchange.com/users/89",
"pm_score": 6,
"selected": true,
"text": "<p>If I understand you correctly you want to have <strong>a URL something like the following</strong> whose response... | 2010/10/31 | [
"https://wordpress.stackexchange.com/questions/3480",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1427/"
] | I would like to add a "Click to download" button to one of my WordPress plugins, and I'm not sure which hook to use. So far, hooking 'admin\_init' to this code seems to work:
```
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=data.csv");
header("Pragma: no-cache"... | If I understand you correctly you want to have **a URL something like the following** whose response to the browser will be the content you generate, i.e. your `.CSV` file and no generated content from WordPress?
```
http://example.com/download/data.csv
```
I think you are looking for the `'template_redirect'` hook.... |
3,483 | <p>How can I make a separate RSS feed for each custom post type?</p>
<p>I had searched the net for it and found suggestions to do something like this:</p>
<blockquote>
<p><a href="http://www.yoursite.com/feed/?post_type=book" rel="noreferrer">http://www.yoursite.com/feed/?post_type=book</a></p>
</blockquote>
<p>I ... | [
{
"answer_id": 3487,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 2,
"selected": false,
"text": "<p>add the small example function:</p>\n\n<pre><code> add_action( 'request', 'fb_add_to_feed' );\n\n // add to p... | 2010/10/31 | [
"https://wordpress.stackexchange.com/questions/3483",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1044/"
] | How can I make a separate RSS feed for each custom post type?
I had searched the net for it and found suggestions to do something like this:
>
> <http://www.yoursite.com/feed/?post_type=book>
>
>
>
I tried the above, but it just didn't work! It only takes me back to the custom post type archive page again...
Do... | Okay, thanks to all who contributed to answering my question, but I had finally figured out the solution to my problem.
Sorry for being naive but it turned out that I had a **template\_redirect** action added to direct anything that's related to my **post types** to their respective **template files**. Something like ... |
3,490 | <p>Back in May, I recall seeing a post on the WordPress Development blog by Alex M (Viper007bond.com) where he added functionality for <a href="http://wpdevel.wordpress.com/2010/05/03/automatic-ticketrevisiondiff-linking/" rel="nofollow">Automatic Ticket/Revision/Diff Linking</a> which allows for linking to Trac ticket... | [
{
"answer_id": 3491,
"author": "edelwater",
"author_id": 576,
"author_profile": "https://wordpress.stackexchange.com/users/576",
"pm_score": 0,
"selected": false,
"text": "<p>Also take a look at RTC (free for 10 users on jazz.net) it is the next big thing.</p>\n\n<p>It automatically comb... | 2010/11/01 | [
"https://wordpress.stackexchange.com/questions/3490",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/111/"
] | Back in May, I recall seeing a post on the WordPress Development blog by Alex M (Viper007bond.com) where he added functionality for [Automatic Ticket/Revision/Diff Linking](http://wpdevel.wordpress.com/2010/05/03/automatic-ticketrevisiondiff-linking/) which allows for linking to Trac tickets, Trac revisions, and Trac d... | Here's the source of the functionality. It's just a content filter and some basic regex that one of my coworkers at Automattic wrote.
```
add_filter( 'the_content', 'markup_wporg_links' );
add_filter( 'comment_text', 'markup_wporg_links' );
function markup_wporg_links( $content ) {
$find = array(
'/(\ |^)... |
3,507 | <p>Is there a way to add a custom field value (if it exists) to the permalink?</p>
| [
{
"answer_id": 3508,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 0,
"selected": false,
"text": "<p>Definitely no easy way since it's not part of <a href=\"http://codex.wordpress.org/Using_Permalinks#Structure_Tags\" ... | 2010/11/01 | [
"https://wordpress.stackexchange.com/questions/3507",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | Is there a way to add a custom field value (if it exists) to the permalink? | Here's how I'd do it. I'm just going to say, I haven't tested this code at all, so I don't know if it even works. It's more of a starting point for you.
```
function jpb_custom_meta_permalink( $link, $post ){
$post_meta = get_post_meta( $post->ID, '<insert your meta key here>', true );
if( empty( $post_meta ) || !... |
3,520 | <p>I have several functions that are called from inside a <a href="http://codex.wordpress.org/Plugin_API/Action_Reference/save_post" rel="nofollow"><code>save_post</code></a> function. However, all of the functions that use the <code>$post</code> object are returning incorrect values because it appears that the default... | [
{
"answer_id": 3521,
"author": "Denis de Bernardy",
"author_id": 1208,
"author_profile": "https://wordpress.stackexchange.com/users/1208",
"pm_score": 1,
"selected": false,
"text": "<p>Use <code>get_post($post_id)</code></p>\n<h2>Reference:</h2>\n<p><a href=\"http://codex.wordpress.org/F... | 2010/11/01 | [
"https://wordpress.stackexchange.com/questions/3520",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/366/"
] | I have several functions that are called from inside a [`save_post`](http://codex.wordpress.org/Plugin_API/Action_Reference/save_post) function. However, all of the functions that use the `$post` object are returning incorrect values because it appears that the default value being passed to [`save_post`](http://codex.w... | Do:
```
add_action('save_post', 'my_save_function', 10, 2);
```
And the `$post object` will be passed as second argument to your function:
```
function my_save_function($post_ID, $post) {
``` |
3,533 | <p>I'm getting this message each time I activate my plugin:</p>
<p><em>The plugin generated 80 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.</em></p>
<p>The only way I can suppr... | [
{
"answer_id": 3534,
"author": "MikeSchinkel",
"author_id": 89,
"author_profile": "https://wordpress.stackexchange.com/users/89",
"pm_score": 2,
"selected": true,
"text": "<p>When you get this kind of message is <strong>usually means your plugin had a syntax error</strong> and was genera... | 2010/11/01 | [
"https://wordpress.stackexchange.com/questions/3533",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/366/"
] | I'm getting this message each time I activate my plugin:
*The plugin generated 80 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.*
The only way I can suppress the message is to ... | When you get this kind of message is **usually means your plugin had a syntax error** and was generating that kind of error messages because of how the loading on activation is handled, i.e. HTTP headers are sent after the error message is display. Your plugin's error message is loaded in an `<iframe>`; have you done a... |
3,537 | <p>I'm creating som custom templates in Wordpress and I'm passing some data in the URL's.</p>
<p>Currently my URL looks like this:
<a href="http://www.mysite.com/designers/?id=43&name=designer+name" rel="nofollow">http://www.mysite.com/designers/?id=43&name=designer+name</a></p>
<p>The URL contains designer I... | [
{
"answer_id": 3546,
"author": "MikeSchinkel",
"author_id": 89,
"author_profile": "https://wordpress.stackexchange.com/users/89",
"pm_score": 2,
"selected": false,
"text": "<p>First I have a question: How are you getting URLs that look like the following?</p>\n\n<pre><code>http://www.exa... | 2010/11/02 | [
"https://wordpress.stackexchange.com/questions/3537",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1447/"
] | I'm creating som custom templates in Wordpress and I'm passing some data in the URL's.
Currently my URL looks like this:
<http://www.mysite.com/designers/?id=43&name=designer+name>
The URL contains designer ID and designer name.
I would really like to use this:
<http://www.mysite.com/designers/designer+name/>
My pe... | I don't know (or didn't know) much about the rewrite rules myself (but it seems [nobody does](http://core.trac.wordpress.org/browser/branches/3.0/wp-includes/rewrite.php#L1228)), but based on some other answers here, I got this to work. We add a new rewrite rule that matches `designers/designer_name/`. We "flush" the r... |
3,570 | <p>I'd like to implement a similar functionality as WP Categories screen in the Admin area. Where you can add category and it will appear in the list of all categories straight away.</p>
<p>I have a CD custom post type and I would like to add tracks to a CD in the same way as WP Categories are added. So that after gen... | [
{
"answer_id": 3579,
"author": "EAMann",
"author_id": 46,
"author_profile": "https://wordpress.stackexchange.com/users/46",
"pm_score": 1,
"selected": false,
"text": "<p>I think you have widgets and custom posts confused a little bit. The <code>WP_Widget</code> class is used to build co... | 2010/11/02 | [
"https://wordpress.stackexchange.com/questions/3570",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1343/"
] | I'd like to implement a similar functionality as WP Categories screen in the Admin area. Where you can add category and it will appear in the list of all categories straight away.
I have a CD custom post type and I would like to add tracks to a CD in the same way as WP Categories are added. So that after general CD in... | first your form that calls the ajax must have the an action filed with the value of the ajax hook
for example your ajax call is:
```
add_action('wp_ajax_show_all_tracks', 'show_all_tracks');
```
the your form action field must be:
```
<input type="hidden" name="action" value="show_all_tracks" />
```
thats for sta... |
3,572 | <p>When displaying a category how can I tell what category it is? Say I'm on <code>http://www.example.com/category/quotes</code>, how can I get <code>quotes</code> aside from parsing the URL? I tried <code>get_the_category()</code> but it returns an array of all the categories of the first post shown in the page.</p>
| [
{
"answer_id": 3573,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 3,
"selected": true,
"text": "<p>This should get you category object with ID, slug and rest of info:</p>\n\n<pre><code>$wp_query->get_queried_object... | 2010/11/02 | [
"https://wordpress.stackexchange.com/questions/3572",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/745/"
] | When displaying a category how can I tell what category it is? Say I'm on `http://www.example.com/category/quotes`, how can I get `quotes` aside from parsing the URL? I tried `get_the_category()` but it returns an array of all the categories of the first post shown in the page. | This should get you category object with ID, slug and rest of info:
```
$wp_query->get_queried_object();
``` |
3,578 | <p>Is there a way to change the text of the publish button on a custom post type to say some different? For example, Save instead of Publish. And also remove the draft button?</p>
| [
{
"answer_id": 3620,
"author": "hakre",
"author_id": 178,
"author_profile": "https://wordpress.stackexchange.com/users/178",
"pm_score": 2,
"selected": false,
"text": "<p>This is not a full answer but some directions: Any text displayed surpasses a translation filter and can therefore b... | 2010/11/02 | [
"https://wordpress.stackexchange.com/questions/3578",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/151/"
] | Is there a way to change the text of the publish button on a custom post type to say some different? For example, Save instead of Publish. And also remove the draft button? | If you look into `/wp-admin/edit-form-advanced.php`, you will find the meta box:
```
add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $post_type, 'side', 'core');
```
Note the `__('Publish')` – the function `__()` leads to `translate()` where you get the filter `'gettext'`.
There are two ways to han... |
3,586 | <p>I am using wordpress Version 2.9.2 and XML Sitemap Generator 3.2.3 </p>
<p>I have registered with Google Webmaster Tools.</p>
<p>But I get an error while notifying to Google and I really don't know what it means.</p>
<p>Heres a screenshot :</p>
<p><img src="https://i.stack.imgur.com/T2dwe.png" alt="alt text"></p... | [
{
"answer_id": 3620,
"author": "hakre",
"author_id": 178,
"author_profile": "https://wordpress.stackexchange.com/users/178",
"pm_score": 2,
"selected": false,
"text": "<p>This is not a full answer but some directions: Any text displayed surpasses a translation filter and can therefore b... | 2010/11/03 | [
"https://wordpress.stackexchange.com/questions/3586",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1293/"
] | I am using wordpress Version 2.9.2 and XML Sitemap Generator 3.2.3
I have registered with Google Webmaster Tools.
But I get an error while notifying to Google and I really don't know what it means.
Heres a screenshot :

And when I click on view result it show me the... | If you look into `/wp-admin/edit-form-advanced.php`, you will find the meta box:
```
add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $post_type, 'side', 'core');
```
Note the `__('Publish')` – the function `__()` leads to `translate()` where you get the filter `'gettext'`.
There are two ways to han... |
3,599 | <p>I have the following temporary filter to fix a content error. We have data in our posts that have 4 digit zip codes, because the leading zero was cut when the original file was created. (For instance, a Massachusetts zip code is 0XXXX, but now in our content it is XXXX)</p>
<pre><code>function fix_zip_code($content... | [
{
"answer_id": 3607,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 1,
"selected": false,
"text": "<p>You can try to approach that from WP/PHP side, but I think in this case it would be easier to run replacement on data... | 2010/11/03 | [
"https://wordpress.stackexchange.com/questions/3599",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10/"
] | I have the following temporary filter to fix a content error. We have data in our posts that have 4 digit zip codes, because the leading zero was cut when the original file was created. (For instance, a Massachusetts zip code is 0XXXX, but now in our content it is XXXX)
```
function fix_zip_code($content){
if (pre... | ```
//run once
$allposts = get_posts('post_status=publish&numberposts=-1');
foreach ($allposts as $thispost) {
wp_update_post( array(
'ID' => $thispost->ID,
'post_content' => fix_zip_code($thispost->post_content)
)
);
}
```
But as Rarst mentioned, backup your database before d... |
3,602 | <p>I would like to use jQuery in my Wordpress plugin. I'm trying to load the jquery library using the enqueue script but its throwing an error.</p>
<p><em>Error: $ is not a function</em></p>
<p>Here's the code snippet that's inside my main plugin.php file...</p>
<pre><code>function ($post)
{
wp_enqueue_script('j... | [
{
"answer_id": 3603,
"author": "Jan Fabry",
"author_id": 8,
"author_profile": "https://wordpress.stackexchange.com/users/8",
"pm_score": 3,
"selected": true,
"text": "<p>jQuery is included in <a href=\"http://api.jquery.com/jQuery.noConflict/\" rel=\"nofollow\"><code>noConflict</code> mo... | 2010/11/03 | [
"https://wordpress.stackexchange.com/questions/3602",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/366/"
] | I would like to use jQuery in my Wordpress plugin. I'm trying to load the jquery library using the enqueue script but its throwing an error.
*Error: $ is not a function*
Here's the code snippet that's inside my main plugin.php file...
```
function ($post)
{
wp_enqueue_script('jquery');
?>
<script type="t... | jQuery is included in [`noConflict` mode](http://api.jquery.com/jQuery.noConflict/) in WordPress, so you can't use the shorthand `$`, but must write `jQuery(this).html(jQuery(this).html().replace(rx, '<b>$&</b>'));` |
3,605 | <p>I have a blog with some posts, and each post has a embedded Facebook <a href="https://developers.facebook.com/docs/reference/plugins/like/">like button</a>. Pressing the button opens a dialog so my visitors can share the post on Facebook with a comment.</p>
<p>When sharing, however, the image selected by Facebook i... | [
{
"answer_id": 3637,
"author": "curtismchale",
"author_id": 141,
"author_profile": "https://wordpress.stackexchange.com/users/141",
"pm_score": 4,
"selected": true,
"text": "<p>The image that is used for sharing is taken from a chunk of code in the header of your site that will look some... | 2010/11/03 | [
"https://wordpress.stackexchange.com/questions/3605",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/395/"
] | I have a blog with some posts, and each post has a embedded Facebook [like button](https://developers.facebook.com/docs/reference/plugins/like/). Pressing the button opens a dialog so my visitors can share the post on Facebook with a comment.
When sharing, however, the image selected by Facebook is a generic mail icon... | The image that is used for sharing is taken from a chunk of code in the header of your site that will look something like this:
```
<link rel="image_src" href="path/to/theme/screenshot.png" />
```
Typically it links to the screenshot of your site in the theme. If you removed the code from the header of the file and ... |
3,617 | <p>I want to give the users the ability to sort the posts in the archive by some custom fields that I pre-define. </p>
<p>The end result would be en a tabbed container, and the user will click on the relevant filter-link that he/her want to see. </p>
<p>As an example: <a href="http://www.metacritic.com/browse/games/g... | [
{
"answer_id": 3628,
"author": "Jan Fabry",
"author_id": 8,
"author_profile": "https://wordpress.stackexchange.com/users/8",
"pm_score": 1,
"selected": false,
"text": "<p>This is certainly possible, but how easy it will be depends on how clean you want the URL to be. If you don't mind ap... | 2010/11/04 | [
"https://wordpress.stackexchange.com/questions/3617",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1463/"
] | I want to give the users the ability to sort the posts in the archive by some custom fields that I pre-define.
The end result would be en a tabbed container, and the user will click on the relevant filter-link that he/her want to see.
As an example: <http://www.metacritic.com/browse/games/genre/date/action/all>
I... | NOTES: Regarding Jan Fabry's answer...
Be sure to sanitize that incoming data first, else you're opening yourself to all sorts of nasty query strings..
You should also probably return the incoming data on that filter, return $query, in place of return;
I also think it would be preferable to have an array of possible... |
3,633 | <p>I have a function inside my plugin that attaches to save_post, and inside that function, I'm seeking to filter the post_content prior to it being saved. However, the content never actually gets changed once its saved. See below where I'm setting $post->post_content = "test";</p>
<pre><code>add_action('save_post', '... | [
{
"answer_id": 3634,
"author": "prettyboymp",
"author_id": 203,
"author_profile": "https://wordpress.stackexchange.com/users/203",
"pm_score": 1,
"selected": false,
"text": "<p>The 'save_post' filter runs after the post is filtered. If you need to modify the content before it is saved, ... | 2010/11/04 | [
"https://wordpress.stackexchange.com/questions/3633",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/366/"
] | I have a function inside my plugin that attaches to save\_post, and inside that function, I'm seeking to filter the post\_content prior to it being saved. However, the content never actually gets changed once its saved. See below where I'm setting $post->post\_content = "test";
```
add_action('save_post', 'save_post_f... | [The `content_save_pre` filter](http://core.trac.wordpress.org/browser/branches/3.0/wp-includes/post.php#L1461) is applied to the content before it gets saved in the database. Some default filters hook into it too, for example [`balanceTags()`](http://core.trac.wordpress.org/browser/branches/3.0/wp-includes/default-fil... |
3,638 | <p>In the function below, the save_content function runs, but the doReplace does not (echo </p>
<p>"This is the doReplace" never shows. Any ideas why?</p>
<pre><code>add_action('content_save_pre', 'save_content');
function save_content($content){
global $post;
$mykeyword = rseo_getKeyword($post);
$mykeyword =... | [
{
"answer_id": 3639,
"author": "t31os",
"author_id": 31073,
"author_profile": "https://wordpress.stackexchange.com/users/31073",
"pm_score": 2,
"selected": true,
"text": "<p>Your function needs to return the data, not echo it..</p>\n\n<pre><code>function doReplace($matches) {\n return... | 2010/11/04 | [
"https://wordpress.stackexchange.com/questions/3638",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/366/"
] | In the function below, the save\_content function runs, but the doReplace does not (echo
"This is the doReplace" never shows. Any ideas why?
```
add_action('content_save_pre', 'save_content');
function save_content($content){
global $post;
$mykeyword = rseo_getKeyword($post);
$mykeyword = preg_quote($mykeywo... | Your function needs to return the data, not echo it..
```
function doReplace($matches) {
return "This is the doReplace";
}
```
Hope that helps.. |
3,640 | <p>I am trying to build a class to make the job off adding new settings easier. The trouble I am having is that, although I have traced the variable through all of it's stages, the string 'manage_options' doesn't seem to grant admin the right to amend and option. I keep getting "You do not have sufficient permissions t... | [
{
"answer_id": 3639,
"author": "t31os",
"author_id": 31073,
"author_profile": "https://wordpress.stackexchange.com/users/31073",
"pm_score": 2,
"selected": true,
"text": "<p>Your function needs to return the data, not echo it..</p>\n\n<pre><code>function doReplace($matches) {\n return... | 2010/11/04 | [
"https://wordpress.stackexchange.com/questions/3640",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/784/"
] | I am trying to build a class to make the job off adding new settings easier. The trouble I am having is that, although I have traced the variable through all of it's stages, the string 'manage\_options' doesn't seem to grant admin the right to amend and option. I keep getting "You do not have sufficient permissions to ... | Your function needs to return the data, not echo it..
```
function doReplace($matches) {
return "This is the doReplace";
}
```
Hope that helps.. |
3,660 | <p>After reading
<em><a href="https://wordpress.stackexchange.com/questions/578/adding-a-taxonomy-filter-to-admin-list-for-a-custom-post-type">Adding a Taxonomy Filter to Admin List for a Custom Post Type?</a></em> I tried it but I wasn't able to get it to filter two (2) different taxonomies at same time. The system i... | [
{
"answer_id": 3669,
"author": "MikeSchinkel",
"author_id": 89,
"author_profile": "https://wordpress.stackexchange.com/users/89",
"pm_score": 4,
"selected": true,
"text": "<p>I don't have the time to actually write up a fully working example for you right now, but since you requested hel... | 2010/11/04 | [
"https://wordpress.stackexchange.com/questions/3660",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1372/"
] | After reading
*[Adding a Taxonomy Filter to Admin List for a Custom Post Type?](https://wordpress.stackexchange.com/questions/578/adding-a-taxonomy-filter-to-admin-list-for-a-custom-post-type)* I tried it but I wasn't able to get it to filter two (2) different taxonomies at same time. The system is only filtering late... | I don't have the time to actually write up a fully working example for you right now, but since you requested help in email I figured I would point you in the right direction.
As you may or may not know, this isn't really an issue for the admin post listing; most all of that code should work fine. The issue is that cu... |
3,665 | <p>I'm sure this question is asked alot, but I cannot figure it out, since all the different ways to query posts are confusing me.. </p>
<p>Here is my current code.<br>
How can I tell the code to only get posts from category ID #22? </p>
<pre><code><?php
$querystr = "
SELECT post_id, AVG(meta_value) AS total... | [
{
"answer_id": 3667,
"author": "Wadih M.",
"author_id": 442,
"author_profile": "https://wordpress.stackexchange.com/users/442",
"pm_score": 2,
"selected": false,
"text": "<p>You would need to join in the sk_term_relationships table.</p>\n\n<pre><code>$querystr = \" \n SELECT post_id, AVG... | 2010/11/04 | [
"https://wordpress.stackexchange.com/questions/3665",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1463/"
] | I'm sure this question is asked alot, but I cannot figure it out, since all the different ways to query posts are confusing me..
Here is my current code.
How can I tell the code to only get posts from category ID #22?
```
<?php
$querystr = "
SELECT post_id, AVG(meta_value) AS total, COUNT(post_id) as num_k... | I would do this in two pieces.
1. Add this into your functions.php file to grab custom fields globally:
```
function get_custom_field($key, $echo = FALSE) {
global $post;
$custom_field = get_post_meta($post->ID, $key, true);
if ($echo == FALSE) return $custom_field;
echo $custom_field;
```
}
2. Build your query as... |
3,670 | <p>I'm working on building a recipe/meal planning site in WordPress. I need to have recipes indexable and sortable by the ingredients required, and I'm trying to figure out the best way of doing that. </p>
<p>Ideally, I would like to have ingredients in one taxonomy, and utensils/appliances required in another taxonom... | [
{
"answer_id": 3690,
"author": "prettyboymp",
"author_id": 203,
"author_profile": "https://wordpress.stackexchange.com/users/203",
"pm_score": 1,
"selected": false,
"text": "<p>My suggestion would be to only store the ingredient names as a custom taxonomy and store everything else about ... | 2010/11/04 | [
"https://wordpress.stackexchange.com/questions/3670",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/290/"
] | I'm working on building a recipe/meal planning site in WordPress. I need to have recipes indexable and sortable by the ingredients required, and I'm trying to figure out the best way of doing that.
Ideally, I would like to have ingredients in one taxonomy, and utensils/appliances required in another taxonomy. I'm com... | It's a good idea to use a custom taxonomy to link your ingredients, as this will allow you to get recipes by ingredient. This also means you don't have to store each individual ingredient as a separate meta key-value pair, as you won't do any lookups there. Just store one big object, `ingredients`, as an ordered list o... |
3,708 | <p>Is there an easy way to query for any posts that is tagged with any term from a particular taxonomy?</p>
<p>I know this technique:</p>
<pre><code>$custom_taxonomy_query = new WP_Query(
array(
'taxonomy_name' => 'term_slug',
)
);
</code></pre>
<p>But I would like to either pass a wildcard in place of term_... | [
{
"answer_id": 3709,
"author": "t31os",
"author_id": 31073,
"author_profile": "https://wordpress.stackexchange.com/users/31073",
"pm_score": 1,
"selected": false,
"text": "<p>You should just be able to set the taxonomy and negate to include a term..</p>\n\n<p>Eg.</p>\n\n<pre><code><?p... | 2010/11/05 | [
"https://wordpress.stackexchange.com/questions/3708",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1427/"
] | Is there an easy way to query for any posts that is tagged with any term from a particular taxonomy?
I know this technique:
```
$custom_taxonomy_query = new WP_Query(
array(
'taxonomy_name' => 'term_slug',
)
);
```
But I would like to either pass a wildcard in place of term\_slug, or perhaps just an empty stri... | In retrospect, I've did a mashup of MikeSchinkel and t31os suggestion. It's possible to inject that to existing queries on the fly, but it needs WordPress 3.1:
**[Plugin to get an RSS Feed for posts containing any term from a taxonomy.](https://wordpress.stackexchange.com/questions/3720/rss-feed-for-posts-containing-a... |
3,720 | <p>I imagine the answer to this will be related to this question I asked yesterday:</p>
<p><a href="https://wordpress.stackexchange.com/questions/3708/custom-taxonomy-wp-query-for-all-terms-in-a-taxonomy">Custom Taxonomy WP_Query for All Terms in a Taxonomy?</a></p>
<p>I would like to output an RSS feed containing al... | [
{
"answer_id": 8618,
"author": "hakre",
"author_id": 178,
"author_profile": "https://wordpress.stackexchange.com/users/178",
"pm_score": 3,
"selected": false,
"text": "<h2>The Solution</h2>\n<p><a href=\"https://gist.github.com/812542\" rel=\"noreferrer\">WordPress 3.1 Taxonomy Feeds Plu... | 2010/11/06 | [
"https://wordpress.stackexchange.com/questions/3720",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1427/"
] | I imagine the answer to this will be related to this question I asked yesterday:
[Custom Taxonomy WP\_Query for All Terms in a Taxonomy?](https://wordpress.stackexchange.com/questions/3708/custom-taxonomy-wp-query-for-all-terms-in-a-taxonomy)
I would like to output an RSS feed containing all posts that have ANY entry... | The Solution
------------
[WordPress 3.1 Taxonomy Feeds Plugin (Must Use)](https://gist.github.com/812542)
Put that must-use plugin on your site and request:
>
> <http://blog.example.com/feed/?taxonomy=taxonomy-name>
>
>
>
as you asked for it.
Detailed Information
--------------------
Wordpress offers request... |
3,732 | <p>WordPress may have a text editor that appears to be WYSIWYG, but upon using it I discovered that it is actually WYSIWYMG- What You See Is What You <em>Might</em> Get (once it's done screwing with the HTML). </p>
<p>Isn't there a way to tell it to <strong>do nothing</strong> with the text you put into it? Just leave... | [
{
"answer_id": 3733,
"author": "Kevinleary.net",
"author_id": 1495,
"author_profile": "https://wordpress.stackexchange.com/users/1495",
"pm_score": 3,
"selected": true,
"text": "<p>After you post your content, WordPress will pass <strong>the_content()</strong> function through a number o... | 2010/11/07 | [
"https://wordpress.stackexchange.com/questions/3732",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1494/"
] | WordPress may have a text editor that appears to be WYSIWYG, but upon using it I discovered that it is actually WYSIWYMG- What You See Is What You *Might* Get (once it's done screwing with the HTML).
Isn't there a way to tell it to **do nothing** with the text you put into it? Just leave it as it is. No optimizations... | After you post your content, WordPress will pass **the\_content()** function through a number of filtering function's. There are four of them, wptexturize(), convert\_smilies(), convert\_chars(), and wpautop(). All of these are defined in wp-includes/formatting.php and are referenced in wp-includes/default-filters.php.... |
3,749 | <p>Does anyone have a suggested plugin that does the following:</p>
<p>when a user hits publish on a post for the first time, it should have a popup, notice, or alert that asks the following:</p>
<ul>
<li>Do you have a title?</li>
<li>Is the article complete?</li>
<li>Spell checked?</li>
<li>Did you pick tags?</li>
<... | [
{
"answer_id": 3751,
"author": "edelwater",
"author_id": 576,
"author_profile": "https://wordpress.stackexchange.com/users/576",
"pm_score": 0,
"selected": false,
"text": "<p>if you want to store information about the popup event... :</p>\n\n<pre><code>function while_popup() {\n // code... | 2010/11/08 | [
"https://wordpress.stackexchange.com/questions/3749",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1493/"
] | Does anyone have a suggested plugin that does the following:
when a user hits publish on a post for the first time, it should have a popup, notice, or alert that asks the following:
* Do you have a title?
* Is the article complete?
* Spell checked?
* Did you pick tags?
* Have you selected a category?
* Choose a featu... | [Create new plugin](http://codex.wordpress.org/Writing_a_Plugin) and add this as your the content:
```
<?php
/*
Plugin Name: [CR]TestDropIn
Plugin URI: http://bayu.freelancer.web.id/
Description: A barebone plugin to test whatever wordpress API you want to test
Author: Arief Bayu Purwanto
Version: 0.0.1
Author URI: ht... |
3,775 | <p>I'm converting this html menu to wordpress:</p>
<pre><code><ul>
<li><a href="/" class="current"><span>Home</span></a></li>
<li><a href="/"><span>About</span></a></li>
</ul>
</code></pre>
<p>i use:</p>
<pre><code>wp_nav_men... | [
{
"answer_id": 3776,
"author": "Devin",
"author_id": 1510,
"author_profile": "https://wordpress.stackexchange.com/users/1510",
"pm_score": 3,
"selected": false,
"text": "<pre><code>Try: <?php wp_nav_menu( array( 'container' => '' ) ); ?>\n</code></pre>\n\n<p><a href=\"http://cod... | 2010/11/08 | [
"https://wordpress.stackexchange.com/questions/3775",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1484/"
] | I'm converting this html menu to wordpress:
```
<ul>
<li><a href="/" class="current"><span>Home</span></a></li>
<li><a href="/"><span>About</span></a></li>
</ul>
```
i use:
```
wp_nav_menu(array(
'menu'=>'mainmenu' ,
'container' => false,
'link_before' => '<span>',
'link_after' => '</spa... | [SOLVED]
IT DOES NOT WORK when you are referring to an inexisting location. e.g. when you copied the code from somewhere else, or you haven't created your menu or location yet in the dasboard.
e.g. remove ", 'theme\_location' => 'primary'" from the following code:
```
wp_nav_menu( array( 'container'=> false, 'men... |
3,777 | <p><em>(<strong>Moderator's note:</strong> The original title was "Custom User Role Restrictions")</em></p>
<p>A project I am working on requires me to create two new user roles - one for the owner of the website and the other for agents of the company.</p>
<p>With the website owner user role I was just looking for a... | [
{
"answer_id": 3812,
"author": "MikeSchinkel",
"author_id": 89,
"author_profile": "https://wordpress.stackexchange.com/users/89",
"pm_score": 4,
"selected": true,
"text": "<p>Hi <strong>@NetConstructor:</strong></p>\n\n<p>I think this is what you need. Note that I didn't include the full... | 2010/11/08 | [
"https://wordpress.stackexchange.com/questions/3777",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/479/"
] | *(**Moderator's note:** The original title was "Custom User Role Restrictions")*
A project I am working on requires me to create two new user roles - one for the owner of the website and the other for agents of the company.
With the website owner user role I was just looking for a way to restrict users in this group ... | Hi **@NetConstructor:**
I think this is what you need. Note that I didn't include the full setup of your `'website_owner'` role, just the addition of a new capability called `'manage_administrators'`.
Also, I only attempted to remove the *"Delete"* link from any users that don't have the `'manage_administrators'` cap... |
3,787 | <p>I'm working on a custom plugin that needs to display specifically the commenter's nice name. The codex shows how to do this for the logged in user but not someone else. Can this easily be done?</p>
| [
{
"answer_id": 3789,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 3,
"selected": true,
"text": "<p><code>wp_get_current_commenter()</code> returns an array, the entry <code>'comment_author'</code> stores the name:</p>\n... | 2010/11/08 | [
"https://wordpress.stackexchange.com/questions/3787",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1057/"
] | I'm working on a custom plugin that needs to display specifically the commenter's nice name. The codex shows how to do this for the logged in user but not someone else. Can this easily be done? | `wp_get_current_commenter()` returns an array, the entry `'comment_author'` stores the name:
```
Array (
['comment_author'] => 'Harriet Smith,
['comment_author_email'] => 'hsmith@,example.com',
['comment_author_url'] => 'http://example.com/'
)
```
More information is available in the [codex](http... |
3,793 | <p>I've searched for answers on that, not sure I found anything.</p>
<p>I have a blog about movies, and I'm using tags for actors (i.e. brad pitt, kevin spacey).</p>
<p>I'm interested to create a dedicated "actors" page, which will include:</p>
<ul>
<li>a list of all the actors (= tags) alphabetically. So the tags l... | [
{
"answer_id": 3796,
"author": "mireille raad",
"author_id": 692,
"author_profile": "https://wordpress.stackexchange.com/users/692",
"pm_score": 2,
"selected": false,
"text": "<p>Create a file in your theme called for example : myTagsPage.php</p>\n\n<p>in it paste the following code </p>... | 2010/11/08 | [
"https://wordpress.stackexchange.com/questions/3793",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I've searched for answers on that, not sure I found anything.
I have a blog about movies, and I'm using tags for actors (i.e. brad pitt, kevin spacey).
I'm interested to create a dedicated "actors" page, which will include:
* a list of all the actors (= tags) alphabetically. So the tags list will be presented from A... | Create a file in your theme called for example : myTagsPage.php
in it paste the following code
```
<?php
/*
Template Name: myTagsPage
*/
<h2>Actors</h2>
<?php the_tags('<ul><li>','</li><li>','</li></ul>'); ?>
?>
```
then in administration, create a new blank page, on the right side, you should be able to choose wh... |
3,801 | <p>I'd like to add custom fields in my custom post type to the RSS feed for that post type located at <a href="http://example.com/feed/?post_type=my_custom_post_type">http://example.com/feed/?post_type=my_custom_post_type</a></p>
<p>I've seen info on doing this for the regular feed but nothing for how to rewrite the c... | [
{
"answer_id": 3803,
"author": "prettyboymp",
"author_id": 203,
"author_profile": "https://wordpress.stackexchange.com/users/203",
"pm_score": 5,
"selected": true,
"text": "<pre><code>function add_custom_fields_to_rss() {\n if(get_post_type() == 'my_custom_post_type' && $my_me... | 2010/11/09 | [
"https://wordpress.stackexchange.com/questions/3801",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/141/"
] | I'd like to add custom fields in my custom post type to the RSS feed for that post type located at <http://example.com/feed/?post_type=my_custom_post_type>
I've seen info on doing this for the regular feed but nothing for how to rewrite the custom post type feed.
I'll need to add 10 - 15 items to the feed (1st act, 2... | ```
function add_custom_fields_to_rss() {
if(get_post_type() == 'my_custom_post_type' && $my_meta_value = get_post_meta(get_the_ID(), 'my_meta_key', true)) {
?>
<my_meta_value><?php echo $my_meta_value ?></my_meta_value>
<?php
}
}
add_action('rss2_item', 'add_custom_fields_to_rss');
```... |
3,804 | <p>I have seen many professional wordpress themes for sale that have shortcodes built in with which you could easily make posts like this:</p>
<pre><code>[alert_box]This is an alert box which based on this short-code automatically
switches the CSS so it is easier than messing with classes every time[/alert_box]
</code... | [
{
"answer_id": 3807,
"author": "fuxia",
"author_id": 73,
"author_profile": "https://wordpress.stackexchange.com/users/73",
"pm_score": 4,
"selected": true,
"text": "<p>See the <a href=\"http://codex.wordpress.org/Shortcode_API\" rel=\"nofollow\">Shortcode API article on the Codex</a> for... | 2010/11/09 | [
"https://wordpress.stackexchange.com/questions/3804",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1516/"
] | I have seen many professional wordpress themes for sale that have shortcodes built in with which you could easily make posts like this:
```
[alert_box]This is an alert box which based on this short-code automatically
switches the CSS so it is easier than messing with classes every time[/alert_box]
```
How can I do t... | See the [Shortcode API article on the Codex](http://codex.wordpress.org/Shortcode_API) for a tutorial and my [Shortcode Plugin](https://github.com/toscho/WordPress-Shortcodes) for some examples.
A very basic example for the `functions.php`:
```
/**
* Shortcode for bloginfo()
*
* Usage: [bloginfo key="template_url"... |
3,814 | <p>I'm using Wordpress to present some software for download. The download links are provided via Custom Link entries in a side menu. I would like to enable Google Analytics tracking for these file downloads but I can't see how I can add the required javascript triggers as per the example here: <a href="http://www.goog... | [
{
"answer_id": 3815,
"author": "mireille raad",
"author_id": 692,
"author_profile": "https://wordpress.stackexchange.com/users/692",
"pm_score": 3,
"selected": false,
"text": "<p>You basically have to tag the <code><a></code> link </p>\n\n<blockquote>\n <p>Google Analytics provide... | 2010/11/09 | [
"https://wordpress.stackexchange.com/questions/3814",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I'm using Wordpress to present some software for download. The download links are provided via Custom Link entries in a side menu. I would like to enable Google Analytics tracking for these file downloads but I can't see how I can add the required javascript triggers as per the example here: <http://www.google.com/supp... | You basically have to tag the `<a>` link
>
> Google Analytics provides an easy way
> to track clicks on links that lead to
> file downloads.
>
>
> Because these links do
> not lead to a page on your site
> containing the tracking code, you'll
> need to tag the link itself with the
> \_trackPageview() JavaSc... |
3,820 | <p>Anyone know of a way to deregister custom post types?</p>
<p>Is there an equivalent to <code>register_post_type()</code>? </p>
| [
{
"answer_id": 3821,
"author": "t31os",
"author_id": 31073,
"author_profile": "https://wordpress.stackexchange.com/users/31073",
"pm_score": 5,
"selected": false,
"text": "<p>Currently there is not a function for unregistering a post type, the process however is quite simple.</p>\n\n<p>A... | 2010/11/09 | [
"https://wordpress.stackexchange.com/questions/3820",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/490/"
] | Anyone know of a way to deregister custom post types?
Is there an equivalent to `register_post_type()`? | As of WordPress 4.5 there is function to do that, [`unregister_post_type`](https://developer.wordpress.org/reference/functions/unregister_post_type/). Example:-
```
function delete_post_type(){
unregister_post_type( 'blocks' );
}
add_action('init','delete_post_type');
``` |
3,835 | <p>I have the following code in my Functions.php file to create a custom taxonomy and post type. And I have created a series of posts within this post type and attached tags to them.</p>
<pre><code>add_action( 'init', 'create_my_post_types' );
function create_my_post_types() {
register_post_type('portfolio', array(
... | [
{
"answer_id": 3839,
"author": "Cameron",
"author_id": 881,
"author_profile": "https://wordpress.stackexchange.com/users/881",
"pm_score": 2,
"selected": false,
"text": "<p>Discovered the problem. The <code>public</code> parameter was set to <code>false</code>!</p>\n"
},
{
"answe... | 2010/11/09 | [
"https://wordpress.stackexchange.com/questions/3835",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/881/"
] | I have the following code in my Functions.php file to create a custom taxonomy and post type. And I have created a series of posts within this post type and attached tags to them.
```
add_action( 'init', 'create_my_post_types' );
function create_my_post_types() {
register_post_type('portfolio', array(
'label' =>... | Discovered the problem. The `public` parameter was set to `false`! |
3,844 | <p>I have a WordPress site in a temporary location, and the site URL is an IP address followed by slash, tilde and the short site name. I also have a number of internal links in the pages that assume linking from the root - <code><a href="/services"></code> - for example. Now these links do not work in the testin... | [
{
"answer_id": 3845,
"author": "prettyboymp",
"author_id": 203,
"author_profile": "https://wordpress.stackexchange.com/users/203",
"pm_score": 2,
"selected": false,
"text": "<p>You can wrap the links in echo home_url($path) to have them printed relative to the site. So your link would b... | 2010/11/09 | [
"https://wordpress.stackexchange.com/questions/3844",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1360/"
] | I have a WordPress site in a temporary location, and the site URL is an IP address followed by slash, tilde and the short site name. I also have a number of internal links in the pages that assume linking from the root - `<a href="/services">` - for example. Now these links do not work in the testing environment becaus... | You can wrap the links in echo home\_url($path) to have them printed relative to the site. So your link would be coded as:
```
<a href="<?php echo home_url('/services')?>">
``` |
3,847 | <p>What is the variable that holds the wp.me url? / What is the webservice / call that provides me the wp.me url? / What is the workaround to read that rel tag from the dynamic generator header (on a self hosted domain).</p>
<p>... to show it beneath each post.</p>
| [
{
"answer_id": 3850,
"author": "hakre",
"author_id": 178,
"author_profile": "https://wordpress.stackexchange.com/users/178",
"pm_score": 0,
"selected": false,
"text": "<p>wp.me shortlinks are a feature of wordpress.com. The were introduced in this article: <a href=\"http://en.blog.wordpr... | 2010/11/09 | [
"https://wordpress.stackexchange.com/questions/3847",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/576/"
] | What is the variable that holds the wp.me url? / What is the webservice / call that provides me the wp.me url? / What is the workaround to read that rel tag from the dynamic generator header (on a self hosted domain).
... to show it beneath each post. | WP 3.0 includes:
```
wp_get_shortlink()
```
which returns the ?p=1 style url for any post within your domain. This can be filtered, however for other shortening services, which is what the [Wordpress.com Stats plugin](http://wordpress.org/extend/plugins/stats/) does for self-hosted blogs. With that plugin installed ... |
3,854 | <p>I have uploaded some files (images) which I'd like to link in my own site as well as other places, but usually I try to host a different resolution of the same image to show up on other sites.
My problem with wordpress right now is that if I upload the file to Wordpress' upload directory through FTP, I don't see th... | [
{
"answer_id": 3855,
"author": "prettyboymp",
"author_id": 203,
"author_profile": "https://wordpress.stackexchange.com/users/203",
"pm_score": 0,
"selected": false,
"text": "<p>WordPress has the ability to automatically resize images you upload and will keep the different resolutions in ... | 2010/11/10 | [
"https://wordpress.stackexchange.com/questions/3854",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1439/"
] | I have uploaded some files (images) which I'd like to link in my own site as well as other places, but usually I try to host a different resolution of the same image to show up on other sites.
My problem with wordpress right now is that if I upload the file to Wordpress' upload directory through FTP, I don't see the f... | >
> If I upload the file to Wordpress' upload directory through FTP, I don't see the file show up in my media (in WP-admin)
>
>
>
Try to avoid directly uploading via FTP. WordPress doesn't scan your uploads folder for new images. Instead, use the built-in media uploader within WordPress to upload images. WordPress... |
3,865 | <pre><code>$query = "CALL ..........";
$result = $wpdb->get_results($query);
print_r($results);
</code></pre>
<p>Is returning an empty array and $wpdb->query does not return anything, how do you run stored procedures from the $wpdb class?</p>
| [
{
"answer_id": 3868,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 1,
"selected": false,
"text": "<p>I am not sure about procedures, but good start will be to check if there is some reason reported for query failing.</... | 2010/11/10 | [
"https://wordpress.stackexchange.com/questions/3865",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | ```
$query = "CALL ..........";
$result = $wpdb->get_results($query);
print_r($results);
```
Is returning an empty array and $wpdb->query does not return anything, how do you run stored procedures from the $wpdb class? | wpdb detects the type of query and returns the result if it starts with select, else the affected rows. Since yours starts by call, it's probably mistaking it for an insert, update, delete, etc. statement.
Try this (might trick wpdb into thinking it's a select statement:
```
/* select */ call ...;
```
Or this (not ... |
3,875 | <p>I would like to create a new modified version of my theme (check my profile if needed) to present to visitors if I detect that they are visiting the site from a hand-held device, like iPhone, Android, etc.</p>
<ol>
<li>How to detect if the request is coming from a mobile device/browser?</li>
<li>How can I load and ... | [
{
"answer_id": 3878,
"author": "Jan Fabry",
"author_id": 8,
"author_profile": "https://wordpress.stackexchange.com/users/8",
"pm_score": 3,
"selected": false,
"text": "<p>You might want to look at how <a href=\"http://wordpress.org/extend/plugins/wptouch/\">the very popular WPtouch plugi... | 2010/11/10 | [
"https://wordpress.stackexchange.com/questions/3875",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/36/"
] | I would like to create a new modified version of my theme (check my profile if needed) to present to visitors if I detect that they are visiting the site from a hand-held device, like iPhone, Android, etc.
1. How to detect if the request is coming from a mobile device/browser?
2. How can I load and present them a dedi... | Like most others, I highly recommend using WPTouch. However, it's built more to support blogs than other website formats, so I know it's not the panacea of mobile solutions (I run my portfolio on WordPress as well as my blog, and my portfolio looks like `****` in WPTouch).
So I did take a look at the code to find the ... |
3,882 | <p>In the text editor, where you can set headings and other settings, is it possible to add your own styles for clients to use? and even remove the unnecessary ones?</p>
| [
{
"answer_id": 3884,
"author": "Jan Fabry",
"author_id": 8,
"author_profile": "https://wordpress.stackexchange.com/users/8",
"pm_score": 5,
"selected": true,
"text": "<p>The \"classic\" TinyMCE editor has two dropdowns: <code>formatselect</code> for <em>paragraph styles</em> and <code>st... | 2010/11/10 | [
"https://wordpress.stackexchange.com/questions/3882",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/784/"
] | In the text editor, where you can set headings and other settings, is it possible to add your own styles for clients to use? and even remove the unnecessary ones? | The "classic" TinyMCE editor has two dropdowns: `formatselect` for *paragraph styles* and `styleselect` for *character styles* - which can also contain paragraph styles, to make it more confusing. The configuration in WordPress by default only shows the *format* dropdown. If you apply a custom stylesheet to the editor,... |
3,900 | <p>In my functions.php, I have a need to list all images in the uploads folder which are not currently attached to a post in the WP database.</p>
<p>It appears that every time an image is uploaded to the WP uploads folder (via FTP or via Media Manager), a records gets inserted in the WP database, right?</p>
<p>How ca... | [
{
"answer_id": 3884,
"author": "Jan Fabry",
"author_id": 8,
"author_profile": "https://wordpress.stackexchange.com/users/8",
"pm_score": 5,
"selected": true,
"text": "<p>The \"classic\" TinyMCE editor has two dropdowns: <code>formatselect</code> for <em>paragraph styles</em> and <code>st... | 2010/11/10 | [
"https://wordpress.stackexchange.com/questions/3900",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/366/"
] | In my functions.php, I have a need to list all images in the uploads folder which are not currently attached to a post in the WP database.
It appears that every time an image is uploaded to the WP uploads folder (via FTP or via Media Manager), a records gets inserted in the WP database, right?
How can I obtain a list... | The "classic" TinyMCE editor has two dropdowns: `formatselect` for *paragraph styles* and `styleselect` for *character styles* - which can also contain paragraph styles, to make it more confusing. The configuration in WordPress by default only shows the *format* dropdown. If you apply a custom stylesheet to the editor,... |
3,901 | <p>I want to create a loop where 2 or 3 items from my blogroll are spliced in like this:</p>
<pre><code><loop>
<post1>
<post2>
<blogroll1>
<post3>
<blogroll3>
</loop>
</code></pre>
<p>I'll be using images and excerpts for the loop, and the goal is ... | [
{
"answer_id": 3910,
"author": "goldenapples",
"author_id": 290,
"author_profile": "https://wordpress.stackexchange.com/users/290",
"pm_score": 2,
"selected": false,
"text": "<p>I've tried something similar to that (well, slightly different, what I did was try to create a timeline where ... | 2010/11/10 | [
"https://wordpress.stackexchange.com/questions/3901",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10/"
] | I want to create a loop where 2 or 3 items from my blogroll are spliced in like this:
```
<loop>
<post1>
<post2>
<blogroll1>
<post3>
<blogroll3>
</loop>
```
I'll be using images and excerpts for the loop, and the goal is to get the `wp_links` links to display EXACTLY like the `wp_posts`, ... | Thanks to everyone. Here is the solution that I ultimately ended up with. Rather than messing around in the loop itself, I chose to hook into `the_post` with a function that recreates the markup of the loop using data from `$links`.
```
<?php
global $links;
global $links_count;
$links = get_bookmarks("limit=5");
... |
3,920 | <p>I've been trying to get a pending count to appear on the admin sidebar, for pending posts, like the little bubble that appears for pending comments:</p>
<p><img src="https://i.stack.imgur.com/XKhzj.jpg" alt="Comments pending bubble"></p>
<p><em>Offtopic</em>: Am I the only one that thinks this should be core behav... | [
{
"answer_id": 3933,
"author": "t31os",
"author_id": 31073,
"author_profile": "https://wordpress.stackexchange.com/users/31073",
"pm_score": 3,
"selected": true,
"text": "<p><strong>@ign</strong></p>\n\n<p>Replace the line of code you posted with the following..</p>\n\n<pre><code>foreach... | 2010/11/11 | [
"https://wordpress.stackexchange.com/questions/3920",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/33/"
] | I've been trying to get a pending count to appear on the admin sidebar, for pending posts, like the little bubble that appears for pending comments:

*Offtopic*: Am I the only one that thinks this should be core behaviour? Where should I suggest this feat... | **@ign**
Replace the line of code you posted with the following..
```
foreach( $menu as $menu_key => $menu_data ) :
if( 'edit.php' != $menu_data[2] )
continue;
$menu[$menu_key][0] .= " <span class='update-plugins count-$pending_count'><span class='plugin-count'>" . number_format_i18n($pending_count) .... |
3,931 | <p>My <code>category.php</code> lists articles on the first page, and on the bottom I have a pager. </p>
<p>When I click page 2, the index.php page is loaded and the url looks like this: <code>http://
www.mysite.com/some-category/page/2</code>.</p>
<p>Why isn't category.php page loaded when URL has <code>/page/2/</c... | [
{
"answer_id": 3960,
"author": "ariefbayu",
"author_id": 127,
"author_profile": "https://wordpress.stackexchange.com/users/127",
"pm_score": 1,
"selected": false,
"text": "<p>Correct me if I'm wrong.</p>\n\n<p>I guess you use that code to custom display a category.</p>\n\n<p>If that's th... | 2010/11/11 | [
"https://wordpress.stackexchange.com/questions/3931",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1447/"
] | My `category.php` lists articles on the first page, and on the bottom I have a pager.
When I click page 2, the index.php page is loaded and the url looks like this: `http://
www.mysite.com/some-category/page/2`.
Why isn't category.php page loaded when URL has `/page/2/` ?
My permalink structure looks like this: `/%... | I found he answer.
The problem was that my URL looked like this: `www.mysite.com/wp-category/`.
This was wrong.
The right way was this: `www.mysite.com/category/wp-category/`.
Now it works.
I thought that since I was using the following permalink: `/%category%/%postname%/`, did not need the extra `/category/` ... |
3,949 | <p>I currently use <code>query_posts</code> to show these custom posts but I'm pretty sure that I should uses <code>get_posts()</code> to write it correctly.</p>
<pre><code><?php query_posts( array( 'type-mario' => 'games', 'showposts' => 10 ) ); ?>
<p>Mario games</p>
<?php while ( have_post... | [
{
"answer_id": 3952,
"author": "eileencodes",
"author_id": 1352,
"author_profile": "https://wordpress.stackexchange.com/users/1352",
"pm_score": 0,
"selected": false,
"text": "<p>You can use either really, but if you want to use get_posts this is how it's done:</p>\n\n<pre><code><?php... | 2010/11/11 | [
"https://wordpress.stackexchange.com/questions/3949",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I currently use `query_posts` to show these custom posts but I'm pretty sure that I should uses `get_posts()` to write it correctly.
```
<?php query_posts( array( 'type-mario' => 'games', 'showposts' => 10 ) ); ?>
<p>Mario games</p>
<?php while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php... | Hi **Elium2009**:
Using your code, I think this is what you were looking for? (note that `WP_Query()` is just the more direct version of `get_posts()`):
```
<?php $posts = WP_Query(array(
'taxonomy' => 'type-mario'
'term' => 'games',
'posts_per_page' => 10
)); ?>
<p>Mario games</p>
<?php while ( $posts->ha... |
3,954 | <p>I've created a custom post type, and have successfully added a few entries. I can call these entries out with <code>query_posts()</code> to show on the front page, but <code>the_permalink()</code> on each of them just sends me to a "Page not found" 404.</p>
<p>Am I missing something? I'm currently running on <code>... | [
{
"answer_id": 3955,
"author": "hakre",
"author_id": 178,
"author_profile": "https://wordpress.stackexchange.com/users/178",
"pm_score": 3,
"selected": false,
"text": "<p>After registering the custom post types you need to rebuild permalinks. You can do that manually by visiting Admin ->... | 2010/11/11 | [
"https://wordpress.stackexchange.com/questions/3954",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/92/"
] | I've created a custom post type, and have successfully added a few entries. I can call these entries out with `query_posts()` to show on the front page, but `the_permalink()` on each of them just sends me to a "Page not found" 404.
Am I missing something? I'm currently running on `http://localhost`, so the results of ... | Did you go to Admin -> Settings -> Permalinks after setting up the post type? The permalink structure hasn't been added until you've done that. It could be the cause of your problem.
The permalinks page fires `$wp_rewrite->flush_rules();` each time the page is visited, so it's not even necessary to save. |
3,982 | <pre><code><?php query_posts(array('showposts' => 1000, 'post_parent' => $post->ID, 'post_type' => 'page', 'orderby' => 'title', 'order' => 'ASC', 'meta_key' => featured_product, 'meta_value' => 1)); ?>
<?php query_posts(array('showposts' => 1000, 'post_parent' => $post->ID, ... | [
{
"answer_id": 3984,
"author": "eileencodes",
"author_id": 1352,
"author_profile": "https://wordpress.stackexchange.com/users/1352",
"pm_score": 1,
"selected": false,
"text": "<p>I haven't tried this, but some research let me to this. Using meta_compare you can check if meta_value does n... | 2010/11/12 | [
"https://wordpress.stackexchange.com/questions/3982",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | ```
<?php query_posts(array('showposts' => 1000, 'post_parent' => $post->ID, 'post_type' => 'page', 'orderby' => 'title', 'order' => 'ASC', 'meta_key' => featured_product, 'meta_value' => 1)); ?>
<?php query_posts(array('showposts' => 1000, 'post_parent' => $post->ID, 'post_type' => 'page', 'orderby' => 'title', 'orde... | I've never had any luck getting the meta compare to work either--but I came up with a workaround for this exact situation (having "featured" items at the top of the page).
First, you probably shouldn't be using query\_posts for both queries. You should use a custom query for at least the first one. Then, while you're ... |
4,006 | <p>Is there any way to measure the time it takes for plugins to load and in which pages they load (without figuring out the entire code)?
In addition, I would like to find out which plugins load files in which pages and find the ones that load on irrelevant ones.</p>
| [
{
"answer_id": 4007,
"author": "Denis de Bernardy",
"author_id": 1208,
"author_profile": "https://wordpress.stackexchange.com/users/1208",
"pm_score": 1,
"selected": false,
"text": "<p>You could always concatenate them all into a new plugin and activate that instead, but you're honestly ... | 2010/11/13 | [
"https://wordpress.stackexchange.com/questions/4006",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1567/"
] | Is there any way to measure the time it takes for plugins to load and in which pages they load (without figuring out the entire code)?
In addition, I would like to find out which plugins load files in which pages and find the ones that load on irrelevant ones. | Yes, Plugins effect site loading time.
--------------------------------------
There are many poorly written Plugins that make unnecessary database queries and load numerous files to the page.
The extra JavaScript and CSS files are not that big of deal unless you are using numerous plugins. I have worked on large site... |
4,016 | <p>I'm creating a custom post type, "gallery", in which the admin should be able to upload images (these images would be attached to the post).</p>
<p>The thing is that the "editor" meta box is disabled for this post type. And I need a way to add the image upload pop-up box to it, just like posts have. How can I do th... | [
{
"answer_id": 4017,
"author": "Jan Fabry",
"author_id": 8,
"author_profile": "https://wordpress.stackexchange.com/users/8",
"pm_score": 4,
"selected": true,
"text": "<p><a href=\"http://core.trac.wordpress.org/browser/branches/3.0/wp-admin/edit-form-advanced.php#L21\" rel=\"nofollow\">A... | 2010/11/13 | [
"https://wordpress.stackexchange.com/questions/4016",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/600/"
] | I'm creating a custom post type, "gallery", in which the admin should be able to upload images (these images would be attached to the post).
The thing is that the "editor" meta box is disabled for this post type. And I need a way to add the image upload pop-up box to it, just like posts have. How can I do that?
or ma... | [At the top of `wp-admin/edit-form-advanced.php`](http://core.trac.wordpress.org/browser/branches/3.0/wp-admin/edit-form-advanced.php#L21) I see the following code that seems related to the media uploader:
```
if ( post_type_supports($post_type, 'editor') || post_type_supports($post_type, 'thumbnail') ) {
add_thic... |
4,028 | <p>The user profile page has the following fields:</p>
<p>Username<br>
First Name<br>
Last Name<br>
Nickname
Display name
Contact Info
E-mail
Website
AIM
Yahoo IM<br>
Jabber / Google Talk</p>
<p>How can more fields be added to this section. Field such as Phone number, address, or anything else.</p>
| [
{
"answer_id": 4029,
"author": "MikeSchinkel",
"author_id": 89,
"author_profile": "https://wordpress.stackexchange.com/users/89",
"pm_score": 6,
"selected": true,
"text": "<p>You need to use the <code>'show_user_profile'</code>, <code>'edit_user_profile'</code>, <code>'personal_options_u... | 2010/11/14 | [
"https://wordpress.stackexchange.com/questions/4028",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/353/"
] | The user profile page has the following fields:
Username
First Name
Last Name
Nickname
Display name
Contact Info
E-mail
Website
AIM
Yahoo IM
Jabber / Google Talk
How can more fields be added to this section. Field such as Phone number, address, or anything else. | You need to use the `'show_user_profile'`, `'edit_user_profile'`, `'personal_options_update'` and `'edit_user_profile_update'` hooks.
Here's some **code to add a Phone number**:
```
add_action( 'show_user_profile', 'yoursite_extra_user_profile_fields' );
add_action( 'edit_user_profile', 'yoursite_extra_user_profile_... |
4,037 | <p>Is there any simple way to have wordpress, php or apache rewrite all urls which involve <code>/wp-admin</code> to <code>/admin</code>?</p>
<p>I have added this entry to my .htaccess file:</p>
<pre><code>RewriteRule ^admin /wp-login.php [L]
</code></pre>
<p>However although <code>domain.com/admin</code> will corre... | [
{
"answer_id": 4063,
"author": "hakre",
"author_id": 178,
"author_profile": "https://wordpress.stackexchange.com/users/178",
"pm_score": 4,
"selected": true,
"text": "<p>To answer you question as a apache URL layout configuration via <a href=\"http://httpd.apache.org/docs/1.3/mod/mod_rew... | 2010/11/14 | [
"https://wordpress.stackexchange.com/questions/4037",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/479/"
] | Is there any simple way to have wordpress, php or apache rewrite all urls which involve `/wp-admin` to `/admin`?
I have added this entry to my .htaccess file:
```
RewriteRule ^admin /wp-login.php [L]
```
However although `domain.com/admin` will correctly show the login page all pages after you login show the URL as... | To answer you question as a apache URL layout configuration via [mod\_rewrite](http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html) (the apache module that handles URL rewriting), this could be helpful:
```
RewriteRule ^admin/(.*)$ /wp-admin/$1 [QSA,L]
```
(untested configuration directive, check the docs in case ... |