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 |
|---|---|---|---|---|---|---|
26,254 | <p>I have a plugin which calls a stand-alone php script (<code>myAjax.php</code>) via a <code>jQuery.ajax()</code> script inside the plugin.</p>
<p>I need to place the following code into the <code>myAjax.php</code> file:</p>
<pre><code>require_once('../../../wp-load.php');
if (!is_user_logged_in()){
die("You... | [
{
"answer_id": 190392,
"author": "Ilia Andrienko",
"author_id": 74116,
"author_profile": "https://wordpress.stackexchange.com/users/74116",
"pm_score": 4,
"selected": false,
"text": "<p>You can use <code>__DIR__</code> constant. Since the file is either inside plugin or theme folder, whi... | 2011/08/18 | [
"https://wordpress.stackexchange.com/questions/26254",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6620/"
] | I have a plugin which calls a stand-alone php script (`myAjax.php`) via a `jQuery.ajax()` script inside the plugin.
I need to place the following code into the `myAjax.php` file:
```
require_once('../../../wp-load.php');
if (!is_user_logged_in()){
die("You Must Be Logged In to Access This");
}
if( ! current_user... | You can use `__DIR__` constant. Since the file is either inside plugin or theme folder, which are always located inside `wp-content` folder.. You can simply get the path of the file and trim everything starting from `wp-content` from it:
```php
$path = preg_replace( '/wp-content.*$/', '', __DIR__ );
```
If you need ... |
26,262 | <p>There is a function in a theme that I am using that does some pagination stuff. I do NOT want that function to show up on my home page (only), so I'm trying to set up an if/else statement but can't for the life of me can't get it to work right. Using the following code, the function shows up not only on the homepa... | [
{
"answer_id": 26264,
"author": "Jeremy Love",
"author_id": 2635,
"author_profile": "https://wordpress.stackexchange.com/users/2635",
"pm_score": 0,
"selected": false,
"text": "<p>i think you need <code><?php if (is_home()) { ?></code> this worked for me i dont think is_front_page ... | 2011/08/18 | [
"https://wordpress.stackexchange.com/questions/26262",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1663/"
] | There is a function in a theme that I am using that does some pagination stuff. I do NOT want that function to show up on my home page (only), so I'm trying to set up an if/else statement but can't for the life of me can't get it to work right. Using the following code, the function shows up not only on the homepage bu... | Based on your pastes, i think what you're going for is..
```
function cp_do_pagination() {
if( is_home() || is_singular() /* || is_front_page() */ )
return;
global $post; // <-- do you need this for something in particular?
if( !function_exists('appthemes_pagination') )
return;
a... |
26,263 | <p>I'm building a portfolio site for a friend and he's got three seperate photo packages and may want to add more in the future, so I've created a custom post type called Packages so that he can add as many as he likes and they'd all appear on one page. I've created a single-packages.php template so that each package w... | [
{
"answer_id": 26290,
"author": "Wordpressor",
"author_id": 1869,
"author_profile": "https://wordpress.stackexchange.com/users/1869",
"pm_score": 0,
"selected": false,
"text": "<p>I've had the same problem and found this to be the best solution:</p>\n\n<pre><code><?php\n $content = ... | 2011/08/18 | [
"https://wordpress.stackexchange.com/questions/26263",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8007/"
] | I'm building a portfolio site for a friend and he's got three seperate photo packages and may want to add more in the future, so I've created a custom post type called Packages so that he can add as many as he likes and they'd all appear on one page. I've created a single-packages.php template so that each package woul... | In some situations, the $more global needs to be set to 0 before calling the\_content() in order to show the read more link:
```
global $more;
$more = 0;
the_content( '<span>Read More...</span>' );
``` |
26,293 | <p>I'm adding additional image sizes to my theme:</p>
<p><strong>functions.php</strong></p>
<pre><code>add_image_size( 'my-thumbnails', 122, 122, true );
</code></pre>
<p>I used to get thumbnails URL like this:</p>
<pre><code>wp_get_attachment_url(get_post_thumbnail_id($post->ID));
</code></pre>
<p>And it wo... | [
{
"answer_id": 26294,
"author": "eveevans",
"author_id": 7602,
"author_profile": "https://wordpress.stackexchange.com/users/7602",
"pm_score": 0,
"selected": false,
"text": "<p>make your own function in function.php for display your images, then call it and put the size on the parameters... | 2011/08/18 | [
"https://wordpress.stackexchange.com/questions/26293",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1869/"
] | I'm adding additional image sizes to my theme:
**functions.php**
```
add_image_size( 'my-thumbnails', 122, 122, true );
```
I used to get thumbnails URL like this:
```
wp_get_attachment_url(get_post_thumbnail_id($post->ID));
```
And it works like a charm, but I'm not sure how to display 'my-thumbnails' versio... | You should use one of the following:
```
// Thumbnail
wp_get_attachment_thumb_file( $GLOBALS['post']->ID );
// Custom
wp_get_attachment_image_src( $attachment_id, $size='my-thumbnails' );
// Or:
wp_get_attachment_image( $attachment_id, $size='my-thumbnails' );
``` |
26,310 | <p><strong>Scenario:</strong>
Page displays a list of titles for a custom post type (video) with a selected "category" (in the taxonomy its called the subject). For example videos with the subject of "creative"</p>
<p><strong>Problem</strong>
If there are titles present that match the the criteria then the list is dis... | [
{
"answer_id": 26311,
"author": "Sisir",
"author_id": 3094,
"author_profile": "https://wordpress.stackexchange.com/users/3094",
"pm_score": 3,
"selected": true,
"text": "<p>Try <code>$loop->have_posts()</code> on if statement. See if it fixes the issue.</p>\n"
},
{
"answer_id"... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26310",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2865/"
] | **Scenario:**
Page displays a list of titles for a custom post type (video) with a selected "category" (in the taxonomy its called the subject). For example videos with the subject of "creative"
**Problem**
If there are titles present that match the the criteria then the list is displayed correctly but if there are no... | Try `$loop->have_posts()` on if statement. See if it fixes the issue. |
26,315 | <p>I had asked this question in a different way too, but no one replied there! I guess I should rephrase it here.<br>
My custom post is 'company'.
I'm trying to add a custom rewrite rule. When the 'url <a href="http://domain..com/company/company-title-slug/replies" rel="nofollow">http://domain..com/company/company-titl... | [
{
"answer_id": 26400,
"author": "Devin Humbert",
"author_id": 7949,
"author_profile": "https://wordpress.stackexchange.com/users/7949",
"pm_score": 2,
"selected": true,
"text": "<p>I haven't tested it, but what about:</p>\n\n<pre><code>add_rewrite_rule('^company/(.+)/replies/(.*)?$','ind... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26315",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4740/"
] | I had asked this question in a different way too, but no one replied there! I guess I should rephrase it here.
My custom post is 'company'.
I'm trying to add a custom rewrite rule. When the 'url <http://domain..com/company/company-title-slug/replies>', is accessed, I want redirect to a custom template(applied to a p... | I haven't tested it, but what about:
```
add_rewrite_rule('^company/(.+)/replies/(.*)?$','index.php?pagename=replies&reply_id=$matches[2]','top');
``` |
26,335 | <p>very strange problem, that happens only in one specific template. part of the part "leaks" into the tag - and I can't figure out why.</p>
<p>the "header.php" code:</p>
<pre><code><!DOCTYPE html>
<html lang="he">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" c... | [
{
"answer_id": 26333,
"author": "paulo",
"author_id": 8032,
"author_profile": "https://wordpress.stackexchange.com/users/8032",
"pm_score": 0,
"selected": false,
"text": "<p>May be this plugin could help you:</p>\n\n<p><a href=\"http://en.bainternet.info/2011/posts-creation-limits\" rel=... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26335",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6129/"
] | very strange problem, that happens only in one specific template. part of the part "leaks" into the tag - and I can't figure out why.
the "header.php" code:
```
<!DOCTYPE html>
<html lang="he">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IT=edge,chrome=IE8">
<title><?php blogin... | I would suggest creating a Theme Options page for this purpose.
<https://wordpress.stackexchange.com/questions/tagged/theme-options>
[add\_options\_page()](http://codex.wordpress.org/Function_Reference/add_options_page) in Codex.
Or is there anything special in the post edit screen that you want to use that would b... |
26,342 | <p>I have a very specific use case where the site built for a lawyer and each of his clients can login to their own 'specific page/portal' (custom post type) without the ability to access wp-admin etc. (I created all the login/register/profile-editing pages in the front end). In this page/portal the lawyer will leave m... | [
{
"answer_id": 57858,
"author": "amit",
"author_id": 17968,
"author_profile": "https://wordpress.stackexchange.com/users/17968",
"pm_score": 1,
"selected": false,
"text": "<p>Probably, you might have known this trick, This code will check for current logged in user's username and if it m... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26342",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/20/"
] | I have a very specific use case where the site built for a lawyer and each of his clients can login to their own 'specific page/portal' (custom post type) without the ability to access wp-admin etc. (I created all the login/register/profile-editing pages in the front end). In this page/portal the lawyer will leave mess... | What needs to happen is that you need to proxy download requests for the file types you want through WordPress. Let's assume you're going to restrict access to ".doc" files.
1. Define a query variable that indicates the requested file
============================================================
```
function add_get_f... |
26,346 | <p>Sorry I'm new to taxonomies & trying to learn quickly.</p>
<p>I've set up sectors and assigned a post to it. If I go to the post, I can see the URL has
www.mydomain.com/sectors/auto/</p>
<p>How can I get auto from the URL?
Thanks</p>
| [
{
"answer_id": 26349,
"author": "Michal Mau",
"author_id": 2110,
"author_profile": "https://wordpress.stackexchange.com/users/2110",
"pm_score": 3,
"selected": false,
"text": "<p>Try this:</p>\n\n<pre><code>$sector = get_queried_object()->name;\n</code></pre>\n"
},
{
"answer_i... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26346",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8006/"
] | Sorry I'm new to taxonomies & trying to learn quickly.
I've set up sectors and assigned a post to it. If I go to the post, I can see the URL has
www.mydomain.com/sectors/auto/
How can I get auto from the URL?
Thanks | I think you are looking for [`get_query_var`](http://codex.wordpress.org/Function_Reference/get_query_var)
```
$term_slug = get_query_var( 'term' );
$taxonomyName = get_query_var( 'taxonomy' );
$current_term = get_term_by( 'slug', $term_slug, $taxonomyName );
``` |
26,350 | <p>WordPress automatically embeds a youtube video's if I use:</p>
<pre><code>[embed] http://www.youtube.com/watch?v=Xog1T5dUxcw [/embed ]
</code></pre>
<p>This is great, but it doesn't work if I use it in a template file. I have a custom field where the admin can put a URL to a YouTube video. I want to get the video ... | [
{
"answer_id": 26353,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 3,
"selected": false,
"text": "<p>Normally you have to use <a href=\"http://codex.wordpress.org/Function_Reference/do_shortcode\">do_shortcode</a> in... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26350",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8015/"
] | WordPress automatically embeds a youtube video's if I use:
```
[embed] http://www.youtube.com/watch?v=Xog1T5dUxcw [/embed ]
```
This is great, but it doesn't work if I use it in a template file. I have a custom field where the admin can put a URL to a YouTube video. I want to get the video in the single-post using t... | Use `wp_oembed_get( $url )` instead. Make sure you `echo` it in your template file. So, something like this:
```
<?php
// tot necessary to set this but good if $url is coming from a function
$url = 'https://www.youtube.com/watch?v=jofNR_WkoCE';
// echo the function in your template to render the video
echo wp_oembed_... |
26,354 | <p>I am building a custom wordpress theme from a clients mockup. On the homepage there are 2 sliders, and 4-5 areas for recent posts of different types. I would like to have all the content be editable in wordpress what is the best way to create a post, apply some sortof value to it (category,taxonomy,tag,custom post t... | [
{
"answer_id": 26356,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 3,
"selected": true,
"text": "<p>You can use <a href=\"http://codex.wordpress.org/Class_Reference/WP_Query\" rel=\"nofollow\">WP_Query</a> in your te... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26354",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8039/"
] | I am building a custom wordpress theme from a clients mockup. On the homepage there are 2 sliders, and 4-5 areas for recent posts of different types. I would like to have all the content be editable in wordpress what is the best way to create a post, apply some sortof value to it (category,taxonomy,tag,custom post type... | You can use [WP\_Query](http://codex.wordpress.org/Class_Reference/WP_Query) in your template to select groups of posts by type, category, tag, custom taxonomy, meta field, etc., and create additional loops:
```
<?php
$news = new WP_Query("post_type=mynews&posts_per_page=1");
while($news->have_posts()) : $news->the... |
26,362 | <p>I want to create a WordPress plugin that allows me to do A/B testing for WordPress standard posts, but I can't use the Shrimptest plugin because I need a spin: Since I'm ultimately testing shareability on social networks, I want each of my variant posts to have unique URLs. </p>
<p><strong>So: How can I create thre... | [
{
"answer_id": 26365,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 1,
"selected": false,
"text": "<p>Already available: <a href=\"http://shrimptest.com/\" rel=\"nofollow\">Shrimptest</a></p>\n"
},
{
"answer_i... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26362",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7607/"
] | I want to create a WordPress plugin that allows me to do A/B testing for WordPress standard posts, but I can't use the Shrimptest plugin because I need a spin: Since I'm ultimately testing shareability on social networks, I want each of my variant posts to have unique URLs.
**So: How can I create three posts (each wi... | You can use ShrimpTest for this. Basically, you need to reverse the test idea. You're making three separate posts, one of which will be displayed on the front page. That means that two others will *not* be displayed on the front page. So you're doing an exclusion.
Say your three posts have id's of 101, 102, and 103. Y... |
26,367 | <p>So I'm basically upgrading an older site and I need to make it multisite as well for some blogs and such. </p>
<p>I'd like to have the main site Menu(created from the admin) available on the other sites in an elegant way. That is, every site has a theme and it would be nice if I could just wp_nav_menu() on every on... | [
{
"answer_id": 26375,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 2,
"selected": false,
"text": "<p>I'd say: Write a short plugin that offers a simple function to output a menu. Then activate it network wide.</p>\n"... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26367",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8045/"
] | So I'm basically upgrading an older site and I need to make it multisite as well for some blogs and such.
I'd like to have the main site Menu(created from the admin) available on the other sites in an elegant way. That is, every site has a theme and it would be nice if I could just wp\_nav\_menu() on every one.
Any ... | This is what I've used recently. It's very simple but it works well for me.
```
function wp_multisite_nav_menu( $args = array(), $origin_id = 1 ) {
global $blog_id;
$origin_id = absint( $origin_id );
if ( !is_multisite() || $origin_id == $blog_id ) {
wp_nav_menu( $args );
... |
26,372 | <p>i have a site made up of pages and posts. there are only a few pages and a ton of posts. how can i set the search box in my sidebars to search pages only if on a page, or search posts only if on my blog page? right now it mixes everything together on my search page.</p>
<p>it would be even cooler if there was a way... | [
{
"answer_id": 26373,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 0,
"selected": false,
"text": "<p>Conditional tags: <code>is_page()</code> or <code>is_archive()</code>. There's also <code>is_singular()</code>, but... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26372",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7914/"
] | i have a site made up of pages and posts. there are only a few pages and a ton of posts. how can i set the search box in my sidebars to search pages only if on a page, or search posts only if on my blog page? right now it mixes everything together on my search page.
it would be even cooler if there was a way to add ch... | You can append post\_type to the end of your search string like this:
```
http://yourdomain.com/?s=search+string&post_type=page
```
This works like a charm:
```
<form method="get" action="<?php echo home_url();?>">
<input type="text" name="s" />
<label>Search Pages</label>
<input type="radio" name="post... |
26,377 | <p>I'm doing an INSERT into a wordpress table and anything with an apostrophe is coming out </p>
<pre><code>It\'s true
</code></pre>
<p>I tried using htmlspecialchars but I'm still getting the backslash.</p>
<p>Is there any way to write it so that the user sees </p>
<pre><code>It's true
</code></pre>
<p>While the ... | [
{
"answer_id": 26379,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 0,
"selected": false,
"text": "<p>How are you writing and reading data exactly?</p>\n\n<p>Are you using <a href=\"http://codex.wordpress.org/Class_Ref... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26377",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2417/"
] | I'm doing an INSERT into a wordpress table and anything with an apostrophe is coming out
```
It\'s true
```
I tried using htmlspecialchars but I'm still getting the backslash.
Is there any way to write it so that the user sees
```
It's true
```
While the table in the database sees:
```
It\'s true
```
Below ... | When you retrieve the data make sure to call stripslashes, or stripslashes\_deep if it's an array.
```
$name = stripslashes($name);
``` |
26,382 | <p>I currently have this in my functions file, which works as expected:</p>
<pre><code>// Enable Post Thumbnails
add_theme_support('post-thumbnails');
// Custom Thumbnail Sizes
add_image_size( 'square-small-thumb', 80, 80 );
add_image_size( 'square-medium-thumb', 150, 150 );
// Guide image sizes
add_image_size( 'guide... | [
{
"answer_id": 31253,
"author": "andresmijares",
"author_id": 4907,
"author_profile": "https://wordpress.stackexchange.com/users/4907",
"pm_score": 1,
"selected": false,
"text": "<p>I had this issue before, and <a href=\"https://wordpress.stackexchange.com/questions/1463/resizing-images-... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26382",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7002/"
] | I currently have this in my functions file, which works as expected:
```
// Enable Post Thumbnails
add_theme_support('post-thumbnails');
// Custom Thumbnail Sizes
add_image_size( 'square-small-thumb', 80, 80 );
add_image_size( 'square-medium-thumb', 150, 150 );
// Guide image sizes
add_image_size( 'guide-gallerythumb'... | I had this issue before, and [this answer by Jan Fabry](https://wordpress.stackexchange.com/questions/1463/resizing-images-to-the-actual-size-used-in-the-editor/4012#4012) was of use, hope it works for u guy! |
26,384 | <p>I've tried everything. I've looked at every. single. question. here, on StackOverflow, the WP help forum, googled 10 pages deep and literally tried EVERY combination of code I could find, for the last 2 days, and can't get anything to work how I want it. Surely it can't be impossible? The goal seems so simple!</p... | [
{
"answer_id": 31253,
"author": "andresmijares",
"author_id": 4907,
"author_profile": "https://wordpress.stackexchange.com/users/4907",
"pm_score": 1,
"selected": false,
"text": "<p>I had this issue before, and <a href=\"https://wordpress.stackexchange.com/questions/1463/resizing-images-... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26384",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1663/"
] | I've tried everything. I've looked at every. single. question. here, on StackOverflow, the WP help forum, googled 10 pages deep and literally tried EVERY combination of code I could find, for the last 2 days, and can't get anything to work how I want it. Surely it can't be impossible? The goal seems so simple!
**THE G... | I had this issue before, and [this answer by Jan Fabry](https://wordpress.stackexchange.com/questions/1463/resizing-images-to-the-actual-size-used-in-the-editor/4012#4012) was of use, hope it works for u guy! |
26,385 | <p>I'm looking to advise a user that they should change their password from the default generated one that was emailed to them.</p>
<p>Is there a function or hook that will tell me if the user is running the default password?</p>
| [
{
"answer_id": 26390,
"author": "goldenapples",
"author_id": 290,
"author_profile": "https://wordpress.stackexchange.com/users/290",
"pm_score": 0,
"selected": false,
"text": "<p>The question is, how are you setting the default passwords? </p>\n\n<p>That said, I think it would be perfect... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26385",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3296/"
] | I'm looking to advise a user that they should change their password from the default generated one that was emailed to them.
Is there a function or hook that will tell me if the user is running the default password? | The following will tell you if the user has updated the password generated by WP on registration for a user with ID `$user_id`:
```
if ( ! get_user_option('default_password_nag', $user_id) ) {
//then the user has changed the default password
} else {
//the default password has not been changed
}
```
If you w... |
26,388 | <p>I have a very peculiar requirement, but hopefully I can explain it without being too confusing. I created a page template where I list some properties I get from an external XML file. So far no problems, and let's say the URL is like this:</p>
<pre><code>http://www.example.com/properties/
</code></pre>
<p>Each prope... | [
{
"answer_id": 26394,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 7,
"selected": true,
"text": "<p>Add this to your theme's functions.php, or <a href=\"http://codex.wordpress.org/Writing_a_Plugin\">put it in a plugi... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26388",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3893/"
] | I have a very peculiar requirement, but hopefully I can explain it without being too confusing. I created a page template where I list some properties I get from an external XML file. So far no problems, and let's say the URL is like this:
```
http://www.example.com/properties/
```
Each property has a link that shou... | Add this to your theme's functions.php, or [put it in a plugin](http://codex.wordpress.org/Writing_a_Plugin).
```
add_action( 'init', 'wpse26388_rewrites_init' );
function wpse26388_rewrites_init(){
add_rewrite_rule(
'properties/([0-9]+)/?$',
'index.php?pagename=properties&property_id=$matches[1]',... |
26,389 | <p>I have a custom post type called "Country Story". The title of which will be the name of the country. I want Wordpress to automatically create a new taxonomy called "country" of the same name, i.e. a Country Story called Thailand is created, so I want WP to create a Country taxonomy called Thailand as well. The Coun... | [
{
"answer_id": 26397,
"author": "Devin Humbert",
"author_id": 7949,
"author_profile": "https://wordpress.stackexchange.com/users/7949",
"pm_score": 2,
"selected": false,
"text": "<p>Can you not just call get_the_title() to get the title of the Country Story?</p>\n\n<pre><code>$cat = get_... | 2011/08/19 | [
"https://wordpress.stackexchange.com/questions/26389",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12019/"
] | I have a custom post type called "Country Story". The title of which will be the name of the country. I want Wordpress to automatically create a new taxonomy called "country" of the same name, i.e. a Country Story called Thailand is created, so I want WP to create a Country taxonomy called Thailand as well. The Country... | Can you not just call get\_the\_title() to get the title of the Country Story?
```
$cat = get_the_title($post_ID);
``` |
26,420 | <p>Is there a quick way to add a list of countries as terms to a custom taxonomy called "Country"?</p>
<p>Is there an existing import file, SQL script ect...</p>
<p>I don't want to be there all day manually adding them.</p>
<p>Any ideas would be great.</p>
| [
{
"answer_id": 26421,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 1,
"selected": false,
"text": "<p>You can make your own script to import them using <a href=\"http://codex.wordpress.org/Function_Reference/wp_insert... | 2011/08/20 | [
"https://wordpress.stackexchange.com/questions/26420",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8063/"
] | Is there a quick way to add a list of countries as terms to a custom taxonomy called "Country"?
Is there an existing import file, SQL script ect...
I don't want to be there all day manually adding them.
Any ideas would be great. | Try this. Note that I found this country array online and cannot vouch for it's accuracy. Also, I've set the taxonomy to the "country" taxonomy. Change all instances of that if it does not match your specific taxonomy name. You can add this to your functions.php file in your current theme. Reload WordPress and it shoul... |
26,445 | <p>Why is <a href="http://compassionpit.com/blog/" rel="nofollow">http://compassionpit.com/blog/</a> going through an infinite redirect loop? Here's my nginx conf file. The site is run by a nodejs server on port 8000 and Apache serves up the blog (wordpress) and the forum (phpBB). The forum is resolving just fine, at <... | [
{
"answer_id": 26475,
"author": "EAMann",
"author_id": 46,
"author_profile": "https://wordpress.stackexchange.com/users/46",
"pm_score": 3,
"selected": true,
"text": "<p>Is WordPress configured to use www or without www? Your server seems to be listening only for the <code>www</code> ve... | 2011/08/21 | [
"https://wordpress.stackexchange.com/questions/26445",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2207/"
] | Why is <http://compassionpit.com/blog/> going through an infinite redirect loop? Here's my nginx conf file. The site is run by a nodejs server on port 8000 and Apache serves up the blog (wordpress) and the forum (phpBB). The forum is resolving just fine, at <http://www.compassionpit.com/forum/> ...
>
> This webpage h... | Is WordPress configured to use www or without www? Your server seems to be listening only for the `www` version and tries to redirect non-`www` requests to the `www` version.
Considering that you provided a link to the non-`www` version of the domain above, my guess is that WordPress is trying to hook on to `http://co... |
26,452 | <p>I'm working on a new blog which display in a list, on sidebar, some categories and the posts of them.
In the index page, in main content, I list some post titles from other category "New".</p>
<p>What I need is: when i click on one post link on sidebar to display in main content the post content via ajax or JQuery... | [
{
"answer_id": 26458,
"author": "Steven",
"author_id": 1447,
"author_profile": "https://wordpress.stackexchange.com/users/1447",
"pm_score": 0,
"selected": false,
"text": "<p>Just use something like this:</p>\n\n<pre><code>if (is_home) {\n // This retrieves 5 psots with the category \"so... | 2011/08/21 | [
"https://wordpress.stackexchange.com/questions/26452",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8073/"
] | I'm working on a new blog which display in a list, on sidebar, some categories and the posts of them.
In the index page, in main content, I list some post titles from other category "New".
What I need is: when i click on one post link on sidebar to display in main content the post content via ajax or JQuery. | You will need to create a WordPress function that loads the post content and hook that into wp\_ajax\_nopriv. You will also need the jQuery ajax functions to send the $\_POST data to your WordPress function via ajax and output the returned content in your empty div where you want it to display.
A simple approach would... |
26,468 | <p>I'm working on a plugin that <em>was</em> creating a table successfully. </p>
<p>However, I decided to test it in a fresh install of Wordpress (on my local server) and now the table is not being created in my activation code. Instead I am getting the error message:</p>
<blockquote>
<p>The plugin generated 149 ch... | [
{
"answer_id": 26471,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 3,
"selected": true,
"text": "<pre><code>if( $installed_ver != $simple_location_version ) {\n</code></pre>\n\n<p>on first run, <code>$installed_ver</... | 2011/08/21 | [
"https://wordpress.stackexchange.com/questions/26468",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2417/"
] | I'm working on a plugin that *was* creating a table successfully.
However, I decided to test it in a fresh install of Wordpress (on my local server) and now the table is not being created in my activation code. Instead I am getting the error message:
>
> The plugin generated 149 characters of unexpected output duri... | ```
if( $installed_ver != $simple_location_version ) {
```
on first run, `$installed_ver` is an empty string and `$simple_location_version` is NULL, so this inequality test will fail and your SQL will never be executed.
if you check for strict inequality, it will work:
```
if( $installed_ver !== $simple_location_ve... |
26,482 | <p>I have a custom post type <code>announcements</code> which obviously holds posts with weekly announcements.</p>
<p>In my theme's header, I want to create a box which has the following semantics:</p>
<pre><code><div id="header-announcements">
<h3>Announcements</h3>
<ul>
... | [
{
"answer_id": 26483,
"author": "eaguilar",
"author_id": 8078,
"author_profile": "https://wordpress.stackexchange.com/users/8078",
"pm_score": -1,
"selected": false,
"text": "<p>You will need to use a foreach loop since you this query give an array of objects, inside this loop you can us... | 2011/08/21 | [
"https://wordpress.stackexchange.com/questions/26482",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7457/"
] | I have a custom post type `announcements` which obviously holds posts with weekly announcements.
In my theme's header, I want to create a box which has the following semantics:
```
<div id="header-announcements">
<h3>Announcements</h3>
<ul>
<li><a href="post-permalink">Title</a></li>
... | The following should work, but isn't tested:
```
<div id="header-announcements">
<h3>Announcements</h3>
<?php
$queryObject = new WP_Query( 'post_type=announcements&posts_per_page=5' );
// The Loop!
if ($queryObject->have_posts()) {
?>
<ul>
<?php
while ($queryObject->have_posts()) {
$queryObject... |
26,489 | <p>I'm trying to use wp_insert_post to create a front-end submission form so visitors can create a post AND update the meta box fields of that post -- <strong>not the custom fields</strong>.</p>
<p>For example, when I use the following in the submission form...</p>
<pre><code><?php update_post_meta($post_id, $meta... | [
{
"answer_id": 26483,
"author": "eaguilar",
"author_id": 8078,
"author_profile": "https://wordpress.stackexchange.com/users/8078",
"pm_score": -1,
"selected": false,
"text": "<p>You will need to use a foreach loop since you this query give an array of objects, inside this loop you can us... | 2011/08/21 | [
"https://wordpress.stackexchange.com/questions/26489",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8084/"
] | I'm trying to use wp\_insert\_post to create a front-end submission form so visitors can create a post AND update the meta box fields of that post -- **not the custom fields**.
For example, when I use the following in the submission form...
```
<?php update_post_meta($post_id, $meta_key, $meta_value); ?>
```
...it ... | The following should work, but isn't tested:
```
<div id="header-announcements">
<h3>Announcements</h3>
<?php
$queryObject = new WP_Query( 'post_type=announcements&posts_per_page=5' );
// The Loop!
if ($queryObject->have_posts()) {
?>
<ul>
<?php
while ($queryObject->have_posts()) {
$queryObject... |
26,491 | <p>I know I can use <code>get_num_queries()</code> for the number of queries. However, how can I see what queries Wordpress actually makes? I've tried using $query but that didn't work.</p>
| [
{
"answer_id": 26495,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 4,
"selected": true,
"text": "<p>See <a href=\"http://codex.wordpress.org/Editing_wp-config.php#Save_queries_for_analysis\">this codex page</a>.</p>\... | 2011/08/21 | [
"https://wordpress.stackexchange.com/questions/26491",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4284/"
] | I know I can use `get_num_queries()` for the number of queries. However, how can I see what queries Wordpress actually makes? I've tried using $query but that didn't work. | See [this codex page](http://codex.wordpress.org/Editing_wp-config.php#Save_queries_for_analysis).
in `wp-config.php`:
```
define('SAVEQUERIES', true);
```
then in your template:
```
if (current_user_can('administrator')){
global $wpdb;
echo "<pre>";
print_r($wpdb->queries);
echo "</pre>";
}
```
... |
26,506 | <p>Im trying to set up an if statement to display certain code, if the user is on a certain page. I've got the links and student work pages to work, but when I add the if not link and not student work I get an unexpected T_BOOLEAN_AND error. How can I fix this so I can list the pages I don't want custom code for and us... | [
{
"answer_id": 26518,
"author": "helenhousandi",
"author_id": 2226,
"author_profile": "https://wordpress.stackexchange.com/users/2226",
"pm_score": 2,
"selected": false,
"text": "<p>This is really just PHP, not WP, but your initial if statement has an extra parenthesis after <code>!is_pa... | 2011/08/21 | [
"https://wordpress.stackexchange.com/questions/26506",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8088/"
] | Im trying to set up an if statement to display certain code, if the user is on a certain page. I've got the links and student work pages to work, but when I add the if not link and not student work I get an unexpected T\_BOOLEAN\_AND error. How can I fix this so I can list the pages I don't want custom code for and use... | This is really just PHP, not WP, but your initial if statement has an extra parenthesis after `!is_page('links')`, so the `&&` is outside and PHP doesn’t know what to do with it. It'd be better to reorganize the block anyway, e.g.
```
<?php
if (is_page('links')) {
query_posts('cat=2');
... |
26,507 | <p>I haven't seen this done, but I want to return the custom field values outside of the loop in the sidebar.</p>
| [
{
"answer_id": 26526,
"author": "tollmanz",
"author_id": 4850,
"author_profile": "https://wordpress.stackexchange.com/users/4850",
"pm_score": 3,
"selected": false,
"text": "<p>Definitely doable with tons of different ways to accomplish it. Basically, you can use a <a href=\"http://wordp... | 2011/08/21 | [
"https://wordpress.stackexchange.com/questions/26507",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4902/"
] | I haven't seen this done, but I want to return the custom field values outside of the loop in the sidebar. | Definitely doable with tons of different ways to accomplish it. Basically, you can use a [widget that allows for the execution of PHP](http://wordpress.org/extend/plugins/php-code-widget/) or modify your theme files to execute PHP in the sidebar. The main function you will need is [`get_post_meta`](http://codex.wordpre... |
26,511 | <p>If anybody knows where to find a most popular tags hack, I would be forever grateful. I've searched and searched to no avail.</p>
| [
{
"answer_id": 26526,
"author": "tollmanz",
"author_id": 4850,
"author_profile": "https://wordpress.stackexchange.com/users/4850",
"pm_score": 3,
"selected": false,
"text": "<p>Definitely doable with tons of different ways to accomplish it. Basically, you can use a <a href=\"http://wordp... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26511",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5205/"
] | If anybody knows where to find a most popular tags hack, I would be forever grateful. I've searched and searched to no avail. | Definitely doable with tons of different ways to accomplish it. Basically, you can use a [widget that allows for the execution of PHP](http://wordpress.org/extend/plugins/php-code-widget/) or modify your theme files to execute PHP in the sidebar. The main function you will need is [`get_post_meta`](http://codex.wordpre... |
26,532 | <p>I've been stumped for days wondering why when I submit an empty string as a search term, it redirects to part of <code>loop.php</code> where I have the following code inserted:</p>
<pre><code><?php /* If there are no posts to display, such as an empty archive page */ ?>
<?php if ( !(have_posts()) &&... | [
{
"answer_id": 26534,
"author": "tollmanz",
"author_id": 4850,
"author_profile": "https://wordpress.stackexchange.com/users/4850",
"pm_score": 2,
"selected": false,
"text": "<p>When doing a search with an empty string, WordPress will not do a search and therefore your search page will no... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26532",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7457/"
] | I've been stumped for days wondering why when I submit an empty string as a search term, it redirects to part of `loop.php` where I have the following code inserted:
```
<?php /* If there are no posts to display, such as an empty archive page */ ?>
<?php if ( !(have_posts()) && !(is_search()) ) : ?>
<h1 class="not... | I feel bad for answering my own question on here, but here's what I did.
I created a custom search template, a custom `searchform.php` and changed my `header.php` to reflect my custom search page.
What I did is rename the search box names to `search` instead of `s` to get around WordPress automatically running `searc... |
26,538 | <p>I'm trying to make a layered wordpress menu, out of categories. <a href="https://i.imgur.com/Wi9Gw.png" rel="nofollow noreferrer">Here's how it's going to look</a>:</p>
<p><img src="https://i.stack.imgur.com/CScKS.png" alt="enter image description here"></p>
<p>I have no clue how to develop this, can't do it with ... | [
{
"answer_id": 26549,
"author": "roikles",
"author_id": 7906,
"author_profile": "https://wordpress.stackexchange.com/users/7906",
"pm_score": 1,
"selected": false,
"text": "<p>You could create your menu in wp-admin>appearance>menus then make sure that custom CSS classes is checked in the... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26538",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/12239/"
] | I'm trying to make a layered wordpress menu, out of categories. [Here's how it's going to look](https://i.imgur.com/Wi9Gw.png):

I have no clue how to develop this, can't do it with `get_posts` (not sortable by parent/children), or `wp_list_categorie... | although @roikles offers a way to do it, I don't think it is very flexible as you will have to go back in the code when you want to add a new category.
Another way of doing it can be to add the image of the subcategory as the description of the subcategory.
To be able to do so, you will first need to allow XHTML in c... |
26,548 | <p>I found a function that counts the number of posts in a custom taxonomy term. The problem is when I "trash" a post it still appears in the count. Any ideas on how to fix this?</p>
<p>Placed in functions.php:</p>
<pre><code>//Job count
function wt_get_category_count($input = '') {
global $wpdb;
if($input == '')
{
... | [
{
"answer_id": 26549,
"author": "roikles",
"author_id": 7906,
"author_profile": "https://wordpress.stackexchange.com/users/7906",
"pm_score": 1,
"selected": false,
"text": "<p>You could create your menu in wp-admin>appearance>menus then make sure that custom CSS classes is checked in the... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26548",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8063/"
] | I found a function that counts the number of posts in a custom taxonomy term. The problem is when I "trash" a post it still appears in the count. Any ideas on how to fix this?
Placed in functions.php:
```
//Job count
function wt_get_category_count($input = '') {
global $wpdb;
if($input == '')
{
$category = get_the_c... | although @roikles offers a way to do it, I don't think it is very flexible as you will have to go back in the code when you want to add a new category.
Another way of doing it can be to add the image of the subcategory as the description of the subcategory.
To be able to do so, you will first need to allow XHTML in c... |
26,555 | <p>I've been trying to rewrite a shop uri, and what I have now is this code: </p>
<pre><code>add_filter('rewrite_rules_array','wp_insertMyRewriteRules');
add_filter('query_vars','wp_insertMyRewriteQueryVars');
add_filter('wp_loaded','flushRules');
// Remember to flush_rules() when adding rules
function flushRules(... | [
{
"answer_id": 26572,
"author": "chrisguitarguy",
"author_id": 6035,
"author_profile": "https://wordpress.stackexchange.com/users/6035",
"pm_score": 3,
"selected": false,
"text": "<p>So, first off, never flush rewrite rules on every page load. Better to do it on plugin activation one ti... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26555",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8099/"
] | I've been trying to rewrite a shop uri, and what I have now is this code:
```
add_filter('rewrite_rules_array','wp_insertMyRewriteRules');
add_filter('query_vars','wp_insertMyRewriteQueryVars');
add_filter('wp_loaded','flushRules');
// Remember to flush_rules() when adding rules
function flushRules(){
global $... | So, first off, never flush rewrite rules on every page load. Better to do it on plugin activation one time.
Step 1: add the rewrite rule:
```
add_action( 'init', 'wpse26555_add_rewrite' );
function wpse26555_add_rewrite()
{
// You should probably rewrite to index.php instead of shop.php?
add_rewrite_rule( '/s... |
26,557 | <p>I would like to programmatically add widgets to my two sidebars that I've got. I couldn't find any official way of doing it?</p>
<p>I started looking in the database. I've found that it's the 'sidebars_widgets' option which puts widgets on sidebars. When looking at the options the widget names has a number added to... | [
{
"answer_id": 51084,
"author": "its_me",
"author_id": 10691,
"author_profile": "https://wordpress.stackexchange.com/users/10691",
"pm_score": 0,
"selected": false,
"text": "<p>This is how you do it: </p>\n\n<p>(WARNING, this could REMOVE all previous widgets if you did not put back the ... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26557",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8101/"
] | I would like to programmatically add widgets to my two sidebars that I've got. I couldn't find any official way of doing it?
I started looking in the database. I've found that it's the 'sidebars\_widgets' option which puts widgets on sidebars. When looking at the options the widget names has a number added to the end ... | When I started this answer it should be just a small note. Well, I failed. Sorry! Stay with me, there is a goody hidden deep down …
How WordPress widgets are stored
--------------------------------
The list of widget is stored in an option named `'sidebars_widgets'`. A `var_export()` may give something like the follo... |
26,559 | <p>I'm trying to count the number of total posts of a custom post type "jobs". My query just returns "0" when I know there are posts. I don't think it is checking that the post type has posts, but I'm clueless as to why... any ideas?</p>
<pre><code><?php $jobs = new WP_Query(array( 'post_type' => 'jobs' ));?>... | [
{
"answer_id": 26569,
"author": "Mamaduka",
"author_id": 888,
"author_profile": "https://wordpress.stackexchange.com/users/888",
"pm_score": 7,
"selected": true,
"text": "<p>The <a href=\"https://codex.wordpress.org/Function_Reference/wp_count_posts\" rel=\"noreferrer\"><code>wp_count_po... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26559",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8063/"
] | I'm trying to count the number of total posts of a custom post type "jobs". My query just returns "0" when I know there are posts. I don't think it is checking that the post type has posts, but I'm clueless as to why... any ideas?
```
<?php $jobs = new WP_Query(array( 'post_type' => 'jobs' ));?>
<?php if ($jobs->have_... | The [`wp_count_posts`](https://codex.wordpress.org/Function_Reference/wp_count_posts) function has parameter `$type` for post type to count, you should use this parameter if you want to get number of jobs
like so:
```
$count_posts = wp_count_posts( 'jobs' )->publish;
``` |
26,560 | <p>I've got this category setup that includes several posts. By design it's not a blog, but a staff listing. Currently all of the staff members have their own posts with the category. I'd like to be able to sort the order they are displayed in in their parent category.</p>
<p>How do I go about doing this in the most u... | [
{
"answer_id": 26579,
"author": "tollmanz",
"author_id": 4850,
"author_profile": "https://wordpress.stackexchange.com/users/4850",
"pm_score": 0,
"selected": false,
"text": "<p>I'm a little confused by your post as I think it could be asking a few different things. If you are asking how ... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26560",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7298/"
] | I've got this category setup that includes several posts. By design it's not a blog, but a staff listing. Currently all of the staff members have their own posts with the category. I'd like to be able to sort the order they are displayed in in their parent category.
How do I go about doing this in the most user friend... | Now that I have a better understanding of the issue, I would recommend using custom fields to sort your posts. You can have a custom field (e.g., "order") and use it to indicate the order of your posts. You then need to use a custom query to order these posts when they are displayed. You can use a custom query like the... |
26,563 | <p>This is more of a template tag question than a programming question, but since WPEC's wiki and forum is quite useless I had to give it a shot here.</p>
<p>Using shortcodes you can easily include a given number of products from a given category in any post and page. </p>
<p><strong>But how can I achieve the followi... | [
{
"answer_id": 26564,
"author": "Rikesh",
"author_id": 7341,
"author_profile": "https://wordpress.stackexchange.com/users/7341",
"pm_score": 1,
"selected": false,
"text": "<p>You can get the current category by:</p>\n\n<p><code><?php get_the_category( $id ) ?></code> - Here id is i... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26563",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | This is more of a template tag question than a programming question, but since WPEC's wiki and forum is quite useless I had to give it a shot here.
Using shortcodes you can easily include a given number of products from a given category in any post and page.
**But how can I achieve the following:**
In the bottom of... | Try this in your wpsc-single\_product.php template. It will give you a list with title and link. I didn't test this with product variations, I am not using them in the site I am working with and I wasn't sure from your question if you needed it to. Hopefully this at least gives you a starting place.
```
<?php
// get ... |
26,568 | <p>Doesnt Show Any Results</p>
<pre><code><?php
$query = array(
'tax_query' => array(
'relation' => 'AND',
array (
'taxonomy' => 'location',
'field' => 'slug',
'terms' => array( 'california', '' ),
),
array(
'taxo... | [
{
"answer_id": 26576,
"author": "Chris",
"author_id": 7435,
"author_profile": "https://wordpress.stackexchange.com/users/7435",
"pm_score": 0,
"selected": false,
"text": "<p>Well first of all you are using it wrong.</p>\n\n<pre><code>$query = new WP_Query(array(\n 'post_type' => '... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26568",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8008/"
] | Doesnt Show Any Results
```
<?php
$query = array(
'tax_query' => array(
'relation' => 'AND',
array (
'taxonomy' => 'location',
'field' => 'slug',
'terms' => array( 'california', '' ),
),
array(
'taxonomy' => 'genre',
'f... | I'm not sure what the rest of your code looks like, but you are mixing up your `$query` variable and you are not sending your `$query` to the new instance of `WP_Query`. Also, there is no need to send an array to the "terms" parameter if you are only using one term. Try this.
```
<?php
// Set the args
$args = array(
... |
26,571 | <p>I use Wordpress commment pagination as follows:</p>
<ul>
<li>paginated comments</li>
<li>comments displayed with the newest comments at the top of each page</li>
<li>50 comments on each page</li>
<li>first page displayed by default</li>
</ul>
<p>The problem is that I am trying to achieve YouTube like comments such... | [
{
"answer_id": 26593,
"author": "Jeremy Jared",
"author_id": 5339,
"author_profile": "https://wordpress.stackexchange.com/users/5339",
"pm_score": 2,
"selected": false,
"text": "<p>A simple way to arrange your comments by most recent is to add this to your functions.php file:</p>\n\n<pre... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26571",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4747/"
] | I use Wordpress commment pagination as follows:
* paginated comments
* comments displayed with the newest comments at the top of each page
* 50 comments on each page
* first page displayed by default
The problem is that I am trying to achieve YouTube like comments such as - newest comments on first page, first page b... | A simple way to arrange your comments by most recent is to add this to your functions.php file:
```
if (!function_exists('custom_reverse_comments')) {
function custom_reverse_comments($comments) {
return array_reverse($comments);
}
}
add_filter ('comments_array', 'custom_reverse_comments');
``` |
26,585 | <p>I have several different posts type, each with a media upload. What I want to do is to rename the "insert into post" button so it correlates to the individual custom-posts. For example - custom post type - "award" and then the media upload box would have the following button, "insert into award".</p>
<p>Any ideas?<... | [
{
"answer_id": 26668,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 2,
"selected": false,
"text": "<p>I think, this is not so easy possible, on the media-page in Admin-area is it not possible to check the post_type o... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26585",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7244/"
] | I have several different posts type, each with a media upload. What I want to do is to rename the "insert into post" button so it correlates to the individual custom-posts. For example - custom post type - "award" and then the media upload box would have the following button, "insert into award".
Any ideas? | I think, this is not so easy possible, on the media-page in Admin-area is it not possible to check the post\_type of your CPT. Normaly you can change strings with the follow small source, an example.
```
if ( is_admin() )
add_filter( 'gettext', array( 'fb_string_translate', 'gettext_filter' ), 10, 1 );
class fb_st... |
26,587 | <p>I've been playing with Modernizr in WordPress lately and here's something that i'm trying to achive.</p>
<p>I'm adding an HTML5 input field in a custom options page, specifically:</p>
<pre><code><input type="number" />
</code></pre>
<p>Now with Modernizr i can test if the browser supports it like this:</p>
... | [
{
"answer_id": 26668,
"author": "bueltge",
"author_id": 170,
"author_profile": "https://wordpress.stackexchange.com/users/170",
"pm_score": 2,
"selected": false,
"text": "<p>I think, this is not so easy possible, on the media-page in Admin-area is it not possible to check the post_type o... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26587",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2670/"
] | I've been playing with Modernizr in WordPress lately and here's something that i'm trying to achive.
I'm adding an HTML5 input field in a custom options page, specifically:
```
<input type="number" />
```
Now with Modernizr i can test if the browser supports it like this:
```
Modernizr.load([
{
test: Modernizr.inp... | I think, this is not so easy possible, on the media-page in Admin-area is it not possible to check the post\_type of your CPT. Normaly you can change strings with the follow small source, an example.
```
if ( is_admin() )
add_filter( 'gettext', array( 'fb_string_translate', 'gettext_filter' ), 10, 1 );
class fb_st... |
26,589 | <p>I'd like to be able to enter a post ID into the search box in order for the exact post to be returned in the search results. I'd also like to retain the ability to search the posts/page titles and content.</p>
<p>eg, user enters '#123' in the search box, and the search results return just post 123. However, if I we... | [
{
"answer_id": 26597,
"author": "tollmanz",
"author_id": 4850,
"author_profile": "https://wordpress.stackexchange.com/users/4850",
"pm_score": 3,
"selected": true,
"text": "<p>I previously asked and answered my own question about customizing a search. You can find that answer here: <a hr... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26589",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4288/"
] | I'd like to be able to enter a post ID into the search box in order for the exact post to be returned in the search results. I'd also like to retain the ability to search the posts/page titles and content.
eg, user enters '#123' in the search box, and the search results return just post 123. However, if I were to ente... | I previously asked and answered my own question about customizing a search. You can find that answer here: [The right way to create a custom search page for complex custom post types](https://wordpress.stackexchange.com/questions/25899/the-right-way-to-create-a-custom-search-page-for-complex-custom-post-types/26530#265... |
26,599 | <p>By default WordPress prints http:// in front of URLS users add in their profile, which are called using the following code:</p>
<pre><code><?php the_author_meta('user_url'); ?>
</code></pre>
<p>Could somebody provide me the code to strip these URLS of "HTTP://" by default? (While still working as a link and... | [
{
"answer_id": 26600,
"author": "AndrettiMilas",
"author_id": 5205,
"author_profile": "https://wordpress.stackexchange.com/users/5205",
"pm_score": 0,
"selected": false,
"text": "<p>I say set it up. You never know if the site gets blasted with traffic and it should help with load time d... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26599",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5205/"
] | By default WordPress prints http:// in front of URLS users add in their profile, which are called using the following code:
```
<?php the_author_meta('user_url'); ?>
```
Could somebody provide me the code to strip these URLS of "HTTP://" by default? (While still working as a link and not touching WP's backend... I a... | Static page cache is trade-off of resources for speed.
The larger and more complex site is, the more resources it takes to cache it. Since there is **no such thing as unwanted speed**, static cache of small sized site is one of the best performance improvements possible. Especially on shared hosting where other tweaki... |
26,607 | <p>I have a plugin page created with <code>add_submenu_page</code>, I want to add a new section there but nothing happens:</p>
<pre><code>add_submenu_page('parent', 'Foo', 'Foo', 'manage_options', 'foo-settings', 'anothercallback');
add_settings_section('foo-settings-section', 'Settings', 'acallback', 'foo-settings');... | [
{
"answer_id": 26612,
"author": "Chiubaka",
"author_id": 7594,
"author_profile": "https://wordpress.stackexchange.com/users/7594",
"pm_score": 5,
"selected": true,
"text": "<p>The <code>add_settings_section()</code> function simply registers a form section with a certain slug with WordPr... | 2011/08/22 | [
"https://wordpress.stackexchange.com/questions/26607",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8116/"
] | I have a plugin page created with `add_submenu_page`, I want to add a new section there but nothing happens:
```
add_submenu_page('parent', 'Foo', 'Foo', 'manage_options', 'foo-settings', 'anothercallback');
add_settings_section('foo-settings-section', 'Settings', 'acallback', 'foo-settings');
```
What's the right c... | The `add_settings_section()` function simply registers a form section with a certain slug with WordPress. In order to get the section and all the fields you've added to it to display on a certain menu page, you need to include the `do_settings_sections($sections-slug)` method in the menu's callback. This is, of course,... |
26,631 | <p>I'm using the following function to count the number of posts an author has made from a custom post type. </p>
<pre><code><?php
function count_user_posts_by_type($userid, $post_type) {
global $wpdb;
$where = get_posts_by_author_sql($post_type, TRUE, $userid);
$count = $wpdb->get_var( "SELECT COUNT... | [
{
"answer_id": 26635,
"author": "Steven",
"author_id": 1447,
"author_profile": "https://wordpress.stackexchange.com/users/1447",
"pm_score": 0,
"selected": false,
"text": "<p>You can try something like this:</p>\n\n<pre><code>$querystr = \"\n SELECT COUNT(*) \n FROM $wpdb->post... | 2011/08/23 | [
"https://wordpress.stackexchange.com/questions/26631",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4999/"
] | I'm using the following function to count the number of posts an author has made from a custom post type.
```
<?php
function count_user_posts_by_type($userid, $post_type) {
global $wpdb;
$where = get_posts_by_author_sql($post_type, TRUE, $userid);
$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->post... | You can use `AND` and `OR` statements in MySQL. Try this:
```
$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where AND (post_status = 'publish' OR post_status = 'draft')" );
``` |
26,640 | <p>I am creating my first website in wordpress, and I have noticed some strange behavior. The website is really slow on the initial load.</p>
<p>When I open the website after some time of inactivity, let's say an hour, the site loads extremely slow, over 5 sec. After that the website is just fast. Even when I close th... | [
{
"answer_id": 26635,
"author": "Steven",
"author_id": 1447,
"author_profile": "https://wordpress.stackexchange.com/users/1447",
"pm_score": 0,
"selected": false,
"text": "<p>You can try something like this:</p>\n\n<pre><code>$querystr = \"\n SELECT COUNT(*) \n FROM $wpdb->post... | 2011/08/23 | [
"https://wordpress.stackexchange.com/questions/26640",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7781/"
] | I am creating my first website in wordpress, and I have noticed some strange behavior. The website is really slow on the initial load.
When I open the website after some time of inactivity, let's say an hour, the site loads extremely slow, over 5 sec. After that the website is just fast. Even when I close the browser ... | You can use `AND` and `OR` statements in MySQL. Try this:
```
$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where AND (post_status = 'publish' OR post_status = 'draft')" );
``` |
26,645 | <p>I'm looking for a nice way to attach an image as a thumbnail to a category. No plugin that I found does this.</p>
<p>I have a category loop and it would nice to display a category thumbnail, not just the name and description.</p>
| [
{
"answer_id": 26635,
"author": "Steven",
"author_id": 1447,
"author_profile": "https://wordpress.stackexchange.com/users/1447",
"pm_score": 0,
"selected": false,
"text": "<p>You can try something like this:</p>\n\n<pre><code>$querystr = \"\n SELECT COUNT(*) \n FROM $wpdb->post... | 2011/08/23 | [
"https://wordpress.stackexchange.com/questions/26645",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5244/"
] | I'm looking for a nice way to attach an image as a thumbnail to a category. No plugin that I found does this.
I have a category loop and it would nice to display a category thumbnail, not just the name and description. | You can use `AND` and `OR` statements in MySQL. Try this:
```
$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where AND (post_status = 'publish' OR post_status = 'draft')" );
``` |
26,671 | <p>I have the following menu in my header:</p>
<pre><code><?php
$args = array(
'menu' => 'Main Menu',
'container' => false,
'depth' => 1,
'items_wrap' => '%3$s',
'walker' => new Bar_List_Walker_Nav_Menu
);
wp_nav_menu($args);
?>
</code><... | [
{
"answer_id": 26675,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 2,
"selected": false,
"text": "<p>After some discussion in chat:</p>\n\n<pre><code>class Bar_List_Walker_Nav_Menu extends Walker_Nav_Menu {\n publi... | 2011/08/23 | [
"https://wordpress.stackexchange.com/questions/26671",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4610/"
] | I have the following menu in my header:
```
<?php
$args = array(
'menu' => 'Main Menu',
'container' => false,
'depth' => 1,
'items_wrap' => '%3$s',
'walker' => new Bar_List_Walker_Nav_Menu
);
wp_nav_menu($args);
?>
```
and I want to make the output look li... | You can use the menu order inside the item to see if it's not first. If it isn't have it draw the character before the anchor.
```
class Bar_List_Walker_Nav_Menu extends Walker_Nav_Menu {
private $separator = " | ";
function start_el(&$output, $item, $depth, $args) {
if($item->menu_order > 1){
... |
26,680 | <p>I have the following code</p>
<pre><code>$genres= array('action', 'comedy', 'horror');
foreach($genres as $genre){
$ret = wp_set_object_terms( $postId, $genre, 'genres');
}
</code></pre>
<p>But this code associates only horror as the genre. When I checked the DB too, I don't have a record for action and come... | [
{
"answer_id": 26698,
"author": "Bainternet",
"author_id": 2487,
"author_profile": "https://wordpress.stackexchange.com/users/2487",
"pm_score": 3,
"selected": true,
"text": "<p>You can pass an array of terms to <code>wp_set_object_terms</code>, there is no need for the for each:</p>\n\n... | 2011/08/23 | [
"https://wordpress.stackexchange.com/questions/26680",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8129/"
] | I have the following code
```
$genres= array('action', 'comedy', 'horror');
foreach($genres as $genre){
$ret = wp_set_object_terms( $postId, $genre, 'genres');
}
```
But this code associates only horror as the genre. When I checked the DB too, I don't have a record for action and comedy. How do I associate all... | You can pass an array of terms to `wp_set_object_terms`, there is no need for the for each:
```
$genres= array('action', 'comedy', 'horror');
$ret = wp_set_object_terms( $postId, $genres, 'genres');
``` |
26,704 | <p>I would like to have the functionality for image to change when the user selects a different variation. </p>
<p>ie, If I'm selling a T-shirt and have create two variations (Red and White). I would like for the main product image box to the image when the user selects a color. The Red shirt image should be displayed... | [
{
"answer_id": 39269,
"author": "richardw",
"author_id": 12171,
"author_profile": "https://wordpress.stackexchange.com/users/12171",
"pm_score": 3,
"selected": false,
"text": "<p>I hope this isn't too late..</p>\n\n<p>I was also looking for this a bit back and found the following on the ... | 2011/08/23 | [
"https://wordpress.stackexchange.com/questions/26704",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8135/"
] | I would like to have the functionality for image to change when the user selects a different variation.
ie, If I'm selling a T-shirt and have create two variations (Red and White). I would like for the main product image box to the image when the user selects a color. The Red shirt image should be displayed when the ... | I hope this isn't too late..
I was also looking for this a bit back and found the following on the internet, can't remember where...
I have purchased the gold cart option, but I'm not sure if it's a prereq for this to work..
in your theme header file, add the following:
```
<script type="text/javascript">
... |
26,719 | <p>I checked this post here <a href="https://wordpress.stackexchange.com/questions/6891/making-a-plugin-file-accessible-via-url-rewrite">Making a plugin file accessible via url rewrite?</a> which seems to have the same problem as me but its for a plugin. But so far i am getting 404.</p>
<pre><code>add_action( 'init', ... | [
{
"answer_id": 26720,
"author": "Devin Humbert",
"author_id": 7949,
"author_profile": "https://wordpress.stackexchange.com/users/7949",
"pm_score": 1,
"selected": false,
"text": "<p>Try this:</p>\n\n<pre><code>add_action( 'init', 'my_rewrite' );\nfunction my_rewrite() {\n global $wp_r... | 2011/08/23 | [
"https://wordpress.stackexchange.com/questions/26719",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3094/"
] | I checked this post here [Making a plugin file accessible via url rewrite?](https://wordpress.stackexchange.com/questions/6891/making-a-plugin-file-accessible-via-url-rewrite) which seems to have the same problem as me but its for a plugin. But so far i am getting 404.
```
add_action( 'init', 'my_rewrite' );
function ... | Ok here is a test working solution:
```
<?php
/*
Plugin Name: wpse26719
Plugin URI: http://en.bainternet.info
Description: Need to make a php file inside theme accessible via url
Version: 1.0
Author: Bainternet
Author URI: http://en.bainternet.info
*/
// Register a URL that will set this variable to true
add_action('... |
26,729 | <p>I have a code that call <code>get_the_title()</code> and it works, but <code>get_the_excerpt()</code> return empty. How can i make it work? </p>
<p>This code is inside a plugin called "WP Facebook Open Graph protocol". Here's the part i want to change:</p>
<pre><code>if (is_singular('post')) {
if (has_excerpt($p... | [
{
"answer_id": 28372,
"author": "ariel",
"author_id": 8137,
"author_profile": "https://wordpress.stackexchange.com/users/8137",
"pm_score": 4,
"selected": true,
"text": "<p>got it using <code>my_excerpt($post->post_content, get_the_excerpt())</code> and using the <code>my_excerpt()</c... | 2011/08/23 | [
"https://wordpress.stackexchange.com/questions/26729",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8137/"
] | I have a code that call `get_the_title()` and it works, but `get_the_excerpt()` return empty. How can i make it work?
This code is inside a plugin called "WP Facebook Open Graph protocol". Here's the part i want to change:
```
if (is_singular('post')) {
if (has_excerpt($post->ID)) {
echo "\t<meta property='og:... | got it using `my_excerpt($post->post_content, get_the_excerpt())` and using the `my_excerpt()` function from [Using wp\_trim\_excerpt to get the\_excerpt() outside the loop](https://wordpress.stackexchange.com/questions/6961/using-wp-trim-excerpt-to-get-the-excerpt-outside-the-loop) |
26,735 | <p>I have several custom fields that I need my client to be able to edit at anytime. For the sake of convenience, I'd like them to be able to edit these custom fields from the Quick Edit. This way they don't have to open a bunch of new pages to go into each post.</p>
<p>Is it possible to add editable custom fields to ... | [
{
"answer_id": 196190,
"author": "Exclutips",
"author_id": 74748,
"author_profile": "https://wordpress.stackexchange.com/users/74748",
"pm_score": 2,
"selected": false,
"text": "<p>Note that we are wrapping our post meta in a div with an id of “release_date-” plus the post id. This will ... | 2011/08/24 | [
"https://wordpress.stackexchange.com/questions/26735",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7298/"
] | I have several custom fields that I need my client to be able to edit at anytime. For the sake of convenience, I'd like them to be able to edit these custom fields from the Quick Edit. This way they don't have to open a bunch of new pages to go into each post.
Is it possible to add editable custom fields to Quick Edit... | After adding our custom column, we are ready to [expand our Post Quick Edit menu](http://wordpressgeekhelp.blogspot.com/2015/08/expand-wordpress-quick-edit-menu_26.html) using the quick\_edit\_custom\_box action hook.
Note – The quick\_edit\_custom\_box action hook will not fire unless there are custom columns present... |
26,740 | <p>Steps to reproduce...</p>
<p>1) Add to functions.php:</p>
<pre><code>add_image_size( 'half-size', 200, 200, false );
</code></pre>
<p>2) Add to template file (inside loop):</p>
<pre><code><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail... | [
{
"answer_id": 196190,
"author": "Exclutips",
"author_id": 74748,
"author_profile": "https://wordpress.stackexchange.com/users/74748",
"pm_score": 2,
"selected": false,
"text": "<p>Note that we are wrapping our post meta in a div with an id of “release_date-” plus the post id. This will ... | 2011/08/24 | [
"https://wordpress.stackexchange.com/questions/26740",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1697/"
] | Steps to reproduce...
1) Add to functions.php:
```
add_image_size( 'half-size', 200, 200, false );
```
2) Add to template file (inside loop):
```
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail ('half-size', array('class' => 'profile_image')); ?> </a>
```
... | After adding our custom column, we are ready to [expand our Post Quick Edit menu](http://wordpressgeekhelp.blogspot.com/2015/08/expand-wordpress-quick-edit-menu_26.html) using the quick\_edit\_custom\_box action hook.
Note – The quick\_edit\_custom\_box action hook will not fire unless there are custom columns present... |
26,749 | <p>Are there any hooks for running plugin code after a core upgrade?</p>
<p>Specifically, I'm running into issues that a users wp-admin column choice in the 'Screen Options' are <a href="http://jaxov.com/2010/06/wordpress-3-0-publish-update-button-missing/" rel="nofollow">modified</a> after an upgrade - I believe if t... | [
{
"answer_id": 196190,
"author": "Exclutips",
"author_id": 74748,
"author_profile": "https://wordpress.stackexchange.com/users/74748",
"pm_score": 2,
"selected": false,
"text": "<p>Note that we are wrapping our post meta in a div with an id of “release_date-” plus the post id. This will ... | 2011/08/24 | [
"https://wordpress.stackexchange.com/questions/26749",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3669/"
] | Are there any hooks for running plugin code after a core upgrade?
Specifically, I'm running into issues that a users wp-admin column choice in the 'Screen Options' are [modified](http://jaxov.com/2010/06/wordpress-3-0-publish-update-button-missing/) after an upgrade - I believe if they choose "auto". After doing an sv... | After adding our custom column, we are ready to [expand our Post Quick Edit menu](http://wordpressgeekhelp.blogspot.com/2015/08/expand-wordpress-quick-edit-menu_26.html) using the quick\_edit\_custom\_box action hook.
Note – The quick\_edit\_custom\_box action hook will not fire unless there are custom columns present... |
26,750 | <p>I have a Wordpress 2.7.x setup that I would like to migrate to the latest version 3.2.1, however I need to make a stepped-upgrade as some plugins need an older version first (3.0.6 IIRC).</p>
<p>However Wordpress is only offering me the latest and greatest version to upgrade to. Is there a way - prefereably within ... | [
{
"answer_id": 26781,
"author": "Chris_O",
"author_id": 251,
"author_profile": "https://wordpress.stackexchange.com/users/251",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not sure of a way to do it through admin but it would be easy to accomplish with svn.</p>\n\n<p>Make a copy or... | 2011/08/24 | [
"https://wordpress.stackexchange.com/questions/26750",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/178/"
] | I have a Wordpress 2.7.x setup that I would like to migrate to the latest version 3.2.1, however I need to make a stepped-upgrade as some plugins need an older version first (3.0.6 IIRC).
However Wordpress is only offering me the latest and greatest version to upgrade to. Is there a way - prefereably within the admin ... | You can hook on `option_update_core` and edit the update url, as a plugin you can do something like this (Remember to disable the plugin after updating wordpress)
```
add_filter('option_update_core','wpse_26750');
add_filter('transient_update_core','wpse_26750');
function wpse_26750($options){
global $wp_version;
... |
26,753 | <p>How to disable edit post option for post one day after publication?</p>
| [
{
"answer_id": 26781,
"author": "Chris_O",
"author_id": 251,
"author_profile": "https://wordpress.stackexchange.com/users/251",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not sure of a way to do it through admin but it would be easy to accomplish with svn.</p>\n\n<p>Make a copy or... | 2011/08/24 | [
"https://wordpress.stackexchange.com/questions/26753",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7314/"
] | How to disable edit post option for post one day after publication? | You can hook on `option_update_core` and edit the update url, as a plugin you can do something like this (Remember to disable the plugin after updating wordpress)
```
add_filter('option_update_core','wpse_26750');
add_filter('transient_update_core','wpse_26750');
function wpse_26750($options){
global $wp_version;
... |
26,760 | <p>bbPress uses a custom post type called forums. When I click on forums, both forums and the Blog menu items are highlighted as a current-menu-item.</p>
<p>Is there a way to remove the current-menu-item from Blog when the post-type = forum?</p>
| [
{
"answer_id": 26766,
"author": "Markus",
"author_id": 8148,
"author_profile": "https://wordpress.stackexchange.com/users/8148",
"pm_score": 0,
"selected": false,
"text": "<p>i would use jquery</p>\n\n<pre><code>$('#menu-item-xxx').removeClass('current-menu-item');\n</code></pre>\n"
},... | 2011/08/24 | [
"https://wordpress.stackexchange.com/questions/26760",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8067/"
] | bbPress uses a custom post type called forums. When I click on forums, both forums and the Blog menu items are highlighted as a current-menu-item.
Is there a way to remove the current-menu-item from Blog when the post-type = forum? | I'd try to format my CSS rules accordingly. If you're using `body_class()` you can always target `single-posttype` so as a quick example
```
.single-posttype .current-menu-item { display: none; }
```
Will hide the current menu item when you're on a specific post type. If this makes sense hehe. Another way would be c... |
26,770 | <p>Say I have the following taxonomy terms:</p>
<pre><code>Term 1
Term 1.1
Term 1.2
Term 2
Term 2.1
</code></pre>
<p>How can I get only posts that are assigned to Term 1 and not include those that are assigned to Term 1.1 or Term 1.2?</p>
<p>For example:</p>
<pre><code>$pages = get_posts(array(
'post_type' ... | [
{
"answer_id": 26773,
"author": "Markus",
"author_id": 8148,
"author_profile": "https://wordpress.stackexchange.com/users/8148",
"pm_score": 0,
"selected": false,
"text": "<p>is used the operator 'IN' and it works</p>\n\n<p>'taxonomy' => 'collections',\n'terms' => array( 28 ),\n'field' =... | 2011/08/24 | [
"https://wordpress.stackexchange.com/questions/26770",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7152/"
] | Say I have the following taxonomy terms:
```
Term 1
Term 1.1
Term 1.2
Term 2
Term 2.1
```
How can I get only posts that are assigned to Term 1 and not include those that are assigned to Term 1.1 or Term 1.2?
For example:
```
$pages = get_posts(array(
'post_type' => 'page',
'numberposts' => -1,
'tax_que... | In looking at the WP\_Tax\_Query class in /wp-includes/taxonomy.php, I found that there is a 'include\_children' option which defaults to true. I modified my original get\_posts() call with the following, and it works great:
```
$pages = get_posts(array(
'post_type' => 'page',
'numberposts' => -1,
'tax_query' =>... |
26,774 | <p>I'm using <a href="http://wordpress.org/extend/plugins/jquery-drill-down-ipod-menu" rel="nofollow">Drill Down Ipod Menu</a> and I'm really like the style of showing submenus , but I have two problems with it.</p>
<p>1-when i load a page it shows all submenus open for a second and I experience a Flash of Unstyled Co... | [
{
"answer_id": 26778,
"author": "Chris_O",
"author_id": 251,
"author_profile": "https://wordpress.stackexchange.com/users/251",
"pm_score": 1,
"selected": true,
"text": "<p>Your best bet would be to consult the author of plugin since it's using a custom jQuery plugin script. </p>\n\n<bl... | 2011/08/24 | [
"https://wordpress.stackexchange.com/questions/26774",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7585/"
] | I'm using [Drill Down Ipod Menu](http://wordpress.org/extend/plugins/jquery-drill-down-ipod-menu) and I'm really like the style of showing submenus , but I have two problems with it.
1-when i load a page it shows all submenus open for a second and I experience a Flash of Unstyled Content , it was good for a while when... | Your best bet would be to consult the author of plugin since it's using a custom jQuery plugin script.
>
> how can I prevent showing my menu un styled?
>
>
>
You can add a class of `no-display` to the elements of the menu that are un styled as the page loads then in css set `.no-display {display:none;}`Then use ... |
26,789 | <p>I'm writing new theme for my blog. And I want to make some kind of post rating using custom fields.</p>
<p>There are two fields: 'good-post' and 'bad-post'. And after each post I placed two buttons. Yep, 'Good post' and 'Bad post'. On buttons I placed onclick event that calls this AJAX function:</p>
<pre><code>fun... | [
{
"answer_id": 26778,
"author": "Chris_O",
"author_id": 251,
"author_profile": "https://wordpress.stackexchange.com/users/251",
"pm_score": 1,
"selected": true,
"text": "<p>Your best bet would be to consult the author of plugin since it's using a custom jQuery plugin script. </p>\n\n<bl... | 2011/08/24 | [
"https://wordpress.stackexchange.com/questions/26789",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8153/"
] | I'm writing new theme for my blog. And I want to make some kind of post rating using custom fields.
There are two fields: 'good-post' and 'bad-post'. And after each post I placed two buttons. Yep, 'Good post' and 'Bad post'. On buttons I placed onclick event that calls this AJAX function:
```
function ajaxIncGoodPost... | Your best bet would be to consult the author of plugin since it's using a custom jQuery plugin script.
>
> how can I prevent showing my menu un styled?
>
>
>
You can add a class of `no-display` to the elements of the menu that are un styled as the page loads then in css set `.no-display {display:none;}`Then use ... |
26,791 | <p>Does anyone know why nextgen gallery doesn't support thumbnails with png transparency???</p>
<p>I'm working on this project <a href="http://decolabel.andresmijares.com/smaakvolle-etiketten/" rel="nofollow">http://decolabel.andresmijares.com/smaakvolle-etiketten/</a></p>
<p>And as you can see the slideshow work the... | [
{
"answer_id": 26778,
"author": "Chris_O",
"author_id": 251,
"author_profile": "https://wordpress.stackexchange.com/users/251",
"pm_score": 1,
"selected": true,
"text": "<p>Your best bet would be to consult the author of plugin since it's using a custom jQuery plugin script. </p>\n\n<bl... | 2011/08/24 | [
"https://wordpress.stackexchange.com/questions/26791",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4907/"
] | Does anyone know why nextgen gallery doesn't support thumbnails with png transparency???
I'm working on this project <http://decolabel.andresmijares.com/smaakvolle-etiketten/>
And as you can see the slideshow work the image properly, however the thumbnails have a black background.
I'd really appreciated any kind of ... | Your best bet would be to consult the author of plugin since it's using a custom jQuery plugin script.
>
> how can I prevent showing my menu un styled?
>
>
>
You can add a class of `no-display` to the elements of the menu that are un styled as the page loads then in css set `.no-display {display:none;}`Then use ... |
26,794 | <p>I have both regular blog posts and a custom post type in a blog. The page template shows the author posts link. If you click on that link for an author that has authored some posts, that page (blog/authors/mr-author) shows the expected bio information and a list of the author's posts.</p>
<p>However, if you create ... | [
{
"answer_id": 26797,
"author": "Chip Bennett",
"author_id": 3966,
"author_profile": "https://wordpress.stackexchange.com/users/3966",
"pm_score": 3,
"selected": true,
"text": "<p>I believe the issue is that the default query only queries for <code>post</code> post-type. (<a href=\"https... | 2011/08/24 | [
"https://wordpress.stackexchange.com/questions/26794",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3687/"
] | I have both regular blog posts and a custom post type in a blog. The page template shows the author posts link. If you click on that link for an author that has authored some posts, that page (blog/authors/mr-author) shows the expected bio information and a list of the author's posts.
However, if you create a user tha... | I believe the issue is that the default query only queries for `post` post-type. ([See related WPSE question here.](https://wordpress.stackexchange.com/questions/11210/including-post-type-wiki-in-author-archives))
So, you probably need to modify the query in your `author.php` template file, so that all relevant post-t... |
26,806 | <p>I'm using the plugin <code>Wordpress User Frontend</code> and editing the title and content of a post is nice (I managed to change it so I can edit custom post types), but there's no support for editing custom fields. So I have the following code below (not sure if it's too long to have to put on pastebin):</p>
<p... | [
{
"answer_id": 26799,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 2,
"selected": false,
"text": "<p>W3TC does diffenet things, among which are:</p>\n\n<ul>\n<li>caching database queries;</li>\n<li>implementing object... | 2011/08/24 | [
"https://wordpress.stackexchange.com/questions/26806",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7457/"
] | I'm using the plugin `Wordpress User Frontend` and editing the title and content of a post is nice (I managed to change it so I can edit custom post types), but there's no support for editing custom fields. So I have the following code below (not sure if it's too long to have to put on pastebin):
```
function wpuf_val... | When and how to use transients or the object cache is a bit tricky and site-dependent. Here's the breakdown:
1. When not using a persistent object cache (like memcached):
* Transients are stored in the database
* Objects in the object cache are only cached for the duration of the page request.
2. When using a persi... |
26,815 | <p>I am currently in the process of starting my first blog. Currently, I am stumped. I have a homepage slider that refuses to work with me. The documentation for the theme I am currently using is located <a href="http://wordpress.site5.net/boldy/doc/" rel="nofollow">here</a>. The problem I'm having is I can't figure o... | [
{
"answer_id": 26818,
"author": "Sisir",
"author_id": 3094,
"author_profile": "https://wordpress.stackexchange.com/users/3094",
"pm_score": 1,
"selected": false,
"text": "<p>Reading at the theme documentation. You have to create new pages and insert the image for each of the slide. The p... | 2011/08/24 | [
"https://wordpress.stackexchange.com/questions/26815",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7893/"
] | I am currently in the process of starting my first blog. Currently, I am stumped. I have a homepage slider that refuses to work with me. The documentation for the theme I am currently using is located [here](http://wordpress.site5.net/boldy/doc/). The problem I'm having is I can't figure out how or what the slider deci... | I was able to solve the problem by hard coding. The documentation was to vague and not properly detailed for me to figure out how to use the settings.
Here is the code:
```
<!-- BEGIN SLIDER -->
<div id="slider">
<a href="http://ko....cat=4"><img class="alignnone size-full wp-image-254" title="Android ... |
26,822 | <p>I'm loading some JavaScript files in the parent theme. The path in the parent theme is:</p>
<pre><code>scripts > custom.js
</code></pre>
<p>In the child theme, I'm creating the same path (<code>scripts > custom.js</code>) and changing some of the jQuery inside the <code>custom.js</code> file. </p>
<p>The pr... | [
{
"answer_id": 26824,
"author": "chrisguitarguy",
"author_id": 6035,
"author_profile": "https://wordpress.stackexchange.com/users/6035",
"pm_score": 7,
"selected": true,
"text": "<p>Child themes only override php files (like header.php) that are included with functions like get_template_... | 2011/08/24 | [
"https://wordpress.stackexchange.com/questions/26822",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8084/"
] | I'm loading some JavaScript files in the parent theme. The path in the parent theme is:
```
scripts > custom.js
```
In the child theme, I'm creating the same path (`scripts > custom.js`) and changing some of the jQuery inside the `custom.js` file.
The problem is that the changes are not being applied. Is this the ... | Child themes only override php files (like header.php) that are included with functions like get\_template\_part or get\_header, etc.
The correct way to add scripts to WordPress is with [wp\_enqueue\_script](http://codex.wordpress.org/Function_Reference/wp_enqueue_script). If your parent theme uses this, you can overr... |
26,823 | <p>Twenty Eleven Theme...</p>
<p>On the home page, I have successfully filtered the loop to display just "Featured" posts with pagination functioning properly through nav links. I'm trying to display posts from all categories on another page called "Unfiltered." Why do the nav links disappear when used on this other p... | [
{
"answer_id": 26825,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 3,
"selected": false,
"text": "<p>the argument for WP_Query is <code>paged</code>, but the query var is <code>page</code>, no 'd' on the end.</p>\n\n... | 2011/08/24 | [
"https://wordpress.stackexchange.com/questions/26823",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1697/"
] | Twenty Eleven Theme...
On the home page, I have successfully filtered the loop to display just "Featured" posts with pagination functioning properly through nav links. I'm trying to display posts from all categories on another page called "Unfiltered." Why do the nav links disappear when used on this other page?
edit... | `twentyeleven_content_nav()` uses the main query object, `$wp_query`. You'll need to use the `$wp_query` variable, rather than `$unfiltered_query`, then `wp_reset_query()` to restore the original `$wp_query` (which it'll find in `$wp_the_query`, something you should probably avoid touching directly).
As long as you're... |
26,837 | <p>I know the_content has the handy dandy $strip_teaser argument that lets you set whether there is "continue reading" text. No such luck for the_excerpt...</p>
<p>I would like to just get rid of it. I had previously tried to just shorten it to Read on but that didn't seem to work either.</p>
<pre><code> function bee... | [
{
"answer_id": 26839,
"author": "wired",
"author_id": 5573,
"author_profile": "https://wordpress.stackexchange.com/users/5573",
"pm_score": 3,
"selected": true,
"text": "<p>If you're using the Twenty Eleven theme I think you need to remove that theme's filter before you can define your o... | 2011/08/25 | [
"https://wordpress.stackexchange.com/questions/26837",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1697/"
] | I know the\_content has the handy dandy $strip\_teaser argument that lets you set whether there is "continue reading" text. No such luck for the\_excerpt...
I would like to just get rid of it. I had previously tried to just shorten it to Read on but that didn't seem to work either.
```
function beernews_auto_excerpt... | If you're using the Twenty Eleven theme I think you need to remove that theme's filter before you can define your own:
remove\_filter( 'excerpt\_more', 'twentyeleven\_auto\_excerpt\_more' );
*edit* building from t-p
try this:
```
add_action( 'after_setup_theme', 'my_child_theme_setup' );
function my_child_t... |
26,851 | <p>I'm having a big problem with Permalinks on our Wordpress installation.
It's currently running Ubuntu 10.4 and when i add a page to the site, there are odd things happening:</p>
<ol>
<li><p>We get infinite loop and "too many redirect" warnings from different browsers</p></li>
<li><p>Other links on the site get redi... | [
{
"answer_id": 26853,
"author": "Scott",
"author_id": 4610,
"author_profile": "https://wordpress.stackexchange.com/users/4610",
"pm_score": 2,
"selected": true,
"text": "<p>As you have already pointed out there is no right answer to this but here is how I deal with WP sites after they ar... | 2011/08/25 | [
"https://wordpress.stackexchange.com/questions/26851",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4432/"
] | I'm having a big problem with Permalinks on our Wordpress installation.
It's currently running Ubuntu 10.4 and when i add a page to the site, there are odd things happening:
1. We get infinite loop and "too many redirect" warnings from different browsers
2. Other links on the site get redirected to the newly created p... | As you have already pointed out there is no right answer to this but here is how I deal with WP sites after they are done.
When building a WP site for a client, through the whole process we make them aware of our aftersales support.
Our support has different levels with the levels giving better SLA's than the last on... |
26,866 | <p>I have the following code and need it to exclude the child pages of a page ID;</p>
<pre><code><?php
$args = array(
'post_type' => 'page',
'post_status' => 'publish',
'numberposts' => -1,
'exclude' => '3984,1939,6006... | [
{
"answer_id": 26872,
"author": "danielwiener",
"author_id": 6817,
"author_profile": "https://wordpress.stackexchange.com/users/6817",
"pm_score": 1,
"selected": false,
"text": "<p>There is not depth parameter for get_posts. See <a href=\"http://codex.wordpress.org/Template_Tags/get_post... | 2011/08/25 | [
"https://wordpress.stackexchange.com/questions/26866",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/4181/"
] | I have the following code and need it to exclude the child pages of a page ID;
```
<?php
$args = array(
'post_type' => 'page',
'post_status' => 'publish',
'numberposts' => -1,
'exclude' => '3984,1939,6006,28,2784',
... | There is not depth parameter for get\_posts. See <http://codex.wordpress.org/Template_Tags/get_posts>
You will need to check to see whether the page has a parent and display it if it does not have a parent.
Once you are in the foreach loop add an if statement
```
<?php if( !$post->parent ): ?>
<li><a href="<?php... |
26,869 | <p>Right now my shortlink structure looks something like this:</p>
<p>example.com/?p=451</p>
<p>I would prefer it to look more like this:</p>
<p>example.com/abc123</p>
<p>Any ideas how I can alter the code to do just this?</p>
| [
{
"answer_id": 27228,
"author": "chrisguitarguy",
"author_id": 6035,
"author_profile": "https://wordpress.stackexchange.com/users/6035",
"pm_score": 4,
"selected": true,
"text": "<p>Okay, so, as mentioned in my comment to you: altering core files is not a good idea. But here is a plugin... | 2011/08/25 | [
"https://wordpress.stackexchange.com/questions/26869",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7944/"
] | Right now my shortlink structure looks something like this:
example.com/?p=451
I would prefer it to look more like this:
example.com/abc123
Any ideas how I can alter the code to do just this? | Okay, so, as mentioned in my comment to you: altering core files is not a good idea. But here is a plugin solution.
First we're going to create our own rewrite rules that rewrite `s/123` (replace 123 with a post ID) to `index.php?short=123`. We'll also have to filter the WordPress query variables so we can use them la... |
26,882 | <p>I have just setup a new custom theme with little/no data and yet Wordpress has made an update notice about upgrading it to "1.0.1" and I cannot for the life of my work out why.</p>
<p>I have stripped down the theme to the following files:</p>
<p>I have a blank index.php and style.css:</p>
<pre><code>/*
Theme Name... | [
{
"answer_id": 26883,
"author": "Alex Older",
"author_id": 3365,
"author_profile": "https://wordpress.stackexchange.com/users/3365",
"pm_score": 2,
"selected": false,
"text": "<p>The chances are you've named your theme same as one in their directory. Change the name and the notice will d... | 2011/08/25 | [
"https://wordpress.stackexchange.com/questions/26882",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3669/"
] | I have just setup a new custom theme with little/no data and yet Wordpress has made an update notice about upgrading it to "1.0.1" and I cannot for the life of my work out why.
I have stripped down the theme to the following files:
I have a blank index.php and style.css:
```
/*
Theme Name: Fresh
Description: A custo... | In addition to having the same name, I think it checks the folder name first for updates. You should also change your folder name if you are planning to distribute publicly, or if this is private, you can exclude it from update checks: <http://markjaquith.wordpress.com/2009/12/14/excluding-your-plugin-or-theme-from-upd... |
26,889 | <p>I have a permalink structure that looks like this, </p>
<p>%category%/%postname%</p>
<p>I have a category.php template coded up and and trying to pull of the post of a certain category, so for example my URL may look like this, </p>
<p>/category/category1</p>
<p>I want all posts that are in category1 to be retur... | [
{
"answer_id": 26892,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 4,
"selected": true,
"text": "<p>WordPress rewrites rules invisibly translate pretty permalinks to the non-pretty format internally, and set the appr... | 2011/08/25 | [
"https://wordpress.stackexchange.com/questions/26889",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6964/"
] | I have a permalink structure that looks like this,
%category%/%postname%
I have a category.php template coded up and and trying to pull of the post of a certain category, so for example my URL may look like this,
/category/category1
I want all posts that are in category1 to be return however, when using the follo... | WordPress rewrites rules invisibly translate pretty permalinks to the non-pretty format internally, and set the appropriate variables and load the requested page, you don't need to do anything in your template to load posts from a category on a category page.
The `cat` query var specifically will be set to the *ID* of... |
26,898 | <p>I'm using the index.php file and editing this so that it displays two articles at a time. I'm using <code>query_posts( $query_string . '&posts_per_page=2' );</code> before the main loop and it's displaying what I want correctly.</p>
<p>How can I have a page navigation at the bottom?</p>
| [
{
"answer_id": 26904,
"author": "Chris_O",
"author_id": 251,
"author_profile": "https://wordpress.stackexchange.com/users/251",
"pm_score": 0,
"selected": false,
"text": "<p><code>query_posts</code> alters the main loop and messes up pagination.</p>\n\n<p>Use <code>new WP_Query</code> to... | 2011/08/25 | [
"https://wordpress.stackexchange.com/questions/26898",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | I'm using the index.php file and editing this so that it displays two articles at a time. I'm using `query_posts( $query_string . '&posts_per_page=2' );` before the main loop and it's displaying what I want correctly.
How can I have a page navigation at the bottom? | As in the comments, it's not clear why you can't use the options: **dashboard -> settings -> reading -> Blog pages show at most [] posts**
However, if it is necessary that this be done via altering the query (say to target only specific pages, or archives) then this should really be done on `pre_get_post`:
For instan... |
26,911 | <p>Is there a way to have pagination on multiple tabs? </p>
<p>I have a page the has 5 tabs, each tab has filtered content from the same posts. For example:</p>
<p>Tab 1 - All Posts.
Tab 2 - Posts with Keyword One.
Tab 3 - Posts with Keyword Two.</p>
<p>etc...</p>
<p>My problem is that I can't figure out how to u... | [
{
"answer_id": 26904,
"author": "Chris_O",
"author_id": 251,
"author_profile": "https://wordpress.stackexchange.com/users/251",
"pm_score": 0,
"selected": false,
"text": "<p><code>query_posts</code> alters the main loop and messes up pagination.</p>\n\n<p>Use <code>new WP_Query</code> to... | 2011/08/25 | [
"https://wordpress.stackexchange.com/questions/26911",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7481/"
] | Is there a way to have pagination on multiple tabs?
I have a page the has 5 tabs, each tab has filtered content from the same posts. For example:
Tab 1 - All Posts.
Tab 2 - Posts with Keyword One.
Tab 3 - Posts with Keyword Two.
etc...
My problem is that I can't figure out how to use pagination on each tab and hav... | As in the comments, it's not clear why you can't use the options: **dashboard -> settings -> reading -> Blog pages show at most [] posts**
However, if it is necessary that this be done via altering the query (say to target only specific pages, or archives) then this should really be done on `pre_get_post`:
For instan... |
26,915 | <p>I have a question and would like help from friends. I want to add two fields on the page of users registered on my blog. I added some pictures to brighten my explanation.</p>
<ol>
<li>When we register a user manually, following User> Add User, I would add this field:
<img src="https://i.stack.imgur.com/OE6TU.png" a... | [
{
"answer_id": 27041,
"author": "Assad Nazar",
"author_id": 7338,
"author_profile": "https://wordpress.stackexchange.com/users/7338",
"pm_score": 0,
"selected": false,
"text": "<p>check this link\n<a href=\"http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile... | 2011/08/25 | [
"https://wordpress.stackexchange.com/questions/26915",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7633/"
] | I have a question and would like help from friends. I want to add two fields on the page of users registered on my blog. I added some pictures to brighten my explanation.
1. When we register a user manually, following User> Add User, I would add this field:
;
add_action( 'edit_user_profile', 'show_extra_profile_fields', 10 );
function show_extra_profile_fields( $user ) { ?>
<input type="text" name="twitter" value="<?php echo esc_at... |
26,916 | <pre><code>$wp_user_search = new WP_User_Query( array( 'role' => 'author' ) );
$author_list = $wp_user_search->get_results();
foreach($author_list as $author)
{
// author properties?
}
</code></pre>
<p>Can you point me in the direction of the documentation of what properties <code>$author</code> has?</p>
| [
{
"answer_id": 26918,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 1,
"selected": false,
"text": "<p>Do the following to the foreach loop: </p>\n\n<pre><code>echo '<pre>';\nforeach($author_list as $author)\n{\n... | 2011/08/25 | [
"https://wordpress.stackexchange.com/questions/26916",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/304/"
] | ```
$wp_user_search = new WP_User_Query( array( 'role' => 'author' ) );
$author_list = $wp_user_search->get_results();
foreach($author_list as $author)
{
// author properties?
}
```
Can you point me in the direction of the documentation of what properties `$author` has? | Either an array of row objects with properties the column names of the result of the SQL query - ie. the specified fields from the wp\_users table or, if fields equals 'all\_with\_meta', an array of WP\_User objects.
The fields value defaults to 'all', which will return all the columns in the [wp\_users table](http:/... |
26,921 | <p>I have a question regarding my site, tablified.com. I need to change a line of code on ALL of my posts. Within each post, there is a certain line of code that needs to be altered. This code is this:</p>
<blockquote>
<p>[a href="https://market.android.com/details?id=COM.NAMEOFAPP.EXAMPLE>< src="http://tablified... | [
{
"answer_id": 26930,
"author": "Rarst",
"author_id": 847,
"author_profile": "https://wordpress.stackexchange.com/users/847",
"pm_score": 2,
"selected": false,
"text": "<p>You can do this in number of ways, but easiest would be to use one of tools available. For example <a href=\"http://... | 2011/08/25 | [
"https://wordpress.stackexchange.com/questions/26921",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8177/"
] | I have a question regarding my site, tablified.com. I need to change a line of code on ALL of my posts. Within each post, there is a certain line of code that needs to be altered. This code is this:
>
> [a href="https://market.android.com/details?id=COM.NAMEOFAPP.EXAMPLE>< src="http://tablified.com/wp-content/uploads... | You can do this in number of ways, but easiest would be to use one of tools available. For example [Serialized PHP Search Replace Tool](http://interconnectit.com/124/search-and-replace-for-wordpress-databases/).
Be sure to create backup of your database before you start to make any changes. |
26,934 | <p>I'm working on a custom theme using wp_nav_menu(). What I want to do is add a caret to menu items that have sub-menus. For example, If my menu looks like this:</p>
<ul>
<li>Menu Item 1</li>
<li>Menu Item 2
<ul>
<li>Menu Item 2a</li>
<li>Menu Item 2b</li>
</ul></li>
<li>Menu Item 3</li>
</ul>
<p>I want to be able... | [
{
"answer_id": 26947,
"author": "Devin Humbert",
"author_id": 7949,
"author_profile": "https://wordpress.stackexchange.com/users/7949",
"pm_score": 3,
"selected": false,
"text": "<p>You can do this using a custom walker. Paste the following class at the bottom of your functions.php:</p>\... | 2011/08/25 | [
"https://wordpress.stackexchange.com/questions/26934",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8180/"
] | I'm working on a custom theme using wp\_nav\_menu(). What I want to do is add a caret to menu items that have sub-menus. For example, If my menu looks like this:
* Menu Item 1
* Menu Item 2
+ Menu Item 2a
+ Menu Item 2b
* Menu Item 3
I want to be able to format it like this:
* List item
* Menu Item 1
* Menu Item 2... | I do this using jQuery (since it doesn't necessarily need to be in the TEXT (for screen readers, etc.) - just another option...:
```
jQuery(document).ready(function() {
jQuery('ul#nav li').has('ul').addClass('parentul');
});
```
Then for that "parentul" class I put in a background image of an arrow and position it... |
26,945 | <p>Wordpress already comes with jQuery. But what if I want to use a jQuery plugin on the entire blog? What's the best way to include on the entire site?</p>
<p>And what if I only want to include it on one particular post/page?</p>
| [
{
"answer_id": 26946,
"author": "Su'",
"author_id": 3370,
"author_profile": "https://wordpress.stackexchange.com/users/3370",
"pm_score": 0,
"selected": false,
"text": "<p>Assuming you're following the overall rules for theme creation, use <a href=\"http://codex.wordpress.org/Function_Re... | 2011/08/26 | [
"https://wordpress.stackexchange.com/questions/26945",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/-1/"
] | Wordpress already comes with jQuery. But what if I want to use a jQuery plugin on the entire blog? What's the best way to include on the entire site?
And what if I only want to include it on one particular post/page? | A better method is to use the built in WordPress hooks in your functions.php with conditionals if needed ( for instance to load it only on certain pages).
For hooking into admin you can use `admin_print_scripts` for hooking into the front you can use `wp_print_scripts` or one of the many other action hooks.
For examp... |
26,949 | <p>I've created a wordpress theme and new in wordpress development
I want to create option page to take some values from user and I've little bit done with that but confused where and how to save that data
I want to create user interface in short.</p>
| [
{
"answer_id": 26950,
"author": "hfz",
"author_id": 7737,
"author_profile": "https://wordpress.stackexchange.com/users/7737",
"pm_score": 0,
"selected": false,
"text": "<p>If you don't want to be bothered with coding the entire theme options, <a href=\"http://wptheming.com/options-framew... | 2011/08/26 | [
"https://wordpress.stackexchange.com/questions/26949",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8184/"
] | I've created a wordpress theme and new in wordpress development
I want to create option page to take some values from user and I've little bit done with that but confused where and how to save that data
I want to create user interface in short. | update: All the following code should go into your functions.php file
Probably the best (and definitely the easiest) way to make a Theme Options Page is to use the Wordpress Settings API. One note... everywhere you see THEME\_NAME in my code, just replace this with some unique phrase (I use my theme name).
First we n... |
26,953 | <p>I'm pretty sure I understand the roles and capabilities setup in WordPress: granular capabilities, grouped together in roles that can be assigned to users. Code should check the granular capabilities, not the roles (because the capabilities for particular roles can change). Roles are not necessarily hierarchical (th... | [
{
"answer_id": 26957,
"author": "Steven",
"author_id": 1447,
"author_profile": "https://wordpress.stackexchange.com/users/1447",
"pm_score": 0,
"selected": false,
"text": "<p>I use <a href=\"http://wordpress.org/extend/plugins/members/\" rel=\"nofollow\">Members plugin</a> together with ... | 2011/08/26 | [
"https://wordpress.stackexchange.com/questions/26953",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7381/"
] | I'm pretty sure I understand the roles and capabilities setup in WordPress: granular capabilities, grouped together in roles that can be assigned to users. Code should check the granular capabilities, not the roles (because the capabilities for particular roles can change). Roles are not necessarily hierarchical (thoug... | The lack of mutiple roles has irritated me for a long time since the underlying WP\_User class supports multiple roles. I have even considered looking for an alternative software solution. @lpryor - after reading your post, I was re-motivated to implement it myself.
It took a surprisingly short number of lines to do ... |
26,954 | <p>Is it possible to set a different thumbnail size for different pages?
For example, I want the thumbnails on my category, archive and tag view to be bigger than on my home.php.</p>
<p>Right now I have the following code in my function.php:</p>
<pre><code>add_theme_support( 'post-thumbnails' );
</code></pre>
<p>set... | [
{
"answer_id": 26956,
"author": "Alex Older",
"author_id": 3365,
"author_profile": "https://wordpress.stackexchange.com/users/3365",
"pm_score": 3,
"selected": true,
"text": "<p>In your functions file you need to add image sizes:</p>\n\n<p><a href=\"http://codex.wordpress.org/Function_Re... | 2011/08/26 | [
"https://wordpress.stackexchange.com/questions/26954",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6903/"
] | Is it possible to set a different thumbnail size for different pages?
For example, I want the thumbnails on my category, archive and tag view to be bigger than on my home.php.
Right now I have the following code in my function.php:
```
add_theme_support( 'post-thumbnails' );
```
set\_post\_thumbnail\_size( 250, 165... | In your functions file you need to add image sizes:
<http://codex.wordpress.org/Function_Reference/add_image_size> |
26,958 | <p>I been working with featured images more lately and I been adding them to my posts as I go. However I have a bunch of older posts that do not have the featured image set and I want to use it for such things as wptouch etc.</p>
<p>So I have like 300 posts and to be honest I dont want to go into 300 posts and set th... | [
{
"answer_id": 26961,
"author": "Sudirman",
"author_id": 8108,
"author_profile": "https://wordpress.stackexchange.com/users/8108",
"pm_score": 2,
"selected": false,
"text": "<p>Here is the function:</p>\n\n<pre><code>function catch_that_image() {\nglobal $post, $posts;\n$first_img = '';\... | 2011/08/26 | [
"https://wordpress.stackexchange.com/questions/26958",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8082/"
] | I been working with featured images more lately and I been adding them to my posts as I go. However I have a bunch of older posts that do not have the featured image set and I want to use it for such things as wptouch etc.
So I have like 300 posts and to be honest I dont want to go into 300 posts and set the images ma... | Here is the function:
```
function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
// no image found display default image instead
if(empty($first_img)... |
26,978 | <p>I posted this on stackoverflow and they said i can try here - </p>
<p>I have wordpress installed on my website. On that site, under a subfolder i have oscommerce system installed as online commerce store.</p>
<p>I activated permalinks on my wordpress, But now everytime i try to reach the store administration i get... | [
{
"answer_id": 26994,
"author": "moraleida",
"author_id": 7890,
"author_profile": "https://wordpress.stackexchange.com/users/7890",
"pm_score": 0,
"selected": false,
"text": "<p>Are you running wp on an IIS (win) server? Check this -> <a href=\"http://codex.wordpress.org/Using_Permalinks... | 2011/08/26 | [
"https://wordpress.stackexchange.com/questions/26978",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8189/"
] | I posted this on stackoverflow and they said i can try here -
I have wordpress installed on my website. On that site, under a subfolder i have oscommerce system installed as online commerce store.
I activated permalinks on my wordpress, But now everytime i try to reach the store administration i get page not found i... | When you enable permalinks in Wordpress, it creates an htaccess file in whatever directory it's located in. Since Wordpress is installed in the root directory, there will be an .htaccess file there that enabled permalinks.
It is possible that the rewrite rules that WordPress is producing are interfering with your ins... |
26,980 | <p>Where is function.php is stored and built? I want to remove menu named as tools from mysite from all user like admin and other user's?</p>
<p>I Request you please help me out from this problem.Give me the best solution like lay-man to wordpress so that i can understand things quickly.</p>
| [
{
"answer_id": 26981,
"author": "Scott",
"author_id": 4610,
"author_profile": "https://wordpress.stackexchange.com/users/4610",
"pm_score": 0,
"selected": false,
"text": "<p>The following code removes menus, place in your theme functions.php file:</p>\n\n<pre><code>// Remove unneeded men... | 2011/08/26 | [
"https://wordpress.stackexchange.com/questions/26980",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8190/"
] | Where is function.php is stored and built? I want to remove menu named as tools from mysite from all user like admin and other user's?
I Request you please help me out from this problem.Give me the best solution like lay-man to wordpress so that i can understand things quickly. | You want to use [remove menu page](http://codex.wordpress.org/Function_Reference/remove_menu_page).
```
<?php
add_action( 'admin_menu', 'wpse26980_remove_tools', 99 );
function wpse26980_remove_tools()
{
remove_menu_page( 'tools.php' );
}
```
You can drop that in your functions.php file (without the opening `<?p... |
27,001 | <p>Like so many others on the web, I've been trying to get a blog and a portfolio to play nicely together within the same website. Here is what I would like the urls to look like and some things that I have tried.</p>
<p><strong>Desired Permalink Structure:</strong></p>
<pre><code>reggi.com/portfolio
reggi.com/portfo... | [
{
"answer_id": 27004,
"author": "Mamaduka",
"author_id": 888,
"author_profile": "https://wordpress.stackexchange.com/users/888",
"pm_score": 1,
"selected": false,
"text": "<p>You can set up your blog & portfolio with one WordPress installation only.</p>\n\n<p>Fist check this codex ar... | 2011/08/26 | [
"https://wordpress.stackexchange.com/questions/27001",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5396/"
] | Like so many others on the web, I've been trying to get a blog and a portfolio to play nicely together within the same website. Here is what I would like the urls to look like and some things that I have tried.
**Desired Permalink Structure:**
```
reggi.com/portfolio
reggi.com/portfolio/$post_year/$post_title
reggi.c... | You can set up your blog & portfolio with one WordPress installation only.
Fist check this codex article: <http://codex.wordpress.org/Creating_a_Static_Front_Page>
for portfolio it would be best if you'll create Custom Post Type, then all you portfolio stuff will have permalinks like `example.com/portfolio/some-great... |
27,014 | <p>I'm using <a href="http://wordpress.org/extend/plugins/sidebar-generator/" rel="nofollow">Sidebar Generator</a> in all my themes.</p>
<p>The plugin works perfectly normal from "plugins" directory, but I want to embed it somehow to my themes, so it won't display on Installed Plugins list.</p>
<p>I've just copied si... | [
{
"answer_id": 27016,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 1,
"selected": true,
"text": "<p>It should work (and does when I test on a new WP install) with <code>__FILE__</code>, though it's not recommended be... | 2011/08/27 | [
"https://wordpress.stackexchange.com/questions/27014",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1869/"
] | I'm using [Sidebar Generator](http://wordpress.org/extend/plugins/sidebar-generator/) in all my themes.
The plugin works perfectly normal from "plugins" directory, but I want to embed it somehow to my themes, so it won't display on Installed Plugins list.
I've just copied sidebar\_generator.php (the whole code is luc... | It should work (and does when I test on a new WP install) with `__FILE__`, though it's not recommended because it exposes the server path and is just generally an ugly URL. You can replace it with a unique identifier like 'sb-generator-options' or whatever really, as long as it's unique. the important part is the last ... |
27,015 | <p>I created a custom post type which I'll use as landing page for PPC. Now on that custom post type I would like to remove all the filters which are adding the social media buttons for example. I tried already with the following code but that did also remove the shortcode filter which I would like to keep on that cust... | [
{
"answer_id": 27017,
"author": "Devin Humbert",
"author_id": 7949,
"author_profile": "https://wordpress.stackexchange.com/users/7949",
"pm_score": 3,
"selected": true,
"text": "<p>Try re-adding the 'do_shortcode' filter like so: </p>\n\n<pre><code>function landingpage_remove_plugin_f... | 2011/08/27 | [
"https://wordpress.stackexchange.com/questions/27015",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8199/"
] | I created a custom post type which I'll use as landing page for PPC. Now on that custom post type I would like to remove all the filters which are adding the social media buttons for example. I tried already with the following code but that did also remove the shortcode filter which I would like to keep on that custom ... | Try re-adding the 'do\_shortcode' filter like so:
```
function landingpage_remove_plugin_filters() {
global $wp_filter;
global $wp;
if ($wp->query_vars["post_type"] == 'landingpage') {
remove_all_filters('the_content', 'plugin_filters');
add_filter('the_content', 'do_shortcode');
}
} ... |
27,023 | <p>My website is <a href="http://tablified.com" rel="nofollow">http://tablified.com</a> and I have managed to setup the Google Plus script. The issue is that every page of the site displays a different Google Plus count. For example, if you go on my site you will see that I have about 180 Google Pluses. Now, if you cli... | [
{
"answer_id": 27028,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 1,
"selected": false,
"text": "<p>You have to explicitly <a href=\"http://code.google.com/apis/+1button/#target-url\" rel=\"nofollow\">set the target... | 2011/08/27 | [
"https://wordpress.stackexchange.com/questions/27023",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/8203/"
] | My website is <http://tablified.com> and I have managed to setup the Google Plus script. The issue is that every page of the site displays a different Google Plus count. For example, if you go on my site you will see that I have about 180 Google Pluses. Now, if you click on something like "Tablified Apps" you will see ... | You have to explicitly [set the target url](http://code.google.com/apis/+1button/#target-url) or it will use the rel canonical (if present) or grab URL of the current page via js.
[Use the button generator](http://www.google.com/webmasters/+1/button/) and click advanced options to set the target URL, or:
```
<g:pluso... |
27,030 | <p>My blog uses the <code>/?p=378</code> permalink structure for some years. This isn't very helpful with Google Analytics, and I would like to change it to the <code>YEAR/MONTH/DAY/post-title</code> structure.</p>
<p>Is there a way to do this without losing backward compatability, so that old link will work?</p>
| [
{
"answer_id": 27028,
"author": "Milo",
"author_id": 4771,
"author_profile": "https://wordpress.stackexchange.com/users/4771",
"pm_score": 1,
"selected": false,
"text": "<p>You have to explicitly <a href=\"http://code.google.com/apis/+1button/#target-url\" rel=\"nofollow\">set the target... | 2011/08/27 | [
"https://wordpress.stackexchange.com/questions/27030",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6117/"
] | My blog uses the `/?p=378` permalink structure for some years. This isn't very helpful with Google Analytics, and I would like to change it to the `YEAR/MONTH/DAY/post-title` structure.
Is there a way to do this without losing backward compatability, so that old link will work? | You have to explicitly [set the target url](http://code.google.com/apis/+1button/#target-url) or it will use the rel canonical (if present) or grab URL of the current page via js.
[Use the button generator](http://www.google.com/webmasters/+1/button/) and click advanced options to set the target URL, or:
```
<g:pluso... |
27,040 | <p>I am using MapPress Easy Google Map with the following code in my custom theme:</p>
<pre><code><?php
$mymap = new Mappress_Map(array("width" => 600,"height" => 300));
$mypoi_1 = new Mappress_Poi(array("title" => "DC", "body" => "Beautiful Washington, DC", "point" => array("lat" => 38.9027... | [
{
"answer_id": 27058,
"author": "Wyck",
"author_id": 1509,
"author_profile": "https://wordpress.stackexchange.com/users/1509",
"pm_score": 1,
"selected": false,
"text": "<p>Unfortunately there is no easy fix for this, I tried this myself a while ago, and ended up not using any tabs for m... | 2011/08/27 | [
"https://wordpress.stackexchange.com/questions/27040",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7338/"
] | I am using MapPress Easy Google Map with the following code in my custom theme:
```
<?php
$mymap = new Mappress_Map(array("width" => 600,"height" => 300));
$mypoi_1 = new Mappress_Poi(array("title" => "DC", "body" => "Beautiful Washington, DC", "point" => array("lat" => 38.90279, "lng" => -77.037849)));
$myp... | Using an IFrame inside the tab is an easy fix for this. I contacted the Mappress author and he is currently working on it and the next update will be working with jquery tabs (as he told me). |
27,044 | <p>I am trying to show all posts in each category. I've been searching around and it seems I need to have either the category <code>slug</code> or <code>term_id</code> to do so, like the code below.</p>
<pre><code><?php query_posts('category_name=MyCategory&showposts=9999'); ?>
</code></pre>
<p>I'm currentl... | [
{
"answer_id": 27053,
"author": "Michael",
"author_id": 4884,
"author_profile": "https://wordpress.stackexchange.com/users/4884",
"pm_score": 1,
"selected": true,
"text": "<p>to get the category slug of the category archive:</p>\n\n<pre><code>$cat_slug = get_category(get_query_var('cat')... | 2011/08/27 | [
"https://wordpress.stackexchange.com/questions/27044",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5031/"
] | I am trying to show all posts in each category. I've been searching around and it seems I need to have either the category `slug` or `term_id` to do so, like the code below.
```
<?php query_posts('category_name=MyCategory&showposts=9999'); ?>
```
I'm currently editing the `archive.php` how to get the `slug` name?
T... | to get the category slug of the category archive:
```
$cat_slug = get_category(get_query_var('cat'))->slug;
```
alternatively, to get the category ID of the category archive:
```
$cat_id = get_query_var('cat');
``` |
27,046 | <p>Im currently trying to make my backend work with multiple languages.
Im using qTranslate as my translation plugin.</p>
<p>So far I have accomplished a custom option page with multi-language support. When you click on a different language <em>(in qTranslate on the sidebar)</em> you will get a new options page with p... | [
{
"answer_id": 28178,
"author": "Wyck",
"author_id": 1509,
"author_profile": "https://wordpress.stackexchange.com/users/1509",
"pm_score": 2,
"selected": true,
"text": "<p>I don't know how qTraslate works, but you can pass filters to <a href=\"http://wordpress.org/extend/plugins/widget-l... | 2011/08/27 | [
"https://wordpress.stackexchange.com/questions/27046",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2669/"
] | Im currently trying to make my backend work with multiple languages.
Im using qTranslate as my translation plugin.
So far I have accomplished a custom option page with multi-language support. When you click on a different language *(in qTranslate on the sidebar)* you will get a new options page with prepared option-va... | I don't know how qTraslate works, but you can pass filters to [Widget Logic](http://wordpress.org/extend/plugins/widget-logic/) , you basically duplicate each widget, one for each language. I have used this technique with WPML to show widgets in separate languages that can sometimes be difficult ( such as when they mak... |
27,049 | <p>I observed a difference between <code>twentyten</code> and <code>twentyeleven</code> themes. Let me explain with an example:
<code>example.com/category/health-beauty/</code> finds one post containing just a shortcode.</p>
<p>If I use <code>twentyten</code>, nothing is displayed but in <code>twentyeleven</code> the ... | [
{
"answer_id": 27050,
"author": "Ashfame",
"author_id": 1521,
"author_profile": "https://wordpress.stackexchange.com/users/1521",
"pm_score": 0,
"selected": false,
"text": "<p>In content you don't need to call <code>do_shortcode</code>, the content is parsed to execute any shortcodes in ... | 2011/08/27 | [
"https://wordpress.stackexchange.com/questions/27049",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/6076/"
] | I observed a difference between `twentyten` and `twentyeleven` themes. Let me explain with an example:
`example.com/category/health-beauty/` finds one post containing just a shortcode.
If I use `twentyten`, nothing is displayed but in `twentyeleven` the shortcode is expanded. Actually this is what I want `twentyten` t... | It looks like twenty ten displays the excerpt on category archives.
If you're using manual excerpts, this is an easy fix. Just add this line of code to your theme's functions.php file. It tells wordpress to run the excerpt through the do\_shortcode function/filter.
```
add_filter( 'the_excerpt', 'do_shortcode' );
``... |
27,056 | <p>I use an English WordPress package and this is very well. </p>
<p>Now, I would like to translate some elements of the blog (like "posted on", "comments") etc., but do leave the dashboard interface intact in English. </p>
<p>Is there any mechanism to translate just the site elements?</p>
| [
{
"answer_id": 27065,
"author": "Roman",
"author_id": 3817,
"author_profile": "https://wordpress.stackexchange.com/users/3817",
"pm_score": 4,
"selected": false,
"text": "<p>You can do the following:</p>\n\n<ol>\n<li>Get the the language pack (e.g. <code>de_DE.mo</code>) from <a href=\"h... | 2011/08/27 | [
"https://wordpress.stackexchange.com/questions/27056",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1431/"
] | I use an English WordPress package and this is very well.
Now, I would like to translate some elements of the blog (like "posted on", "comments") etc., but do leave the dashboard interface intact in English.
Is there any mechanism to translate just the site elements? | You can do the following:
1. Get the the language pack (e.g. `de_DE.mo`) from [wordpress.org](http://codex.wordpress.org/WordPress_in_Your_Language). If the language pack isn't available as a standalone download, you could also use the `.mo` file which is bundled in the WordPress ZIP-file for your language. Located un... |
27,067 | <p>I want to be able to add posts to a post parent in wordpress. Is there a way?
There is such option for pages but I need it for posts to. Any ideeas?</p>
<p>Ty!</p>
| [
{
"answer_id": 27072,
"author": "kaiser",
"author_id": 385,
"author_profile": "https://wordpress.stackexchange.com/users/385",
"pm_score": 2,
"selected": true,
"text": "<p>Posts & Pages are \"built in\" Custom Post Types. So something that was delivered as a pre-configuration when WP... | 2011/08/27 | [
"https://wordpress.stackexchange.com/questions/27067",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/2979/"
] | I want to be able to add posts to a post parent in wordpress. Is there a way?
There is such option for pages but I need it for posts to. Any ideeas?
Ty! | Posts & Pages are "built in" Custom Post Types. So something that was delivered as a pre-configuration when WP was installed. There's also other built in stuff like Tags & Categories which are basically nothing other than custom taxonomies.
And you're lucky: You can simply use the API and [add your own](http://codex.w... |
27,068 | <p>According to:http://codex.wordpress.org/Function_Reference/query_posts</p>
<p>To show all posts in a category:</p>
<pre><code>query_posts( array ( 'category_name' => 'The Category Name', 'posts_per_page' => -1 ) );
</code></pre>
<p>Works great, but if I want to show the posts</p>
<blockquote>
<p>ORDER BY... | [
{
"answer_id": 27071,
"author": "Mamaduka",
"author_id": 888,
"author_profile": "https://wordpress.stackexchange.com/users/888",
"pm_score": 3,
"selected": true,
"text": "<p>You need to use this to parameters <code>orderby</code> and <code>order</code></p>\n\n<pre><code><?php query_po... | 2011/08/27 | [
"https://wordpress.stackexchange.com/questions/27068",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/5031/"
] | According to:http://codex.wordpress.org/Function\_Reference/query\_posts
To show all posts in a category:
```
query_posts( array ( 'category_name' => 'The Category Name', 'posts_per_page' => -1 ) );
```
Works great, but if I want to show the posts
>
> ORDER BY ID DESC
>
>
>
Anyone have any idea how to do that... | You need to use this to parameters `orderby` and `order`
```
<?php query_posts( array( 'category_name' => 'my_category_slug', 'orderby' => 'ID', 'order' => 'DESC', 'posts_per_page' => -1 ) ); ?>
``` |
27,077 | <p>I'm using the WP Alchemy class to add custom metaboxes to templates in the admin panel and pull results from those metaboxes into the theme front-end. Here is the relevant code in content-link.php (in the loop - in Twenty Eleven Theme).</p>
<pre><code><a href="<?php display_url_info(); ?>"><img src="... | [
{
"answer_id": 27086,
"author": "Evan Yeung",
"author_id": 1878,
"author_profile": "https://wordpress.stackexchange.com/users/1878",
"pm_score": 1,
"selected": false,
"text": "<p>Try changing your <code>display_url_info</code> function to </p>\n\n<pre><code><?php\nadd_filter('beernews... | 2011/08/27 | [
"https://wordpress.stackexchange.com/questions/27077",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/1697/"
] | I'm using the WP Alchemy class to add custom metaboxes to templates in the admin panel and pull results from those metaboxes into the theme front-end. Here is the relevant code in content-link.php (in the loop - in Twenty Eleven Theme).
```
<a href="<?php display_url_info(); ?>"><img src="http://localhost/wordpress/wp... | Try changing your `display_url_info` function to
```
<?php
add_filter('beernews-child-theme_post', 'display_url_info');
function display_url_info() {
// usually needed
global $basic_metabox;
$basic = $basic_metabox->the_meta();
if($basic['post_link_url']) {
echo $basic['post_link_url'];
... |