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
7,626
<p>Does anyone have experience with using the jQuery UI plugins in the Wordpress admin area? </p> <p>I´ve been trying to use the datepicker functionality in jQuery UI, but its conflicting with the built- in jQuery in wordpress admin. <a href="http://docs.jquery.com/UI/Datepicker" rel="nofollow">http://docs.jquery.com/...
[ { "answer_id": 7643, "author": "Steven", "author_id": 1447, "author_profile": "https://wordpress.stackexchange.com/users/1447", "pm_score": 1, "selected": false, "text": "<p>This is what I include in my calendar plugin:</p>\n\n<pre><code> // Alternative solution for loading scripts only...
2011/01/24
[ "https://wordpress.stackexchange.com/questions/7626", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
Does anyone have experience with using the jQuery UI plugins in the Wordpress admin area? I´ve been trying to use the datepicker functionality in jQuery UI, but its conflicting with the built- in jQuery in wordpress admin. <http://docs.jquery.com/UI/Datepicker> This is the error message I get in console: ``` Uncaug...
It worked when i used version 1.7.3 of the jQuery UI. Version 1.8.9 seems to have compatibility issues with the jQuert used by Wordpress admin.
7,634
<p>For example:</p> <p>In the client site I have 5 page 1) Home 2) product 3) Services 4) Contact us 5) Blog</p> <p>Only from the blog page I want to remove 2) product and 3) Services but not from other pages.</p> <p>Is there any Plugin to do this?</p>
[ { "answer_id": 7636, "author": "Pippin", "author_id": 2418, "author_profile": "https://wordpress.stackexchange.com/users/2418", "pm_score": 0, "selected": false, "text": "<p>It depends on how your page links are added. Are they listed through wp_list_pages()? Manually?</p>\n\n<p>Regardle...
2011/01/24
[ "https://wordpress.stackexchange.com/questions/7634", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/32/" ]
For example: In the client site I have 5 page 1) Home 2) product 3) Services 4) Contact us 5) Blog Only from the blog page I want to remove 2) product and 3) Services but not from other pages. Is there any Plugin to do this?
You can register multiple menus, and display one of them depending on the context. ``` register_nav_menus( array( 'primary' => 'Regular', 'blog' => 'Blog', ) ); ``` ![enter image description here](https://i.stack.imgur.com/G53HB.png) Then in your theme, you select the menu you want: ``` wp_nav_menu( array(...
7,635
<p>Recently, I've been thinking of implementing an easy and simple localization feature in my WordPress site.</p> <p>I thought about adding a custom taxonomy to my posts, and pages called "Languages."</p> <p>So when you click the link of the language it just filters the posts with that Language term.</p> <p>I've be...
[ { "answer_id": 7636, "author": "Pippin", "author_id": 2418, "author_profile": "https://wordpress.stackexchange.com/users/2418", "pm_score": 0, "selected": false, "text": "<p>It depends on how your page links are added. Are they listed through wp_list_pages()? Manually?</p>\n\n<p>Regardle...
2011/01/24
[ "https://wordpress.stackexchange.com/questions/7635", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
Recently, I've been thinking of implementing an easy and simple localization feature in my WordPress site. I thought about adding a custom taxonomy to my posts, and pages called "Languages." So when you click the link of the language it just filters the posts with that Language term. I've been using WPML and it is ...
You can register multiple menus, and display one of them depending on the context. ``` register_nav_menus( array( 'primary' => 'Regular', 'blog' => 'Blog', ) ); ``` ![enter image description here](https://i.stack.imgur.com/G53HB.png) Then in your theme, you select the menu you want: ``` wp_nav_menu( array(...
7,663
<p>I am trying to display feeds from a couple of my blogs using the build in function fetch_feed() however I stumbled across a few problems.</p> <p>I am storing the rss urls in the links section and will be calling the link_rss as the input for fetch_feed(). I know that I would have to deal with an array, perhaps nest...
[ { "answer_id": 7674, "author": "hakre", "author_id": 178, "author_profile": "https://wordpress.stackexchange.com/users/178", "pm_score": 0, "selected": false, "text": "<p>Short answer: No.</p>\n\n<p>fetch_feed() expects an URL, so you basically need to create a URL that will return link_...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7663", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2710/" ]
I am trying to display feeds from a couple of my blogs using the build in function fetch\_feed() however I stumbled across a few problems. I am storing the rss urls in the links section and will be calling the link\_rss as the input for fetch\_feed(). I know that I would have to deal with an array, perhaps nested arra...
Possible, only I am not entirely sure about specifics of looping through multi-feed SimplePie object. Customize [`get_bookmarks()`](http://codex.wordpress.org/Function_Reference/get_bookmarks) call to query for links you need. ``` $bookmarks = get_bookmarks(); $feeds = array(); foreach($bookmarks as $bookmark) i...
7,665
<p>In the first function below, inside the foreach, I'm calling out to the 2nd function in order to test for the occurence of matching category ids that I want to remove from the category listing.</p> <p>However, the way I'm doing it in the 2nd function seems to me to be pretty crude, for lack of a better term. How co...
[ { "answer_id": 7668, "author": "onetrickpony", "author_id": 1986, "author_profile": "https://wordpress.stackexchange.com/users/1986", "pm_score": 3, "selected": true, "text": "<pre><code>function admin_trim_category_description( $terms, $taxonomies ){\n if( 'category' != $taxonomies[0] ...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7665", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
In the first function below, inside the foreach, I'm calling out to the 2nd function in order to test for the occurence of matching category ids that I want to remove from the category listing. However, the way I'm doing it in the 2nd function seems to me to be pretty crude, for lack of a better term. How could I impr...
``` function admin_trim_category_description( $terms, $taxonomies ){ if( 'category' != $taxonomies[0] )return $terms; $whatever_categories = array('category1', 'hidden', 'category2', 'category3'); foreach( $terms as $key => $term) if(!in_array($terms[$key]->name, $whatever_categories)) $terms[$key]->descript...
7,679
<p>I made a custom template for the blog section of my page. I even set post page to <strong>Blog</strong>.</p> <p>I created a custom post type called Page Content and the posts are retrieved in the <code>#feature</code> div. But the main posts (written in the Posts panel) are not being shown (<code>#blog</code> div)<...
[ { "answer_id": 7680, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<p>The <a href=\"http://core.trac.wordpress.org/browser/tags/3.0.4/wp-includes/query.php/#L2555\" rel=\"nofollow\">line ...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7679", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
I made a custom template for the blog section of my page. I even set post page to **Blog**. I created a custom post type called Page Content and the posts are retrieved in the `#feature` div. But the main posts (written in the Posts panel) are not being shown (`#blog` div) Any suggestions to solve this? EDIT: I just...
It seems like the variable `$posts` is already used in the `query.php` files (not very sure). Changing `#posts` to `$custom_posts` solved the problem.
7,685
<p>I made a home.php file and called it Blog.</p> <p>It set it to be the Posts page, but I would like to add a title that will be displayed in that page (the title of page or content).</p> <p>e.g:</p> <pre><code>Posts page: Page title (Maybe page content) == Posts == Post Title Post Content P...
[ { "answer_id": 33021, "author": "Reigel Gallarde", "author_id": 974, "author_profile": "https://wordpress.stackexchange.com/users/974", "pm_score": 3, "selected": false, "text": "<p>as what I understand, you need <a href=\"http://codex.wordpress.org/Function_Reference/single_post_title\"...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7685", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
I made a home.php file and called it Blog. It set it to be the Posts page, but I would like to add a title that will be displayed in that page (the title of page or content). e.g: ``` Posts page: Page title (Maybe page content) == Posts == Post Title Post Content Post Title and so on ```
I'm assuming the following: 1. You're using a Static Front Page 2. You have a separate static page assigned to display the blog posts index 3. You have created the `home.php` template file in your Theme 4. The static page assigned to display the blog posts index is titled **Blog** 5. You have added some post content t...
7,687
<p>I'm having a very peculiar bug with pagination :( I'm trying to display 4 posts per page for a category with slug "lastest-news".</p> <p>The pagination function seems to work correctly. There are 33 posts. The pagination gets constructed correctly with 9 pages and links of following format: /category/lastest-news/p...
[ { "answer_id": 7723, "author": "Jan Fabry", "author_id": 8, "author_profile": "https://wordpress.stackexchange.com/users/8", "pm_score": 4, "selected": true, "text": "<p>WordPress does its own query on every page. You should modify that query instead of creating a new one. What happens n...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7687", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1343/" ]
I'm having a very peculiar bug with pagination :( I'm trying to display 4 posts per page for a category with slug "lastest-news". The pagination function seems to work correctly. There are 33 posts. The pagination gets constructed correctly with 9 pages and links of following format: /category/lastest-news/page// The...
WordPress does its own query on every page. You should modify that query instead of creating a new one. What happens now is that WordPress does a query with the standard posts per page of 10, but you don't do anything with these results and do your own query. This works... until WordPress goes beyond post #33, which is...
7,688
<p>I'd like to use the wp_list_pages as a navigation bar, but I don't want the links to be followed. This is the simple version of the code I'm using <code>&lt;?php wp_list_pages('hierarchical=1&amp;title_li=&amp;depth=1'); ?&gt;</code> but I have no idea how to add the "nofollow" to the links.</p>
[ { "answer_id": 7699, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": false, "text": "<p>use wordpress build in funcion for that \"wp_rel_nofollow\"\nwith a hook to wp_list_pages.</p>\n\n<p>paste thi...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7688", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I'd like to use the wp\_list\_pages as a navigation bar, but I don't want the links to be followed. This is the simple version of the code I'm using `<?php wp_list_pages('hierarchical=1&title_li=&depth=1'); ?>` but I have no idea how to add the "nofollow" to the links.
use wordpress build in funcion for that "wp\_rel\_nofollow" with a hook to wp\_list\_pages. paste this code in your theme's functions.php file and you are set. ``` function add_no_follow($output){ return wp_rel_nofollow($output); } add_filter('wp_list_pages', 'add_no_follow'); ``` hope this helps.
7,693
<p>Whenever I create a new website I first create a staging site on a subdomain like "stage.domain-name.com".</p> <p>After everything works correctly I export the database, open it in notepad++ and do a find/replace for "subdomain.domain-name.com" and replace it with "domain-name.com"... finally I import it into a new...
[ { "answer_id": 7698, "author": "Fernando Briano", "author_id": 298, "author_profile": "https://wordpress.stackexchange.com/users/298", "pm_score": 5, "selected": true, "text": "<p>The table where your URL is saved is wp_options. You should do an update on the columns that use the URL for...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7693", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/479/" ]
Whenever I create a new website I first create a staging site on a subdomain like "stage.domain-name.com". After everything works correctly I export the database, open it in notepad++ and do a find/replace for "subdomain.domain-name.com" and replace it with "domain-name.com"... finally I import it into a new database ...
The table where your URL is saved is wp\_options. You should do an update on the columns that use the URL for your site: ``` UPDATE TABLE wp_options SET option_value = "new domain" WHERE option_name = "siteurl" UPDATE TABLE wp_options SET option_value = "new domain" WHERE option_name = "home" ``` I might be missing ...
7,697
<p>I am trying to add in a script and css file for my plugin into the admin header.</p> <p>Is there a function similar to <code>get_bloginfo('url')</code> that I could use to reference the files correctly without having to hard code url's?</p>
[ { "answer_id": 7701, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 1, "selected": false, "text": "<p>you can use WP_PLUGIN_URL like so:</p>\n\n<pre><code>WP_PLUGIN_URL .'/plugin_directory/filename.css'\n</code><...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7697", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2632/" ]
I am trying to add in a script and css file for my plugin into the admin header. Is there a function similar to `get_bloginfo('url')` that I could use to reference the files correctly without having to hard code url's?
> > I am trying to add in a script and css file for my plugin into the admin header. > > > Then like any good developer you should be using `wp_enqueue_script` or `wp_enqueue_style` so you're not hard-coding those script/style includes into the plugin(meaning a user can unhook them if he/she needed to). <http://c...
7,702
<p>Is it possible to add a child post into the parent page? Basically I have a 1 parent page and it has 2 child page that has a simple content , and I want the child page content to put also in the parent page ,BUT making it an as a excerpt, not output all content (just a teaser).</p> <p>Havent clue yet how to pull th...
[ { "answer_id": 7732, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>You can use <a href=\"http://codex.wordpress.org/Function_Reference/get_page\" rel=\"nofollow\"><code>get_page()</cod...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7702", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2210/" ]
Is it possible to add a child post into the parent page? Basically I have a 1 parent page and it has 2 child page that has a simple content , and I want the child page content to put also in the parent page ,BUT making it an as a excerpt, not output all content (just a teaser). Havent clue yet how to pull that.. any ...
First, you need to query the child Pages: ``` $pageargs = array( 'numberposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC', 'post_type' => 'page', 'post_parent' => $post->ID ); $childpages = get_posts( $pageargs ); ``` Then, you need to create your custom Loop: ``` foreach ( $childpages as $childpa...
7,707
<p>I created a custom widget, but it's not saving if I click on save. When I refresh the page it is not saved. My code looks like follows</p> <pre><code> &lt;?php /** * Plugin Name: Sending a Contact SMS * Plugin URI: http://www.test.co.za * Description: Allows you to send a contact SMS to ...
[ { "answer_id": 7712, "author": "onetrickpony", "author_id": 1986, "author_profile": "https://wordpress.stackexchange.com/users/1986", "pm_score": 3, "selected": true, "text": "<p>there no \"id_base\" key in <code>$control_ops</code>; from what I know it only accepts width/height.\nmove i...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7707", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2719/" ]
I created a custom widget, but it's not saving if I click on save. When I refresh the page it is not saved. My code looks like follows ``` <?php /** * Plugin Name: Sending a Contact SMS * Plugin URI: http://www.test.co.za * Description: Allows you to send a contact SMS to website owner * ...
there no "id\_base" key in `$control_ops`; from what I know it only accepts width/height. move it the id\_base is the first argument you have there in `WP_Widget()`
7,715
<p>How to create a widget that has a submit form in the front end? The reason for this is I'm teaching myself plugin development and I'm struggling on how to display a form on the front end after adding the widget to the sidebar. </p> <p>my code thus far</p> <pre><code>function widget ($args,$instance) { extract(...
[ { "answer_id": 7712, "author": "onetrickpony", "author_id": 1986, "author_profile": "https://wordpress.stackexchange.com/users/1986", "pm_score": 3, "selected": true, "text": "<p>there no \"id_base\" key in <code>$control_ops</code>; from what I know it only accepts width/height.\nmove i...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7715", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2719/" ]
How to create a widget that has a submit form in the front end? The reason for this is I'm teaching myself plugin development and I'm struggling on how to display a form on the front end after adding the widget to the sidebar. my code thus far ``` function widget ($args,$instance) { extract( $args ); /* Our...
there no "id\_base" key in `$control_ops`; from what I know it only accepts width/height. move it the id\_base is the first argument you have there in `WP_Widget()`
7,721
<p>I would like to have some links which load the page content of the page they reference to inside a Fancybox popup(pages like "shipping" or "returns", mainly text content).</p> <p>I would create the pages an then I will add the permalinks to these pages to other sections, like footer or sidebar, and they will open ...
[ { "answer_id": 7770, "author": "Backie", "author_id": 2596, "author_profile": "https://wordpress.stackexchange.com/users/2596", "pm_score": 0, "selected": false, "text": "<p>Well best option in my opinion is hardcoding the contents of the boxes and just putting the divs in the footer. Ha...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7721", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2618/" ]
I would like to have some links which load the page content of the page they reference to inside a Fancybox popup(pages like "shipping" or "returns", mainly text content). I would create the pages an then I will add the permalinks to these pages to other sections, like footer or sidebar, and they will open in the popu...
I have found that the best way to include WordPress pages into a fancybox is to create a new template to use for those pages. For example I have some of my contact forms in a fancy box and the template I use is called custom-page-plain.php and doesn't call header.php and contains a link to an alternate style sheet. `...
7,724
<p>I have a setting in my theme that seeks to prevent the WP media manager upload utility from creating multiple copies of each image I upload. Apparently the latest versions of WP have changed the required settings to defeat this?</p> <p>Here's the current settings I have in my theme's functions.php...</p> <pre><cod...
[ { "answer_id": 7749, "author": "Backie", "author_id": 2596, "author_profile": "https://wordpress.stackexchange.com/users/2596", "pm_score": 3, "selected": true, "text": "<p>I believe the following should stop thumbnails from being created. If you're wanting to remove some then and unset ...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7724", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
I have a setting in my theme that seeks to prevent the WP media manager upload utility from creating multiple copies of each image I upload. Apparently the latest versions of WP have changed the required settings to defeat this? Here's the current settings I have in my theme's functions.php... ``` if(get_option('thum...
I believe the following should stop thumbnails from being created. If you're wanting to remove some then and unset the $size[{size}]. Following sizes are there "thumbnail","medium","large","post-thumbnail". ``` add_filter('intermediate_image_sizes_advanced','stop_thumbs'); function stop_thumbs($sizes){ return ar...
7,728
<p>I have a custom post type that is going to use a loop in a couple different places and I wanted to make maintaining those loops easier. I remembered that get_template_part() is available and figured this would be an optimal time to get used to it. However, what has me at a standstill is how to set up a file for the ...
[ { "answer_id": 7749, "author": "Backie", "author_id": 2596, "author_profile": "https://wordpress.stackexchange.com/users/2596", "pm_score": 3, "selected": true, "text": "<p>I believe the following should stop thumbnails from being created. If you're wanting to remove some then and unset ...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7728", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1006/" ]
I have a custom post type that is going to use a loop in a couple different places and I wanted to make maintaining those loops easier. I remembered that get\_template\_part() is available and figured this would be an optimal time to get used to it. However, what has me at a standstill is how to set up a file for the l...
I believe the following should stop thumbnails from being created. If you're wanting to remove some then and unset the $size[{size}]. Following sizes are there "thumbnail","medium","large","post-thumbnail". ``` add_filter('intermediate_image_sizes_advanced','stop_thumbs'); function stop_thumbs($sizes){ return ar...
7,737
<p>I would like to exclude categories from the loop using the "name" instead of the "id", since the ID can change when using new databases. The name however will always be the same.</p> <p>Is this possible?</p>
[ { "answer_id": 7740, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>No.</p>\n\n<p>WordPress very forcefully converts input of that argument to integers and is it part of <a href=\"http:...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7737", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1462/" ]
I would like to exclude categories from the loop using the "name" instead of the "id", since the ID can change when using new databases. The name however will always be the same. Is this possible?
You can use [List Category Posts](http://wordpress.org/extend/plugins/list-category-posts/) (Disclaimer: I'm the author of List Category Posts) or you can code this yourself: ``` $category_id = get_cat_ID($category_name); ``` This way you can get the id and exclude it from the loop with the minus sign. Example: ```...
7,741
<p><code>the_content</code> is always surrounded by paragraphs, it doesn't matter if I'm in HTML view and there's nothing there. Does WordPress have a function to remove them? IS there any way?</p>
[ { "answer_id": 7747, "author": "Fernando Briano", "author_id": 298, "author_profile": "https://wordpress.stackexchange.com/users/298", "pm_score": 1, "selected": false, "text": "<p>You can implement your own function in your theme's function.php file and use it instead of \"the_content\"...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7741", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
`the_content` is always surrounded by paragraphs, it doesn't matter if I'm in HTML view and there's nothing there. Does WordPress have a function to remove them? IS there any way?
Removing the filter that adds the P is the best option. ``` remove_filter('the_content','wpautop'); remove_filter('the_content','shortcode_autounp'); // You may want to do this aswell ```
7,756
<p>I want to wrap the filter below in a conditional that tests whether the user is uploading an image from the Media Manager (Admin > Media > Add New) and not from the post editor image upload routine.</p> <p>Is it possible to tell? $pagenow in both cases appears to be the same...</p> <pre><code>//no extra thumbs glo...
[ { "answer_id": 7776, "author": "rexposadas", "author_id": 413, "author_profile": "https://wordpress.stackexchange.com/users/413", "pm_score": 0, "selected": false, "text": "<p>Can you try $_GET['post'] instead of using $_GET['post_id'] ? </p>\n\n<p>That's the request parameter I see.</p...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7756", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
I want to wrap the filter below in a conditional that tests whether the user is uploading an image from the Media Manager (Admin > Media > Add New) and not from the post editor image upload routine. Is it possible to tell? $pagenow in both cases appears to be the same... ``` //no extra thumbs global $pagenow; if($pag...
I answered this for you in the comments of [your previous question](https://wordpress.stackexchange.com/questions/7724/how-can-i-stop-wp-media-uploader-from-creating-duplicates-of-my-uploaded-images). > > ...you can use the filter that @Backie > suggested above > (`intermediate_image_sizes_advanced`), > and in the...
7,757
<p>When WP creates thumbnails from the original uploaded image, they are hidden from view inside the Media Manager listing. Can they be made visible, via some filter or action so that you can selectively edit/delete them?</p>
[ { "answer_id": 19736, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 0, "selected": false, "text": "<p>Why not just go to <code>Dashboard -&gt; Media -&gt; Library</code>? From there, you can see <em>every</em>...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7757", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
When WP creates thumbnails from the original uploaded image, they are hidden from view inside the Media Manager listing. Can they be made visible, via some filter or action so that you can selectively edit/delete them?
**Notice**: *I'm considering that by Media Manager you're referring to the Media Library.* ``` /wp-admin/media.php ``` --- Maybe [`pre_get_posts`](http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts) could handle this, but won't get there... I'd propose an alternative solution that prevents see...
7,760
<p>I have multiple custom post types and custom taxonomies, "staff", "games", which have the permalinks:</p> <pre><code>domain.com/staff/%staff-name% domain.com/games/%game-name% </code></pre> <p>However, I'm only using these custom posts to store data and am displaying it collectively on different pages. How do I g...
[ { "answer_id": 7763, "author": "rexposadas", "author_id": 413, "author_profile": "https://wordpress.stackexchange.com/users/413", "pm_score": 0, "selected": false, "text": "<p>Setting these posts as \"private\" should do what you want - (unless I misunderstood your question)</p>\n" }, ...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7760", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I have multiple custom post types and custom taxonomies, "staff", "games", which have the permalinks: ``` domain.com/staff/%staff-name% domain.com/games/%game-name% ``` However, I'm only using these custom posts to store data and am displaying it collectively on different pages. How do I get the paths, such as, /sta...
If you set the "rewrite" argument to "false" when registering the custom post type, no rewrite rules will be generated.
7,766
<p>I'm wondering if there is a way to implement something like sub-multisites, like parent-child multisite relation.</p> <p>So, what i want is a way to have something like this:</p> <pre><code>/site1 /site1/subsite1 /site1/subsite2 /site2 </code></pre> <p>etc...</p> <p>My approach has been use mod-rewrite to change...
[ { "answer_id": 7763, "author": "rexposadas", "author_id": 413, "author_profile": "https://wordpress.stackexchange.com/users/413", "pm_score": 0, "selected": false, "text": "<p>Setting these posts as \"private\" should do what you want - (unless I misunderstood your question)</p>\n" }, ...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7766", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I'm wondering if there is a way to implement something like sub-multisites, like parent-child multisite relation. So, what i want is a way to have something like this: ``` /site1 /site1/subsite1 /site1/subsite2 /site2 ``` etc... My approach has been use mod-rewrite to change from /site1-subsite1 to /site1/subsite1...
If you set the "rewrite" argument to "false" when registering the custom post type, no rewrite rules will be generated.
7,767
<p>I'm using the following to list my pages:</p> <pre><code>&lt;ul id="nav"&gt; &lt;?php wp_list_pages('title_li='); ?&gt; &lt;/ul&gt; </code></pre> <p>is there a way of highlight the link of the page of the current in the navigation. It shouldn't be fixed. The user should be able to call the page whatever he or s...
[ { "answer_id": 7772, "author": "keatch", "author_id": 2727, "author_profile": "https://wordpress.stackexchange.com/users/2727", "pm_score": 3, "selected": true, "text": "<p>wp_list_pages has support for CSS styles. \nThe current page is marked with the class .current_page_item. You can s...
2011/01/25
[ "https://wordpress.stackexchange.com/questions/7767", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
I'm using the following to list my pages: ``` <ul id="nav"> <?php wp_list_pages('title_li='); ?> </ul> ``` is there a way of highlight the link of the page of the current in the navigation. It shouldn't be fixed. The user should be able to call the page whatever he or she wants, and create as much pages as he or ...
wp\_list\_pages has support for CSS styles. The current page is marked with the class .current\_page\_item. You can style it as you want. Check <http://codex.wordpress.org/Function_Reference/wp_list_pages#Markup_and_styling_of_page_items> for reference.
7,782
<p>I am loading JQuery from the google CDN using the following code:</p> <pre><code>wp_deregister_script('jquery'); wp_register_script( 'jquery', // handle - WP uses this name to refer to script 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js', array(), // Array of handles representing ...
[ { "answer_id": 7783, "author": "Peter Rowell", "author_id": 1958, "author_profile": "https://wordpress.stackexchange.com/users/1958", "pm_score": 1, "selected": false, "text": "<p>Short answer: No.</p>\n\n<p>I looked at the code in <code>wp-includes/scriptloader.php</code> and there is n...
2011/01/26
[ "https://wordpress.stackexchange.com/questions/7782", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2736/" ]
I am loading JQuery from the google CDN using the following code: ``` wp_deregister_script('jquery'); wp_register_script( 'jquery', // handle - WP uses this name to refer to script 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js', array(), // Array of handles representing scripts that t...
Use null as $ver param: ``` wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js', false, null); wp_enqueue_script('jquery'); ``` Output: ``` <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min...
7,785
<p>I almost always select "Open link in new window" when creating an URL/HREF. Is there any way to default this choice. </p> <p>Even if it requires a small source code change, I think it would be worthwhile (if someone can tell me where that might be.) </p>
[ { "answer_id": 7794, "author": "Peter Rowell", "author_id": 1958, "author_profile": "https://wordpress.stackexchange.com/users/1958", "pm_score": 0, "selected": false, "text": "<p>You can create a filter for the hook <a href=\"http://adambrown.info/p/wp_hooks/hook/edit_tag_link?version=3...
2011/01/26
[ "https://wordpress.stackexchange.com/questions/7785", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2550/" ]
I almost always select "Open link in new window" when creating an URL/HREF. Is there any way to default this choice. Even if it requires a small source code change, I think it would be worthwhile (if someone can tell me where that might be.)
It seems TinyMCE provides no easy setting to select a default value. But there is another backdoor: the [`external_link_list_url`](http://tinymce.moxiecode.com/wiki.php/Configuration%3aexternal_link_list_url) option of TinyMCE can point to an extra Javascript file that will be loaded in the link editor window. You can ...
7,790
<p>WP has a nice javascript loader included in wp-admin: <a href="http://core.trac.wordpress.org/browser/tags/3.0.4/wp-admin/load-scripts.php">http://core.trac.wordpress.org/browser/tags/3.0.4/wp-admin/load-scripts.php</a></p> <p>and a CSS loader: <a href="http://core.trac.wordpress.org/browser/tags/3.0.4/wp-admin/loa...
[ { "answer_id": 9833, "author": "Scott", "author_id": 3310, "author_profile": "https://wordpress.stackexchange.com/users/3310", "pm_score": 0, "selected": false, "text": "<p>I have a few scripts you may wish to look at. </p>\n\n<p><strong>1. Combine.php</strong> \n - On a number of my the...
2011/01/26
[ "https://wordpress.stackexchange.com/questions/7790", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/600/" ]
WP has a nice javascript loader included in wp-admin: <http://core.trac.wordpress.org/browser/tags/3.0.4/wp-admin/load-scripts.php> and a CSS loader: <http://core.trac.wordpress.org/browser/tags/3.0.4/wp-admin/load-styles.php> I was wondering if it's possible to use them in the front-end too, not just admin, because ...
*late answer* From a brief look: You'd have to use * `include( admin_url().'load-scripts.php' );` * and `include( admin_url().'script-loader.php' );` Then jump into `$GLOBALS['wp_scripts']`: Use… ``` $wp_scripts->default_dirs( array_merge( $wp_scripts->default_dirs ,array( '/themes/your_theme/js/' ) ...
7,795
<p>I read a tutorial about how to <a href="http://zeo.my/wordpress-display-the-contents-of-static-page-posts-page/" rel="nofollow noreferrer">Display the contents of static page Posts page</a>.</p> <p>Basically I had to place this code right before the Loop:</p> <pre><code>&lt;?php //This is the code from the tutoria...
[ { "answer_id": 7826, "author": "t31os", "author_id": 31073, "author_profile": "https://wordpress.stackexchange.com/users/31073", "pm_score": 3, "selected": true, "text": "<p>This is a relatively simple task, and you only need to attach an appropriately coded page template to your chosen ...
2011/01/26
[ "https://wordpress.stackexchange.com/questions/7795", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
I read a tutorial about how to [Display the contents of static page Posts page](http://zeo.my/wordpress-display-the-contents-of-static-page-posts-page/). Basically I had to place this code right before the Loop: ``` <?php //This is the code from the tutorial if ( 'page' == get_option('show_on_front') && get_option('p...
This is a relatively simple task, and you only need to attach an appropriately coded page template to your chosen post's page. When the page first loads, the main query holds data on the page, such as the title, content and so forth, we can shortcut to that by calling `the_post` which will then allow us to simply call...
7,805
<p>Example of the code:</p> <pre><code>$page_id = 116; // 123 should be replaced with a specific Page's id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be embedded in the query string of the URL, e.g. page.php?action=edit&amp;post=123. $page_...
[ { "answer_id": 7806, "author": "Mike Hudson", "author_id": 2511, "author_profile": "https://wordpress.stackexchange.com/users/2511", "pm_score": 1, "selected": false, "text": "<p>There's two methods, depending on if you're doing this inside or outside the loop.</p>\n\n<p>Inside:\n$page_i...
2011/01/26
[ "https://wordpress.stackexchange.com/questions/7805", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
Example of the code: ``` $page_id = 116; // 123 should be replaced with a specific Page's id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be embedded in the query string of the URL, e.g. page.php?action=edit&post=123. $page_data = get_page( $...
``` global $wp_query; $page_id = $wp_query->get_queried_object_id(); ``` but if you're using a custom page for posts, where are you adding this code?
7,812
<p>I have seen and been using the following technique for adding php scripts to my plugin for handling custom forms in a wordpress plugin.</p> <p>from the quizzin plugin:</p> <pre><code>$code_pages = array('quiz_form.php','quiz_action.php', 'question_form.php', 'question.php'); foreach($code_pages as $code_pa...
[ { "answer_id": 7816, "author": "Backie", "author_id": 2596, "author_profile": "https://wordpress.stackexchange.com/users/2596", "pm_score": 3, "selected": false, "text": "<p>I personally just add a menu link and in the function for it handle the form. With $_SERVER['REQUEST_URI'] as the ...
2011/01/26
[ "https://wordpress.stackexchange.com/questions/7812", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/500/" ]
I have seen and been using the following technique for adding php scripts to my plugin for handling custom forms in a wordpress plugin. from the quizzin plugin: ``` $code_pages = array('quiz_form.php','quiz_action.php', 'question_form.php', 'question.php'); foreach($code_pages as $code_page) { $ho...
Basically, it seems there are two ways to do this: 1) The `$_registered_pages` way detailed in the original question. This seems a bit non-standard and might confuse someone looking at your code. 2) Post your form to an admin url like `admin_url('admin.php?page=show_form')` where `show_form()` is a registered menu it...
7,818
<p>I have this inside my posts page (set in the admin panel: Posts Page: Blog):</p> <p><img src="https://i.stack.imgur.com/waZpC.png" alt="Screenshot homepage setting"></p> <p><strong>blog.php</strong></p> <pre><code> &lt;?php /** * Template Name: Blog * @package WordPress * @subpackage Prominen...
[ { "answer_id": 7820, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>If I remember right (template hierarchy gets messy in these parts) when you assign page to be <code>posts page</code>...
2011/01/26
[ "https://wordpress.stackexchange.com/questions/7818", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
I have this inside my posts page (set in the admin panel: Posts Page: Blog): ![Screenshot homepage setting](https://i.stack.imgur.com/waZpC.png) **blog.php** ``` <?php /** * Template Name: Blog * @package WordPress * @subpackage Prominent * @since Prominent 1.0 */ get_header(); ?>...
Don't forget about the "Help" button in the top-right of the WP admin screen! The Help refers to the [Settings Reading SubPanel](http://codex.wordpress.org/Settings_Reading_SubPanel) page in the Codex which says the following: > > **Posts page** - Select in the drop-down box the name of the Page that will now contai...
7,844
<p>I want to include something like the the_category function in a WordPress post, which by default echoes a list of links to all categories the post is attached separated by comma, but I want to exclude some categories from listing in certain views. In some cases I have to exclude all children ones from appearing, in ...
[ { "answer_id": 7852, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 1, "selected": false, "text": "<p>Not sure but i think you can try this</p>\n\n<pre><code>function my_category_filter($cats){\n //exclude thes...
2011/01/26
[ "https://wordpress.stackexchange.com/questions/7844", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2201/" ]
I want to include something like the the\_category function in a WordPress post, which by default echoes a list of links to all categories the post is attached separated by comma, but I want to exclude some categories from listing in certain views. In some cases I have to exclude all children ones from appearing, in ot...
Not sure but i think you can try this ``` function my_category_filter($cats){ //exclude these from displaying $exclude = array("Large Announcement", "Announcement", "News"); $Catds = array(); foreach ($cats as$cat){ if (!in_array($cat,$exclude)){$Catsa[] = $cat;} } return $Catsa; } add_filter(...
7,846
<p>I have this in my <strong>functions.php</strong>:</p> <p>The images inside the slider were added as <strong>custom post types</strong> called "<strong>Page Content</strong>." I'm not sure if the filter only applies to the main <strong>Posts</strong>.</p> <pre><code>/** * Remove paragraph tags around content and e...
[ { "answer_id": 7848, "author": "editor", "author_id": 1860, "author_profile": "https://wordpress.stackexchange.com/users/1860", "pm_score": 3, "selected": true, "text": "<p>There are various functions aside from <code>wpautop()</code> that <a href=\"http://codex.wordpress.org/How_WordPre...
2011/01/26
[ "https://wordpress.stackexchange.com/questions/7846", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
I have this in my **functions.php**: The images inside the slider were added as **custom post types** called "**Page Content**." I'm not sure if the filter only applies to the main **Posts**. ``` /** * Remove paragraph tags around content and excerpt */ remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the...
There are various functions aside from `wpautop()` that [filter post content](http://codex.wordpress.org/How_WordPress_Processes_Post_Content), such as `force_balance_tags()`, which was designed to balance bad HTML coming in via the editor. They're mostly defined in [formatting.php](http://core.trac.wordpress.org/brow...
7,859
<p>I'm trying to upgrade to WP 3 but I'm getting a weird error when I try to do so:</p> <pre><code>Downloading update from http://wordpress.org/wordpress-3.0.4.zip. Unpacking the update. Could not create directory: /my/path/web/wp-content/upgrade/wordpress-3.tmp Installation Failed </code></pre> <p>The reason it's...
[ { "answer_id": 7861, "author": "MathSmath", "author_id": 1537, "author_profile": "https://wordpress.stackexchange.com/users/1537", "pm_score": 2, "selected": false, "text": "<p>What account is the directory owned by? Try CHOWNing the directory to the account your web server runs as (prob...
2011/01/26
[ "https://wordpress.stackexchange.com/questions/7859", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2748/" ]
I'm trying to upgrade to WP 3 but I'm getting a weird error when I try to do so: ``` Downloading update from http://wordpress.org/wordpress-3.0.4.zip. Unpacking the update. Could not create directory: /my/path/web/wp-content/upgrade/wordpress-3.tmp Installation Failed ``` The reason it's weird is because the `upg...
The fix turned out to be to change `vsftp`'s permissions in the `vsftp` config file.
7,874
<p>How do I possible to work with this code to work with date format Y-n-j</p> <p>Value</p> <pre><code>start_date = 2011-1-20 end_date = 2011-1-30 </code></pre> <p>Here are the original function came from this <a href="https://wordpress.stackexchange.com/questions/6953/query-between-two-meta-values/7006">Query bet...
[ { "answer_id": 7884, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<p>Try to put values for comparison in quotes, those minuses might be getting it interpreted as mathematical expression ...
2011/01/27
[ "https://wordpress.stackexchange.com/questions/7874", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/420/" ]
How do I possible to work with this code to work with date format Y-n-j Value ``` start_date = 2011-1-20 end_date = 2011-1-30 ``` Here are the original function came from this [Query between two meta values?](https://wordpress.stackexchange.com/questions/6953/query-between-two-meta-values/7006) ``` function date...
Hi **@idontknowhow:** You've focused on trying to solve the problem in PHP when in fact you needed to focus on the SQL. Your first problem was you reversed the *"polarity" (which is a term I made up just now, but it kinda fits)*; you were looking for both a start date that was greater than today and an end date the w...
7,878
<p>When I use the functions that get and output the post thumbnail, they will display the requested thumbnail in the size you specify, but if this size doesn't exist they will display the thumbnail in the original size and force the browser to resize it.</p> <p>How can I force them to display a placeholder like "no im...
[ { "answer_id": 7885, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 1, "selected": false, "text": "<p>I'm Not sure about this but i know you can use php's getimagesize() function\nsomething like this:</p>\n\n<pre...
2011/01/27
[ "https://wordpress.stackexchange.com/questions/7878", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/600/" ]
When I use the functions that get and output the post thumbnail, they will display the requested thumbnail in the size you specify, but if this size doesn't exist they will display the thumbnail in the original size and force the browser to resize it. How can I force them to display a placeholder like "no image" in ca...
**Assuming** the question is about `wp_get_attachment_image_src`. It could be also about `wp_get_attachment_link`, but, although related, this analysis doesn't includes it. --- **Got aware** of this issue answering this question: [How can I view all WP generated thumbnails in Media Manager?](https://wordpress.stac...
7,887
<p>WP 3.0.4<br> local installation, multisite network enabled<br> theme: Twentyten<br> plugin: <a href="http://wordpress.org/extend/plugins/list-category-posts/" rel="nofollow">List Category Posts</a> v .15, network activated</p> <p>I've created the folder <code>list-category-posts</code> inside my theme folder, and p...
[ { "answer_id": 7897, "author": "Fernando Briano", "author_id": 298, "author_profile": "https://wordpress.stackexchange.com/users/298", "pm_score": 1, "selected": false, "text": "<p>Hey you just opened the plugin's tag on WordPress Answers :D</p>\n\n<p>Can you paste the code of the genera...
2011/01/27
[ "https://wordpress.stackexchange.com/questions/7887", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
WP 3.0.4 local installation, multisite network enabled theme: Twentyten plugin: [List Category Posts](http://wordpress.org/extend/plugins/list-category-posts/) v .15, network activated I've created the folder `list-category-posts` inside my theme folder, and placed `default.php` inside it. Edited `default.php...
Hey you just opened the plugin's tag on WordPress Answers :D Can you paste the code of the generated html? From what you describe, you are using it correctly, so I just want to see if the template is being loaded to detect if the problem is on the template side, or a bug on the plugin's code. **UPDATE**: Ok, I checke...
7,901
<p>I'm using HTML5 on two sites running two different versions of WordPress. They both exhibit the same behaviour and I would like some help with fixing this please. </p> <pre><code>&lt;label for="url"&gt;Website&lt;/label&gt; &lt;input type="url" name="url" id="url" value="&lt;?php echo esc_attr($comment_author_url);...
[ { "answer_id": 7913, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": false, "text": "<p>I always use Post Types Order which provides a simple drag n drop ordering \nCheck it out <a href=\"http://wor...
2011/01/27
[ "https://wordpress.stackexchange.com/questions/7901", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2761/" ]
I'm using HTML5 on two sites running two different versions of WordPress. They both exhibit the same behaviour and I would like some help with fixing this please. ``` <label for="url">Website</label> <input type="url" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" placeholder="Enter Website ...
So far the best plugin that I have tested to order pages by language is CMS Tree Page View. It allows you to select the language in which to order pages. Ordering is done in a drag and drop tree view. <http://wordpress.org/extend/plugins/cms-tree-page-view/>
7,918
<p>I want to extract the first oEmbed url inserted on the content of a post in order to put in a meta tag from the header, or elsewhere as a way to style it differently from the rest of the content.</p>
[ { "answer_id": 7924, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>Try this:</p>\n\n<pre><code>function get_first_oembed($id) {\n\n $meta = get_post_custom($id);\n\n foreach ($me...
2011/01/27
[ "https://wordpress.stackexchange.com/questions/7918", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2201/" ]
I want to extract the first oEmbed url inserted on the content of a post in order to put in a meta tag from the header, or elsewhere as a way to style it differently from the rest of the content.
I assume that you're only interested in the first URL that actually succeeds at discovering actual oembed data. The oembed system processes all links it finds, but not every link will have oembed going for it, obviously. The filter you'll want to use is embed\_oembed\_html and it gets the HTML cached by oembed, the ur...
7,919
<p>Hello I would like to know if there is a way to pull the contents of comments on a post to a separate page from wordpress. currently this is what i have, i'd like to replace with a function to pull the comments instead of pulling the link to the comments.</p> <pre><code>&lt;?php // Include Wordpress define('WP_USE...
[ { "answer_id": 7921, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": true, "text": "<p>add \nto your loop and replace it with the the_permalink() function something like this:</p>\n\n<pre><code>&lt;...
2011/01/27
[ "https://wordpress.stackexchange.com/questions/7919", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2772/" ]
Hello I would like to know if there is a way to pull the contents of comments on a post to a separate page from wordpress. currently this is what i have, i'd like to replace with a function to pull the comments instead of pulling the link to the comments. ``` <?php // Include Wordpress define('WP_USE_THEMES', false);...
add to your loop and replace it with the the\_permalink() function something like this: ``` <?php // Include Wordpress define('WP_USE_THEMES', false); require('./blog/wp-load.php'); ?> <div> <p style="font-size:18px;color:white;font-wieght:700;">Recently Asked Questions</p> <?php query_posts('showposts=3'); ?> <?php...
7,922
<p>I use the permalink structure /%post_id%/%postname% because I have user submitted content. The problem is that %postname% still auto-increments itself and looks funny, even though the post id makes it unique. Is there a way to disable %postname% auto-incrementing?</p> <p>domain.com/634/apple-pie<br> domain.com/635/...
[ { "answer_id": 7926, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>Try this:</p>\n\n<pre><code>add_filter('wp_insert_post_data', 'remove_slug_suffix');\n\nfunction remove_slug_suffix($...
2011/01/27
[ "https://wordpress.stackexchange.com/questions/7922", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2771/" ]
I use the permalink structure /%post\_id%/%postname% because I have user submitted content. The problem is that %postname% still auto-increments itself and looks funny, even though the post id makes it unique. Is there a way to disable %postname% auto-incrementing? domain.com/634/apple-pie domain.com/635/apple-pie-...
Hi **@Thompson:** Unfortunately **the post name *must* be unique for a given post type**, and hierarchy level if the post type is hierarchical. There are a couple ways to address this: 1. Use `/%post_id%-%postname%/` instead of `/%post_id%/%postname%/`; that makes it unique and thus won't append any annoying `-N`s ...
7,947
<p>My question is how do I customize the default WordPress login and register page without editing WP's core files. I'm thinking more along the lines of a functions.php code.</p> <p>Can anyone help me out by finding a tutorial or something? Remember, I don't want to edit the WP core files. Thanks!</p>
[ { "answer_id": 7954, "author": "markratledge", "author_id": 268, "author_profile": "https://wordpress.stackexchange.com/users/268", "pm_score": 2, "selected": false, "text": "<p>Good answers here: <a href=\"https://wordpress.stackexchange.com/questions/5787/how-do-i-change-the-logo-on-th...
2011/01/28
[ "https://wordpress.stackexchange.com/questions/7947", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2415/" ]
My question is how do I customize the default WordPress login and register page without editing WP's core files. I'm thinking more along the lines of a functions.php code. Can anyone help me out by finding a tutorial or something? Remember, I don't want to edit the WP core files. Thanks!
Here's my functions.php that you can copy the functions. My CSS is admittedly thrown together fast and could be neater. I'm in a hurried launch phase right now. But you can use the functions. The first adds css to your head of the login page to override the styles. The later two functions change the url and title attri...
7,957
<p>I downloaded various themes on net and I found on <code>functions.php</code> they write something like this</p> <p>Example to remove inline comment style.</p> <pre><code>function demo_remove_recent_comments_style() { add_filter( 'show_recent_comments_widget_style', '__return_false' ); } add_action( 'widgets_in...
[ { "answer_id": 7958, "author": "joelhaus", "author_id": 164, "author_profile": "https://wordpress.stackexchange.com/users/164", "pm_score": 0, "selected": false, "text": "<p>Without more context, it's difficult to know exactly why, but generally, this might offer a marginal improvement t...
2011/01/28
[ "https://wordpress.stackexchange.com/questions/7957", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2163/" ]
I downloaded various themes on net and I found on `functions.php` they write something like this Example to remove inline comment style. ``` function demo_remove_recent_comments_style() { add_filter( 'show_recent_comments_widget_style', '__return_false' ); } add_action( 'widgets_init', 'demo_remove_recent_comment...
It is not always *required* technically but it is *good practice* to follow for multiple reasons: 1. Code is more organized by keeping hook-related stuff together 2. The more precise conditions when it runs - the better for performance 3. It is easier to unhook function, that performs multiple *add*\_, then unhook eac...
7,968
<p>I search on this site and found many <a href="https://wordpress.stackexchange.com/search?q=wp_nav_menu">answers</a> for this question. Most of them is not working on my theme. </p> <p>Here is a one solution I <a href="http://techblog.willshouse.com/2011/01/15/how-to-remove-the-container-with-the-wp_nav_menu-functio...
[ { "answer_id": 7969, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 5, "selected": true, "text": "<p>The function wp_nav_menu takes an argument of fallback_cb which is the name of the function to run if the menu ...
2011/01/28
[ "https://wordpress.stackexchange.com/questions/7968", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2163/" ]
I search on this site and found many [answers](https://wordpress.stackexchange.com/search?q=wp_nav_menu) for this question. Most of them is not working on my theme. Here is a one solution I [found](http://techblog.willshouse.com/2011/01/15/how-to-remove-the-container-with-the-wp_nav_menu-function/) and it's working a...
The function wp\_nav\_menu takes an argument of fallback\_cb which is the name of the function to run if the menu doesn't exist. so change you code to something like this: ``` function wp_nav_menu_no_ul() { $options = array( 'echo' => false, 'container' => false, 'theme_location' => 'primar...
7,984
<p>Is WordPress adding anchor tags automatically? I'm really puzzled, this is the code:</p> <p><strong>home.php</strong></p> <pre><code>&lt;div class="post-bottom"&gt; &lt;?php if ( count( get_the_category() ) ) : ?&gt; &lt;span class="cat-links"&gt; &lt;?php printf( __( 'Posted in %2$s', 'twentyten' ), '...
[ { "answer_id": 7985, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 3, "selected": true, "text": "<p>Hi <strong>@janoChen:</strong></p>\n\n<p>The function <code>get_the_category_list()</code> in <code>/wp-includes/...
2011/01/28
[ "https://wordpress.stackexchange.com/questions/7984", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
Is WordPress adding anchor tags automatically? I'm really puzzled, this is the code: **home.php** ``` <div class="post-bottom"> <?php if ( count( get_the_category() ) ) : ?> <span class="cat-links"> <?php printf( __( 'Posted in %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_t...
Hi **@janoChen:** The function `get_the_category_list()` in `/wp-includes/category-template.php` adds the anchors that you are asking about. You can find it on line 175 in WordPress v3.0.4. I also notice that you posted what looks like an object inspector from Chrome or Safari. Sometimes when the code that is output ...
7,991
<p>I try to change the main loop in such a way: I have a meta key for displaying featured items, that should be shown only on the home page of the a blog. I pull them in a code separate from the main loop, something like - </p> <pre><code>$leading = get_posts('showposts=5&amp;meta_key=_pull_leading3&amp;meta_value=on'...
[ { "answer_id": 8015, "author": "goldenapples", "author_id": 290, "author_profile": "https://wordpress.stackexchange.com/users/290", "pm_score": 2, "selected": true, "text": "<p>I think this will do what you want. But I still wonder whether sticky posts wouldn't have been better...</p>\n\...
2011/01/28
[ "https://wordpress.stackexchange.com/questions/7991", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2063/" ]
I try to change the main loop in such a way: I have a meta key for displaying featured items, that should be shown only on the home page of the a blog. I pull them in a code separate from the main loop, something like - ``` $leading = get_posts('showposts=5&meta_key=_pull_leading3&meta_value=on'); foreach (...
I think this will do what you want. But I still wonder whether sticky posts wouldn't have been better... ``` if (is_home() && $paged == '0') { //$paged value is 0 on 1st page and not 1 ! query_posts('posts_per_page=7&paged='.$paged.'&meta_key=_pull_leading3&meta_value=off'); ...
8,002
<p>How do I customize how my theme shows up in the list of available themes in the Admin console, under the "Appearance" -> "Themes" section. I need to change stuff like the theme name, author, and description.</p>
[ { "answer_id": 8003, "author": "Please treat your mods well.", "author_id": 2788, "author_profile": "https://wordpress.stackexchange.com/users/2788", "pm_score": 1, "selected": false, "text": "<p>You mean under Admin->Presentation->Themes? Then it is like <a href=\"http://computeraxe.com...
2011/01/28
[ "https://wordpress.stackexchange.com/questions/8002", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2787/" ]
How do I customize how my theme shows up in the list of available themes in the Admin console, under the "Appearance" -> "Themes" section. I need to change stuff like the theme name, author, and description.
You need to create a `screenshot.png` and store it in the theme directory. See the directory for the TwentyTen theme: [![Screenshot of WordPress TwentyTen theme directory](https://i.stack.imgur.com/VDWXG.png)](https://i.stack.imgur.com/VDWXG.png) (source: [mikeschinkel.com](https://mikeschinkel.com/websnaps/skitch...
8,006
<p>I tried to have a siderbar registered at the "init" hook based on a variable from the theme options array indicating whether the sidebar should be used in the design.</p> <p>Now it appears that that the condition works fine (tested with some other code) but if I use</p> <p><code>add_action( 'init', 'register_sideb...
[ { "answer_id": 8007, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 1, "selected": false, "text": "<p>I found this on the codex</p>\n\n<blockquote>\n <p>You can only use conditional query tags on or after the in...
2011/01/28
[ "https://wordpress.stackexchange.com/questions/8006", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I tried to have a siderbar registered at the "init" hook based on a variable from the theme options array indicating whether the sidebar should be used in the design. Now it appears that that the condition works fine (tested with some other code) but if I use `add_action( 'init', 'register_sidebar_x' );` or `add_acti...
I found this on the codex > > You can only use conditional query tags on or after the init action hook in WordPress. For themes, this means the conditional tag will never work properly if you are using it in the body of functions.php, i.e. outside of a function. > > > update ------ you don't need to hook the reg...
8,008
<p>I tired to use <code>isset($queryvar)</code> but that didnt work, so I implemented my own function <code>qv_isset</code>, but it runs into a problem when <code>$ch</code> is set to 0.</p> <pre><code>$cls = get_query_var('cls'); $ch = get_query_var('ch'); function qv_isset($var) { if($var == '') { return false;...
[ { "answer_id": 8010, "author": "Backie", "author_id": 2596, "author_profile": "https://wordpress.stackexchange.com/users/2596", "pm_score": 2, "selected": false, "text": "<p>You'll want to use <strong>empty</strong>, isset failed because you just set the variable. An empty value is still...
2011/01/28
[ "https://wordpress.stackexchange.com/questions/8008", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1878/" ]
I tired to use `isset($queryvar)` but that didnt work, so I implemented my own function `qv_isset`, but it runs into a problem when `$ch` is set to 0. ``` $cls = get_query_var('cls'); $ch = get_query_var('ch'); function qv_isset($var) { if($var == '') { return false; } else { return true; } } if(qv_isset($c...
use the [indentical](http://php.net/manual/en/language.operators.comparison.php) comparison operator: ``` if(get_query_var('cls') !== '' && get_query_var('ch') !== '') { mcs_textbook_chapter($dialect, $cls, $ch); } elseif(get_query_var('cls') !== '') { mcs_textbook_chapter($dialect, $cls); } else...
8,031
<p>I'm using the following code to retrieve posts:</p> <pre><code>&lt;?php $featuredPosts = new WP_Query(); $featuredPosts-&gt;query('showposts=5&amp;cat=3'); while ($featuredPosts-&gt;have_posts()) : $featuredPosts-&gt;the_post(); ?&gt; &lt;h1&gt;&lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title...
[ { "answer_id": 8032, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 4, "selected": true, "text": "<p>Hi <strong>@janoChen:</strong></p>\n\n<p>Simple answer: <em>no.</em> </p>\n\n<p>What follows is what the PHP cod...
2011/01/29
[ "https://wordpress.stackexchange.com/questions/8031", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
I'm using the following code to retrieve posts: ``` <?php $featuredPosts = new WP_Query(); $featuredPosts->query('showposts=5&cat=3'); while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); ?> <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1> <div class="meta"> By <?ph...
Hi **@janoChen:** Simple answer: *no.* What follows is what the PHP code for the function `wp_reset_query()` from `/wp-includes/query.php` in WordPRess v3.0.4 as well as the functions subsequently called. You can see that it's primarily about in modifying global variables. When you use `new WP_Query($args)` you wi...
8,040
<p>I've read several topics about this and different people have different views on the best practice.</p> <p>In terms of WordPress, how do I write data to the database the safest way?</p> <p>This is one insert I'm using now:</p> <pre><code>$result = $wpdb-&gt;insert( $table_name , array( 'arena' ...
[ { "answer_id": 8041, "author": "Backie", "author_id": 2596, "author_profile": "https://wordpress.stackexchange.com/users/2596", "pm_score": 2, "selected": true, "text": "<p>No the sanitization is already done. Well the <a href=\"http://php.net/mysql_real_escape_string\" rel=\"nofollow\">...
2011/01/29
[ "https://wordpress.stackexchange.com/questions/8040", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1447/" ]
I've read several topics about this and different people have different views on the best practice. In terms of WordPress, how do I write data to the database the safest way? This is one insert I'm using now: ``` $result = $wpdb->insert( $table_name , array( 'arena' => $galleryData['arena']...
No the sanitization is already done. Well the [mysql\_real\_escape\_string](http://php.net/mysql_real_escape_string) is done, it's considered bad form to filter html on input. I personally think doing it on output kinda breaches DRY. If you did in WordPress I highly suspect somewhere else will do it again resulting in ...
8,058
<p>I want to use <code>next_post_link</code> and <code>prev_post_link</code> to return only the next post in my custom taxonomy of a custom post type. I have a custom post type called "work_posts" which has the taxonomy "work_categories" assigned. The category I want to show is called 'all'. I looked up <code>get_adjac...
[ { "answer_id": 8052, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<h1>WordPress User Guide</h1>\n\n<p>By <a href=\"http://davidcoveney.com/\" rel=\"nofollow\">David Coveney</a>, director...
2011/01/29
[ "https://wordpress.stackexchange.com/questions/8058", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2554/" ]
I want to use `next_post_link` and `prev_post_link` to return only the next post in my custom taxonomy of a custom post type. I have a custom post type called "work\_posts" which has the taxonomy "work\_categories" assigned. The category I want to show is called 'all'. I looked up `get_adjacent_post` in the "link-templ...
Digging into WordPress ====================== By [Jeff Starr](http://perishablepress.com/) and [Chris Coyier](http://chriscoyier.net/) of [popular WordPress blog by same name](http://digwp.com/). > > From your first steps of learning > about WordPress all the way through > maintaining a site throughout the > year...
8,064
<p>I want to know the correct way to load existing scripts in <code>wp-includes/js/jquery/</code></p> <p>Example I want to load <code>jQuery UI Tabs</code></p> <p>What I have done for now </p> <pre><code>function sample_exists_code() { echo '&lt;script type="text/javascript" src="'. CONSTANTS_JS .'/jquery.js"&gt;...
[ { "answer_id": 8052, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<h1>WordPress User Guide</h1>\n\n<p>By <a href=\"http://davidcoveney.com/\" rel=\"nofollow\">David Coveney</a>, director...
2011/01/29
[ "https://wordpress.stackexchange.com/questions/8064", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2163/" ]
I want to know the correct way to load existing scripts in `wp-includes/js/jquery/` Example I want to load `jQuery UI Tabs` What I have done for now ``` function sample_exists_code() { echo '<script type="text/javascript" src="'. CONSTANTS_JS .'/jquery.js"></script>'."\n"; echo '<script type="text/javascript...
Digging into WordPress ====================== By [Jeff Starr](http://perishablepress.com/) and [Chris Coyier](http://chriscoyier.net/) of [popular WordPress blog by same name](http://digwp.com/). > > From your first steps of learning > about WordPress all the way through > maintaining a site throughout the > year...
8,067
<p>I am adding a meta box in the create post/page interface and I want to get the ID of the post being edited/created so I can dynamically display the value of the input field.</p> <p>From the <a href="http://codex.wordpress.org/Function_Reference/add_meta_box" rel="nofollow noreferrer">WordPress codex</a> : </p> <pr...
[ { "answer_id": 8071, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 4, "selected": true, "text": "<p>Try <code>get_the_ID()</code> or <code>global $post; $post-&gt;ID</code>.</p>\n" }, { "answer_id": 8073, "...
2011/01/29
[ "https://wordpress.stackexchange.com/questions/8067", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1649/" ]
I am adding a meta box in the create post/page interface and I want to get the ID of the post being edited/created so I can dynamically display the value of the input field. From the [WordPress codex](http://codex.wordpress.org/Function_Reference/add_meta_box) : ``` /* Prints the box content */ function myplugin_inn...
Try `get_the_ID()` or `global $post; $post->ID`.
8,077
<p>I am currently using a plug-in called Wishlist member. It allows you to create membership levels in WordPress. I want to be able to display different content on a page depending on the membership level of the viewing user. Something like this - </p> <pre><code>&lt;?php global $current_user; get_currentuserinfo();...
[ { "answer_id": 8080, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>there is a lot of discussion about this in wishlisMembers support forum\nbut the developers over there ignore i...
2011/01/29
[ "https://wordpress.stackexchange.com/questions/8077", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2289/" ]
I am currently using a plug-in called Wishlist member. It allows you to create membership levels in WordPress. I want to be able to display different content on a page depending on the membership level of the viewing user. Something like this - ``` <?php global $current_user; get_currentuserinfo(); if ($current_user...
there is a lot of discussion about this in wishlisMembers support forum but the developers over there ignore it. Any way try this: ``` // get the current user level from WP more important is global $user. $user = wp_get_current_user(); // Get user levels from WishlistMembers $levels = WLMAPI::GetUserLevels($user->ID...
8,081
<p>I have finally!! got this thing I've tried about 12 times to make and 12 different ways, but finally got it to work,... sort of.</p> <p>I made a custom metabox for uploading and attaching images to posts, and it doesn't require you to use the horrible thickbox media uploader built into WP. I hate that thing. No, wh...
[ { "answer_id": 8082, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 4, "selected": true, "text": "<p>Hi <strong>@jaredwilli:</strong></p>\n\n<p>Dude! Valiant effort, and nice work. All-in-all it could be a great ad...
2011/01/29
[ "https://wordpress.stackexchange.com/questions/8081", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1366/" ]
I have finally!! got this thing I've tried about 12 times to make and 12 different ways, but finally got it to work,... sort of. I made a custom metabox for uploading and attaching images to posts, and it doesn't require you to use the horrible thickbox media uploader built into WP. I hate that thing. No, what I've do...
Hi **@jaredwilli:** Dude! Valiant effort, and nice work. All-in-all it could be a great addition to WordPress. You were so close, but you had somewhere between 5 and 10 little failed assumptions or code that looks like you started it but didn't get back to it because it wasn't working. I reworked your function only a...
8,083
<p>I searched high and low for a plugin that can remove/hide Admin menu items , including custom post types and taxonomies, based on user role.</p> <p>Every one I have tried only does a global hide, not based on user role. Other more complex ones like adminize do not display custom post types or taxonomies.</p> <p>Do...
[ { "answer_id": 8084, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 1, "selected": false, "text": "<p>Hi <strong>@Wyck:</strong></p>\n\n<p>I can definitely appreciate your needs; I've had clients ask for the same. ...
2011/01/30
[ "https://wordpress.stackexchange.com/questions/8083", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1509/" ]
I searched high and low for a plugin that can remove/hide Admin menu items , including custom post types and taxonomies, based on user role. Every one I have tried only does a global hide, not based on user role. Other more complex ones like adminize do not display custom post types or taxonomies. Do I have to write ...
Update: ------- reading mike's answer again got me thinking that you can add a new capability to a role and use that as you removal condition, so: ``` // first add your role the capability like so // get the "author" role object $role = get_role( 'administrator' ); // add "see_all_menus" to this role obj...
8,103
<p>I've already read what I can on a couple of sites and installed this plug-in:</p> <p><a href="http://en.support.wordpress.com/code/posting-source-code/" rel="nofollow noreferrer">http://en.support.wordpress.com/code/posting-source-code/</a></p> <p><a href="http://alexgorbatchev.com/SyntaxHighlighter/" rel="nofollo...
[ { "answer_id": 8114, "author": "scribu", "author_id": 205, "author_profile": "https://wordpress.stackexchange.com/users/205", "pm_score": 3, "selected": true, "text": "<p>I use a similar plugin called WP Syntax, which works better, in my experience, so I'm going to answer for that one:</...
2011/01/30
[ "https://wordpress.stackexchange.com/questions/8103", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2550/" ]
I've already read what I can on a couple of sites and installed this plug-in: <http://en.support.wordpress.com/code/posting-source-code/> <http://alexgorbatchev.com/SyntaxHighlighter/> I'm missing how to make it work. Now I have two questions: 1. Do I have to type in the Visual window or the HTML window? 2. Does Ti...
I use a similar plugin called WP Syntax, which works better, in my experience, so I'm going to answer for that one: > > Question 1: Do I have to type in the Visual window or the HTML window? > > > In the HTML window. I prefer the `<pre lang="php">` mode. > > Question 2: Does TinyMCE mess with this? > > > Ye...
8,108
<p>I'm using PHP Exec to build a widget to show a list of upcoming events:</p> <pre><code>&lt;?php function filter_whene($whene = '') { $whene .= " AND post_date &gt;= '" . date('Y-m-d') . "' "; return $whene; } add_filter('posts_whene', 'filter_whene'); query_posts('cat=10&amp;showposts=3&amp;'); if ( have_post...
[ { "answer_id": 8109, "author": "ariefbayu", "author_id": 127, "author_profile": "https://wordpress.stackexchange.com/users/127", "pm_score": 0, "selected": false, "text": "<p>This doesn't directly answered your question. I use this snippet on my sidebar, to get future posts:</p>\n\n<pre>...
2011/01/30
[ "https://wordpress.stackexchange.com/questions/8108", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2816/" ]
I'm using PHP Exec to build a widget to show a list of upcoming events: ``` <?php function filter_whene($whene = '') { $whene .= " AND post_date >= '" . date('Y-m-d') . "' "; return $whene; } add_filter('posts_whene', 'filter_whene'); query_posts('cat=10&showposts=3&'); if ( have_posts() ) : while ( have_posts()...
Hi **@user2816:** It would seem you are using that code in more than one widget? Try changing part of that code from these: ``` function filter_whene($whene = '') { $whene .= " AND post_date >= '" . date('Y-m-d') . "' "; return $whene; } add_filter('posts_whene', 'filter_whene'); ``` To this: ``` if (!function...
8,128
<p>I've created a plugin.<br> In this plugin I have a function that will display some data.<br> In this function I use <code>is_admin()</code> to determine if the function is being called from the backend, because then I can add some additional information.</p> <p>In an admin page, the function is loaded normaly. Afte...
[ { "answer_id": 8130, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 1, "selected": false, "text": "<p>Is it possible that you are not adding the jQuery() within an <code>'init'</code> or <code>'admin_init'</code>; ...
2011/01/30
[ "https://wordpress.stackexchange.com/questions/8128", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1447/" ]
I've created a plugin. In this plugin I have a function that will display some data. In this function I use `is_admin()` to determine if the function is being called from the backend, because then I can add some additional information. In an admin page, the function is loaded normaly. After an update using jQuer...
Is it possible that you are not adding the jQuery() within an `'init'` or `'admin_init'`; my guess is *'yes'*. Further, if you use an `'admin_init'` hook you won't need to call `is_admin()`. Better yet, here's an answer about best practices when using jQuery within WordPress: * [**What is the best way to add custom j...
8,137
<p>I'm working on the admin interface for a plugin I'm developing, and it involves collapsible layouts. I want the state of the layout to be remembered when the page is refreshed, so I'm trying to use some simple cookies to do so.</p> <p>In the interface, there are "collapse" buttons that collapse sections of the admi...
[ { "answer_id": 8138, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 0, "selected": false, "text": "<p>You don’t have to delete it, just change the value to false or set an expired date.</p>\n" }, { "answe...
2011/01/30
[ "https://wordpress.stackexchange.com/questions/8137", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2418/" ]
I'm working on the admin interface for a plugin I'm developing, and it involves collapsible layouts. I want the state of the layout to be remembered when the page is refreshed, so I'm trying to use some simple cookies to do so. In the interface, there are "collapse" buttons that collapse sections of the admin panel. W...
``` if (getCookie($(this).attr("id")) == true) { ``` The above code will NEVER evaluate as true because cookie values are stored as strings. You are trying to store a boolean value, which is converted to a string when it is written to the cookie. When the browser reads the cookie value, it is also read as a string. ...
8,139
<p>I am working on one project for a client who has several multisite installed in wordpress. Site is working well but I am experiencing a warning message when I click the Video link in home page.The message is shown below:</p> <p><a href="http://www.rktron.devstars.net/uk/videos/" rel="nofollow">rocktron Uk</a></p> ...
[ { "answer_id": 8141, "author": "andrea_r", "author_id": 1391, "author_profile": "https://wordpress.stackexchange.com/users/1391", "pm_score": 0, "selected": false, "text": "<p>The error message states the cache is not writeable. That means you have to go check and change the permissions ...
2011/01/30
[ "https://wordpress.stackexchange.com/questions/8139", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2824/" ]
I am working on one project for a client who has several multisite installed in wordpress. Site is working well but I am experiencing a warning message when I click the Video link in home page.The message is shown below: [rocktron Uk](http://www.rktron.devstars.net/uk/videos/) ``` Warning: file_put_contents(cache/ecd...
Do you have any specific reason to use externally loaded SimplePie? WordPress comes with SimplePie bundled and has wrappers that properly integrate and set up caching for it. See [`fetch_feed()`](http://codex.wordpress.org/Function_Reference/fetch_feed) in Codex.
8,149
<p>Hey guys, thanks in advance for your help. I've done my research and I'm a bit stumped with this...</p> <p>I'm building a Wordpress website for a client and it is going to have an e-store. I'm using wp-ecommerce. All of the store pages are loading with a javascript error: </p> <p><a href="http://www.thecollectivec...
[ { "answer_id": 8150, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 3, "selected": true, "text": "<p>There are currently two copies of jQuery loaded on site:</p>\n\n<ol>\n<li>In header there is jQuery bundled with WordP...
2011/01/30
[ "https://wordpress.stackexchange.com/questions/8149", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2828/" ]
Hey guys, thanks in advance for your help. I've done my research and I'm a bit stumped with this... I'm building a Wordpress website for a client and it is going to have an e-store. I'm using wp-ecommerce. All of the store pages are loading with a javascript error: <http://www.thecollectiveclothingco.com/products-pa...
There are currently two copies of jQuery loaded on site: 1. In header there is jQuery bundled with WordPress, likely requested by some plugin. 2. In footer there is jQuery from Google CDN, likely added by your code? Obviously this is one too many. There are couple of ways to handle it: 1. If you are fine with using ...
8,152
<p>Trying to add a link to my admin menu (dashboard/backend) that leads to the frontend of wordpress, so I basically want a link in the menu that takes me to the blog. </p> <p>I've found a couple of ways to add new stuff to the admin menu, but I haven't been able to link to the home_url, it seems like the admin menu o...
[ { "answer_id": 8153, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>The name of site (top left, next to WP logo) links to front-end, is that not sufficient?</p>\n\n<p>Also it would help...
2011/01/30
[ "https://wordpress.stackexchange.com/questions/8152", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2830/" ]
Trying to add a link to my admin menu (dashboard/backend) that leads to the frontend of wordpress, so I basically want a link in the menu that takes me to the blog. I've found a couple of ways to add new stuff to the admin menu, but I haven't been able to link to the home\_url, it seems like the admin menu only is de...
you can create a function that redirects to the front-end like this: ``` function redirect_home_987(){ wp_redirect( home_url() ); exit; } ``` and call that function in WordPress default add\_menu\_page function like this: ``` add_menu_page( 'redirecting', 'View Site', 'read', 'my-top-level-handle', 'redirect_h...
8,154
<p>I have a all my custom post types list together in blog format. What I'm trying to do is echo the post type name on each post.</p> <p>I tried this:</p> <pre><code>get_post_type_object('post'); echo $obj-&gt;labels-&gt;singular_name; </code></pre> <p>But it just displayed "Post" for everything instead of the custo...
[ { "answer_id": 8155, "author": "epaps", "author_id": 2347, "author_profile": "https://wordpress.stackexchange.com/users/2347", "pm_score": 5, "selected": true, "text": "<p>If you are within The Loop, try:</p>\n\n<pre><code>$post_type = get_post_type( $post-&gt;ID );\necho $post_type;\n</...
2011/01/30
[ "https://wordpress.stackexchange.com/questions/8154", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2832/" ]
I have a all my custom post types list together in blog format. What I'm trying to do is echo the post type name on each post. I tried this: ``` get_post_type_object('post'); echo $obj->labels->singular_name; ``` But it just displayed "Post" for everything instead of the custom post type name
If you are within The Loop, try: ``` $post_type = get_post_type( $post->ID ); echo $post_type; ``` Does this work for you?
8,157
<p>I think I'm on the right track with what I need to do, at least for doing one of the ways it could be done. I'm not really sure though, I could be way off for all I know.</p> <p>This is part of the code I needed help with last night for resizing the uploaded image files, but now I am trying to figure out how to use...
[ { "answer_id": 8179, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": false, "text": "<p>It looks like you are trying to call WordPress function directly form JQuery so that won't work.\nwhat you can...
2011/01/30
[ "https://wordpress.stackexchange.com/questions/8157", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1366/" ]
I think I'm on the right track with what I need to do, at least for doing one of the ways it could be done. I'm not really sure though, I could be way off for all I know. This is part of the code I needed help with last night for resizing the uploaded image files, but now I am trying to figure out how to use the wp\_d...
I have finally figured out how to do it, and it now works 100%!! Plus it uses the admin-ajax.php so clicking the Remove link there is an ajax request sent to the function that does the deleting of the attachment and returns the message saying it has been deleted. Here's the code for my solution, first is the html for...
8,164
<p>When someone creates a post in a custom post type and uploads an image the Link URL box shows it as the attachment URL. What I would like is for it to be the permalink to the post. Is there a way to do it without modifying core files?</p>
[ { "answer_id": 8178, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 1, "selected": false, "text": "<p>On the media uploader, Once an image is uploaded , before you click the \"insert to post\"\nyou need to click ...
2011/01/31
[ "https://wordpress.stackexchange.com/questions/8164", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2832/" ]
When someone creates a post in a custom post type and uploads an image the Link URL box shows it as the attachment URL. What I would like is for it to be the permalink to the post. Is there a way to do it without modifying core files?
Thanks for answering the comments and thanks to @בניית אתרים providing the screenshot; now I have a better idea of what you wanted. Based on what you asked for I think what would be ideal would be for the dialog box to simple generate your preferred URL; that way you don't have to remember to click. You can accomplish...
8,165
<p>Tim thumb script is working fine, My issue is with absolute path and relative path. </p> <p>when i give relative path, i get the output. but when i use the absolute path, i am getting 403 forbidden error. </p> <p>I would like to use absolute path. Pleas advise</p> <p><a href="http://crizaze.com/wp-content/themes/...
[ { "answer_id": 8166, "author": "Evan Yeung", "author_id": 1878, "author_profile": "https://wordpress.stackexchange.com/users/1878", "pm_score": 1, "selected": false, "text": "<p>I would like to know what absolute path you are using, but this should work. Of course you may have to do some...
2011/01/31
[ "https://wordpress.stackexchange.com/questions/8165", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
Tim thumb script is working fine, My issue is with absolute path and relative path. when i give relative path, i get the output. but when i use the absolute path, i am getting 403 forbidden error. I would like to use absolute path. Pleas advise <http://crizaze.com/wp-content/themes/joorang/timthumb.php?src=/wp-con...
I always do this with Timthumb: ``` // this is the absolute path $url = 'http://crizaze.com/wp-content/themes/joorang/wp-content/uploads/2011/01/ami166a-e1295733091216.jpg'; // convert it into relative path $url = str_replace(get_bloginfo('url'), '', $url); // get the image url, resized by timthumb $timthumb_url = g...
8,168
<p>I am using a static front page for my blog to which I have added a widgetized sidebar area to hold an RSS feed widget. I want to show summaries of the latest two or three blog posts on the front page, but I am having problems with the RSS widget not updating.</p> <p>For example, within the RSS widget set-up field, ...
[ { "answer_id": 8172, "author": "markratledge", "author_id": 268, "author_profile": "https://wordpress.stackexchange.com/users/268", "pm_score": 2, "selected": false, "text": "<p>Better to use a query loop to show posts, which is a modifed version of the main WP loop. This query loop won'...
2011/01/31
[ "https://wordpress.stackexchange.com/questions/8168", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2242/" ]
I am using a static front page for my blog to which I have added a widgetized sidebar area to hold an RSS feed widget. I want to show summaries of the latest two or three blog posts on the front page, but I am having problems with the RSS widget not updating. For example, within the RSS widget set-up field, the RSS fi...
Better to use a query loop to show posts, which is a modifed version of the main WP loop. This query loop won't interfere with the main WP loop and can be used mutiple times in a sidebar or post/page with php execution enabled. Use a php widget in your sidebar: [WordPress › PHP Code Widget « WordPress Plugins](http://w...
8,170
<p>I am looking to display different content after a user registers. Is there a way to find out the registration date and then if it's been 1 day display one thing, but if it's been 2 days display something else?</p> <p>Something like this, but based on the registration date and not a post entry date:</p> <pre><code...
[ { "answer_id": 8174, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 4, "selected": true, "text": "<p>Yes you can!</p>\n\n<pre><code>&lt;?php \nget_currentuserinfo(); \n$user_data = get_userdata($user_ID);\n$regis...
2011/01/31
[ "https://wordpress.stackexchange.com/questions/8170", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2289/" ]
I am looking to display different content after a user registers. Is there a way to find out the registration date and then if it's been 1 day display one thing, but if it's been 2 days display something else? Something like this, but based on the registration date and not a post entry date: ``` <?php if (strtotime($...
Yes you can! ``` <?php get_currentuserinfo(); $user_data = get_userdata($user_ID); $registered_date = $user_data->user_registered; if (strtotime($registered_date) > strtotime('-30 days')){ //Text for users registered in the last 30 days } ?> ``` hope this helps
8,191
<p>I added the following to my <strong>functions.php</strong> file:</p> <pre><code>set_post_thumbnail_size( 500, 500); </code></pre> <p>I enabled <strong>featured image</strong> (<code>support =&gt; 'thumbnail'</code>) in a custom post type a created (called Page Content).</p> <p>When I set an image as featured imag...
[ { "answer_id": 8195, "author": "janoChen", "author_id": 781, "author_profile": "https://wordpress.stackexchange.com/users/781", "pm_score": 1, "selected": false, "text": "<p>Using <code>&lt;?php the_post_thumbnail('large'); ?&gt;</code> instead of <code>&lt;?php the_post_thumbnail(); ?&g...
2011/01/31
[ "https://wordpress.stackexchange.com/questions/8191", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
I added the following to my **functions.php** file: ``` set_post_thumbnail_size( 500, 500); ``` I enabled **featured image** (`support => 'thumbnail'`) in a custom post type a created (called Page Content). When I set an image as featured image (the image I'm using has **500px** of height) , the image is always ren...
I think you are using a child theme of TwentyTen and in TwentyTen theme you have this line: ``` set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); ``` and HEADER\_IMAGE\_HEIGHT is 198px.
8,193
<p>I have a blog created with wordpress, now i have a problem. Attackers writes javascript codes into my files. </p> <p>Let's assume i have holes in my plugin scripts, but how can they write into php files?</p> <p>here is part of the list of php files, in which they write the script (<code>index.php, wp-activate.php...
[ { "answer_id": 8194, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 3, "selected": false, "text": "<p>Hi <strong>@Syom:</strong></p>\n\n<p>Often hackers get access because you use the name <em>\"admin\"</em> for yo...
2011/01/31
[ "https://wordpress.stackexchange.com/questions/8193", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2845/" ]
I have a blog created with wordpress, now i have a problem. Attackers writes javascript codes into my files. Let's assume i have holes in my plugin scripts, but how can they write into php files? here is part of the list of php files, in which they write the script (`index.php, wp-activate.php, wp-comments-post.php...
Hi **@Syom:** Often hackers get access because you use the name *"admin"* for your administrator and you have an easy to hack password. Or because you don't update your software and they leverage some of the security holes that have been found and patched. Here's a set of slides that go indepth to explaining how to s...
8,197
<p>I have a situation where I need to hide a specific category and it's children from users who are logged in as Contributors. I don't want them to see this category and it's children in the categories meta-box on the add new post screen. </p> <p>I can't find a plugin (that works) to do this, wondering if someone else...
[ { "answer_id": 8199, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 3, "selected": false, "text": "<p>Hi <strong>@davemac:</strong></p>\n\n<p>Well, I wrote this before I saw that you answered your own question so I...
2011/01/31
[ "https://wordpress.stackexchange.com/questions/8197", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/131/" ]
I have a situation where I need to hide a specific category and it's children from users who are logged in as Contributors. I don't want them to see this category and it's children in the categories meta-box on the add new post screen. I can't find a plugin (that works) to do this, wondering if someone else knows of ...
**Working Example in Oct 2020**, Working answer, I went to different answers none of them works now in new WordPress. ``` function hide_categories_for_specific_user( $exclusions, $args ){ if ( ((defined( 'REST_REQUEST' ) && REST_REQUEST) or $GLOBALS['pagenow'] === 'edit.php' ) && !current_user_can( 'manage_options' )...
8,202
<p>Have multisite set up and would like to redirect users on logout to the root site home page. I know there has to be an answer for this. But I can't find it! driving me batty;-) Any help greatly appreciated.</p>
[ { "answer_id": 8203, "author": "Pippin", "author_id": 2418, "author_profile": "https://wordpress.stackexchange.com/users/2418", "pm_score": 1, "selected": false, "text": "<p>use <code>wp_logout_url( $redirect );</code> $redirect is the url for them to be redirected to.</p>\n" }, { ...
2011/01/31
[ "https://wordpress.stackexchange.com/questions/8202", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2567/" ]
Have multisite set up and would like to redirect users on logout to the root site home page. I know there has to be an answer for this. But I can't find it! driving me batty;-) Any help greatly appreciated.
you can use `wp_logout_url( $redirect);` as Pippin sugested if you are echoing out the logout link and if you need it for the built-in logout link on the backend you can use: ``` //function to redirect after logout function logout_redirect765(){ wp_redirect( home_url() ); exit; } //hook function to wp_logout a...
8,212
<p>I need to grab a list of current events. The events have a start and end date so I need to be able to select a range as opposed to just getting any list of events that have an end date that is after today's date.</p> <p>Does anyone have any suggestions as to how to do this? (from what I've read there doesn't seem t...
[ { "answer_id": 8214, "author": "keatch", "author_id": 2727, "author_profile": "https://wordpress.stackexchange.com/users/2727", "pm_score": 1, "selected": false, "text": "<p>Not quite efficent, but you may do two query. </p>\n\n<p>One that extract the events that have a date greater than...
2011/01/31
[ "https://wordpress.stackexchange.com/questions/8212", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1462/" ]
I need to grab a list of current events. The events have a start and end date so I need to be able to select a range as opposed to just getting any list of events that have an end date that is after today's date. Does anyone have any suggestions as to how to do this? (from what I've read there doesn't seem to be a way...
You can use your current code to create the query and then in your loop run a check before displaying the events something like ``` <?php query_posts('meta_key' => 'end_date_value', 'meta_compare' => '>', 'meta_value' => $todaysDate); while ( have_posts() ) : the_post(); $post_custom = get_post_custom($post_id);...
8,240
<p>When I call the WordPress unzip_file() function below, instead of actually extracting the zip, it merely moves it into the target folder. </p> <p>When I trace $file and $to from includes/file.php I get:</p> <pre><code>file: C:\xampplite\htdocs\testsite/wp-content/themes/mytheme/styles/myzip.zip To: C:\xampplite\...
[ { "answer_id": 8270, "author": "Otto", "author_id": 2232, "author_profile": "https://wordpress.stackexchange.com/users/2232", "pm_score": 2, "selected": true, "text": "<p>Do you have a filesystem and setup that allows for direct access? If the filesystem object is expecting FTP credentia...
2011/01/31
[ "https://wordpress.stackexchange.com/questions/8240", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
When I call the WordPress unzip\_file() function below, instead of actually extracting the zip, it merely moves it into the target folder. When I trace $file and $to from includes/file.php I get: ``` file: C:\xampplite\htdocs\testsite/wp-content/themes/mytheme/styles/myzip.zip To: C:\xampplite\htdocs\testsite/wp-c...
Do you have a filesystem and setup that allows for direct access? If the filesystem object is expecting FTP credentials, then you may not get the results you're looking for without giving it the right username/password/server information.
8,247
<p>I have this function:</p> <pre><code>function get_image_link( &amp;$post ) { $image_link_meta = get_post_meta( $post-&gt;ID, 'as_link_to_image', true ); $image_link_from_post = ''; if ( function_exists( 'has_post_thumbnail' ) &amp;&amp; has_post_thumbnail( $post-&gt;ID ) ) { ...
[ { "answer_id": 8249, "author": "goldenapples", "author_id": 290, "author_profile": "https://wordpress.stackexchange.com/users/290", "pm_score": 0, "selected": false, "text": "<p>This line right here:</p>\n\n<pre><code>if ( !$attachment_image_link[0] )\n $image_link_from_post =...
2011/01/31
[ "https://wordpress.stackexchange.com/questions/8247", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1649/" ]
I have this function: ``` function get_image_link( &$post ) { $image_link_meta = get_post_meta( $post->ID, 'as_link_to_image', true ); $image_link_from_post = ''; if ( function_exists( 'has_post_thumbnail' ) && has_post_thumbnail( $post->ID ) ) { $attachment_image_link = wp_ge...
This should be able to return the url of the large image. ``` $largeImg = wp_get_attachment_link( $attachment_id, 'large', false ); ``` There's also this incase that doesn't work. ``` wp_get_attachment_image_src( $attachment_id, 'large' ); ```
8,252
<p>Im currently using <code>&lt;?php wp_list_categories('child_of=4&amp;title_li='); ?&gt;</code> to echo out a list of my categories. I'm wondering how I could append some html (specifically an &raquo; to the end of each LI within the link. </p> <p>See this screenshot for an example of what I'm trying to do:</p> <p...
[ { "answer_id": 8253, "author": "3Easy", "author_id": 2863, "author_profile": "https://wordpress.stackexchange.com/users/2863", "pm_score": 2, "selected": false, "text": "<p>It may make more sense to create the desired visual style using CSS alone. This keeps presentation separate from co...
2011/02/01
[ "https://wordpress.stackexchange.com/questions/8252", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2862/" ]
Im currently using `<?php wp_list_categories('child_of=4&title_li='); ?>` to echo out a list of my categories. I'm wondering how I could append some html (specifically an » to the end of each LI within the link. See this screenshot for an example of what I'm trying to do: <http://nikibrown.com/uploads/4662272c3f00c6...
I think this is the cleanest and WordPressiest way to do it: ``` <?php $menu_args = array( 'child_of' => '4', 'title_li' => '', 'link_after' => '&raquo;', ); wp_list_categories($menu_args); ?> ```
8,257
<blockquote> <p>publish_post Runs when a post is published, or if it is edited and its status is "published". Action function arguments: post ID.</p> </blockquote> <p>-<a href="http://codex.wordpress.org/Plugin_API/Action_Reference">Plugin API Documentation</a></p> <p>I've added the publish_post hook to a Wo...
[ { "answer_id": 8258, "author": "Pippin", "author_id": 2418, "author_profile": "https://wordpress.stackexchange.com/users/2418", "pm_score": 5, "selected": true, "text": "<pre><code>add_action('new_to_publish', 'your_function');\nadd_action('draft_to_publish', 'your_function');\nadd_actio...
2011/02/01
[ "https://wordpress.stackexchange.com/questions/8257", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/304/" ]
> > publish\_post Runs when a post is > published, or if it is edited and its > status is "published". Action function > arguments: post ID. > > > -[Plugin API Documentation](http://codex.wordpress.org/Plugin_API/Action_Reference) I've added the publish\_post hook to a WordPress plugin that I'm writing. The fu...
``` add_action('new_to_publish', 'your_function'); add_action('draft_to_publish', 'your_function'); add_action('pending_to_publish', 'your_function'); ```
8,260
<p>In child theme I created a functions.php file that loads scripts and style files, the code is below. The section that loads libraries and scripts to all pages other than admin, in other words the first two functions, works as expected. However, the third function, which is designed to load a script for a specific pa...
[ { "answer_id": 8263, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<p>The first things to check in such cases:</p>\n\n<ul>\n<li>is hooked function firing properly;</li>\n<li>is condition ...
2011/02/01
[ "https://wordpress.stackexchange.com/questions/8260", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2865/" ]
In child theme I created a functions.php file that loads scripts and style files, the code is below. The section that loads libraries and scripts to all pages other than admin, in other words the first two functions, works as expected. However, the third function, which is designed to load a script for a specific page ...
I'd suggest moving the script registering into the init action, and moving the enqueue(s) into a callback hooked onto `wp_print_scripts`. Eg. ``` add_action( 'init', 'register_those_scriptsNstyles' ); function register_those_scriptsNstyles() { wp_register_script( .. your script params .. ); wp_register_style...
8,267
<p>Hey. I've been trying to figure this out for a long time but can't seem to crack it.</p> <p>I have created a menu using Wordpress 3 menu editor and it's all fine and working.</p> <p>But I want to manually add an item (or few) to a submenu so that the item will only show up in the submenu if logged in user is admin...
[ { "answer_id": 8268, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 0, "selected": false, "text": "<p>Hi <strong>@fusse:</strong></p>\n\n<p>If you want the menu to be added only for an admin then really want you wa...
2011/02/01
[ "https://wordpress.stackexchange.com/questions/8267", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
Hey. I've been trying to figure this out for a long time but can't seem to crack it. I have created a menu using Wordpress 3 menu editor and it's all fine and working. But I want to manually add an item (or few) to a submenu so that the item will only show up in the submenu if logged in user is admin (can add\_users)...
the simplest way would be to create two menus on for admin and one for everyone else and display them based on that: ``` if (current_user_can('add_users')){ wp_nav_menu( array('menu' => 'My Admin Menu' )); }else{ wp_nav_menu( array('menu' => 'My Users Menu' )); } ```
8,276
<p>I want to list categories belonging to a parent. The problem is using category id's isn't useful and makes things harder to understand.</p> <p>Is there any easier way to list categories belonging to a parent, similar to the default way supplied in the WP codec?</p> <pre><code>&lt;?php wp_list_categories('child_of=...
[ { "answer_id": 8279, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 4, "selected": true, "text": "<p>You can get ID from slug quite easily:</p>\n\n<pre><code>$category = get_category_by_slug( 'clients' );\nwp_list_categ...
2011/02/01
[ "https://wordpress.stackexchange.com/questions/8276", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1956/" ]
I want to list categories belonging to a parent. The problem is using category id's isn't useful and makes things harder to understand. Is there any easier way to list categories belonging to a parent, similar to the default way supplied in the WP codec? ``` <?php wp_list_categories('child_of=8'); ?> //what category ...
You can get ID from slug quite easily: ``` $category = get_category_by_slug( 'clients' ); wp_list_categories('child_of='.$category->term_id); ```
8,285
<p>Hey, is it possible that i can put a chunk of code somewhere and it will show up after the more tag seperator but within the post ? </p> <p>I mean if i put more seperator after first paragraph then on post areas after that will show up the code i will put.. probably some html with a twitter and rss link.</p> <p>He...
[ { "answer_id": 8305, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 0, "selected": false, "text": "<p>You can use the_tags hook to add your code to the tags output like this:</p>\n\n<pre><code>function add_my_cod...
2011/02/01
[ "https://wordpress.stackexchange.com/questions/8285", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2419/" ]
Hey, is it possible that i can put a chunk of code somewhere and it will show up after the more tag seperator but within the post ? I mean if i put more seperator after first paragraph then on post areas after that will show up the code i will put.. probably some html with a twitter and rss link. Help is appreicated...
This will add your code after the `more` tag area on the post page: ```php add_filter('the_content', 'adds_block'); function adds_block($content) { if (is_single()) { // return $content; global $post; $thePostID = $post->ID; $test = '<span id="more-' .$thePostID.'"></span>'; ...
8,289
<p>Hi there is anyway to style the visual editor in WordPress. For example if the user selects the page template shop say it loads into the visual editor a preset template which divs and formatted text.</p> <p>Thanks very much.</p>
[ { "answer_id": 8305, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 0, "selected": false, "text": "<p>You can use the_tags hook to add your code to the tags output like this:</p>\n\n<pre><code>function add_my_cod...
2011/02/01
[ "https://wordpress.stackexchange.com/questions/8289", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
Hi there is anyway to style the visual editor in WordPress. For example if the user selects the page template shop say it loads into the visual editor a preset template which divs and formatted text. Thanks very much.
This will add your code after the `more` tag area on the post page: ```php add_filter('the_content', 'adds_block'); function adds_block($content) { if (is_single()) { // return $content; global $post; $thePostID = $post->ID; $test = '<span id="more-' .$thePostID.'"></span>'; ...
8,310
<p>I'm using CMS Press for custom post types. The issue is the feed doesn't validate because lastBuildDate is blank. I am not using WordPress's default posts for anything and that is causing the problem.</p> <p>I did a test post using WordPress's default post and voila lastBuildDate was filled in and the feed validate...
[ { "answer_id": 8314, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<p><code>lastBuildDate</code> is getting filled with data returned by <a href=\"http://codex.wordpress.org/Function_Refe...
2011/02/01
[ "https://wordpress.stackexchange.com/questions/8310", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2832/" ]
I'm using CMS Press for custom post types. The issue is the feed doesn't validate because lastBuildDate is blank. I am not using WordPress's default posts for anything and that is causing the problem. I did a test post using WordPress's default post and voila lastBuildDate was filled in and the feed validated. As soo...
This is the solution I found based off of @Rarst's answer. Put this in the themes functions.php and it worked like a charm! ``` add_filter('get_lastpostmodified', 'my_lastpostmodified'); function my_lastpostmodified() { global $wpdb; $add_seconds_server = date('Z'); return $wpdb->get_var("SELECT DATE_ADD(...
8,315
<p>I'm trying to stop Contact From 7 from adding paragraph and break tags to HTML emails but can't figure it out. About 4 blank paragraph tags are added at the beginning of the email and two at the end.</p> <p><a href="http://wordpress.org/support/topic/plugin-contact-form-7-auto-and-tags" rel="nofollow">This question...
[ { "answer_id": 8331, "author": "Keith Groben", "author_id": 2883, "author_profile": "https://wordpress.stackexchange.com/users/2883", "pm_score": 0, "selected": false, "text": "<p>This seems to be a bug with the contact form plugin. You may look at the plugin source files to see if there...
2011/02/01
[ "https://wordpress.stackexchange.com/questions/8315", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2429/" ]
I'm trying to stop Contact From 7 from adding paragraph and break tags to HTML emails but can't figure it out. About 4 blank paragraph tags are added at the beginning of the email and two at the end. [This question](http://wordpress.org/support/topic/plugin-contact-form-7-auto-and-tags) brings up the same issue, and t...
well if you updated and it didn't work, try doing the fix manually as per this [user](http://wordpress.org/support/profile/alhadis) > > "The solution I came up with was a serious hack, but there was no other way around it short of editing the plugin's core code. Just stick this somewhere in your theme's functions.p...
8,317
<p>I am trying to hook into activate_plugin. </p> <p>I know that activate_plugin has 1 required param and 2 optional ones. I am trying to acquire all 3.</p> <p>Here's my setup:</p> <pre><code>// create plugin settings menu add_action('admin_menu', 'pe_create_menu'); function pe_create_menu() { //create new sub-...
[ { "answer_id": 8318, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<p>What do you need <code>var_export()</code> for? <code>func_get_args()</code> should give you array of arguments on it...
2011/02/01
[ "https://wordpress.stackexchange.com/questions/8317", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2878/" ]
I am trying to hook into activate\_plugin. I know that activate\_plugin has 1 required param and 2 optional ones. I am trying to acquire all 3. Here's my setup: ``` // create plugin settings menu add_action('admin_menu', 'pe_create_menu'); function pe_create_menu() { //create new sub-level menu add_submenu_pa...
[The `activate_plugin()` function](http://core.trac.wordpress.org/browser/tags/3.0.4/wp-admin/includes/plugin.php#L466) accepts three parameters, but it emits the `activate_plugin` action with only one parameter. This can be confusing, but hooks sometimes use the same name as the function they come from, without passin...
8,319
<p>I've recently started using the <a href="http://wordpress.org/extend/plugins/hikari-hooks/" rel="nofollow noreferrer">Hikari Hooks</a> plugin for Wordpress as it seems to allow you to get a good idea of what do_actions are being called on the page, so that you can easily find out where potential hooks for plugin cod...
[ { "answer_id": 8323, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 1, "selected": false, "text": "<p>Note sure if this is a <em>better</em> way but I wrote a plugin to display the active hook on a page for this an...
2011/02/01
[ "https://wordpress.stackexchange.com/questions/8319", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/304/" ]
I've recently started using the [Hikari Hooks](http://wordpress.org/extend/plugins/hikari-hooks/) plugin for Wordpress as it seems to allow you to get a good idea of what do\_actions are being called on the page, so that you can easily find out where potential hooks for plugin code might lie. Are there better tools/pl...
It is usually easy to find most hooks in documentation or source. It can be much more tricky for hooks that are dynamically generated, like post transitions. Essentially it doesn't exist in source as specific hook - it is hook that is getting generated dynamically at runtime, depending on variables. ``` do_action("${o...
8,327
<p>This is a repost of a question asked on stackoverflow, and was referred to this site:</p> <p>My client wants to create a form on his new WP site that when filled out and submitted will be submitted to his admin post queue to approve and if he approves gets posted on his site in the "blog" (which is actually a bunch...
[ { "answer_id": 8329, "author": "Peter Rowell", "author_id": 1958, "author_profile": "https://wordpress.stackexchange.com/users/1958", "pm_score": 0, "selected": false, "text": "<p>I haven't checked it out, but <a href=\"http://wordpress.org/extend/plugins/anon-posting/\" rel=\"nofollow\"...
2011/02/02
[ "https://wordpress.stackexchange.com/questions/8327", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2881/" ]
This is a repost of a question asked on stackoverflow, and was referred to this site: My client wants to create a form on his new WP site that when filled out and submitted will be submitted to his admin post queue to approve and if he approves gets posted on his site in the "blog" (which is actually a bunch of guitar...
you can use plugins fro the front-end posting: * [Post From Site](http://wordpress.org/extend/plugins/post-from-site/) * [uCan Post](http://wordpress.org/extend/plugins/ucan-post/) * [WP User Frontend](http://wordpress.org/extend/plugins/wp-user-frontend/) Or you can create the form yourself ``` <!-- New Post Fo...
8,342
<p>The title pretty much explains exactly what I'm trying to do. If someone could help me out, that would be awesome. Thanks!</p> <p>:)</p>
[ { "answer_id": 8343, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>the correct way to include files for scripts you can use the hook \"admin_print_scripts\"</p>\n\n<p>and include...
2011/02/02
[ "https://wordpress.stackexchange.com/questions/8342", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2415/" ]
The title pretty much explains exactly what I'm trying to do. If someone could help me out, that would be awesome. Thanks! :)
the correct way to include files for scripts you can use the hook "admin\_print\_scripts" and include your scripts [with wp\_enqueue\_script()](http://codex.wordpress.org/Function_Reference/wp_enqueue_script) for example: ``` <?php add_action('admin_print_scripts','my_scripts'); function my_scripts(){ wp_enqueue...
8,349
<p>I just configured my VPS, I am using Centos, everything works fine, but if I am setting my permalinks to Custom Structure, then accept the homepage none of the posts come, it shows me 404 page, I think this is because I haven't enabled curl, but I don't know where is my php.ini file in my centos?</p> <p>OK my curl i...
[ { "answer_id": 8362, "author": "keatch", "author_id": 2727, "author_profile": "https://wordpress.stackexchange.com/users/2727", "pm_score": 2, "selected": false, "text": "<p>If you enable custom permalinks, wordpress is modifying your .htaccess file, to enable the rewrite of your urls.</...
2011/02/02
[ "https://wordpress.stackexchange.com/questions/8349", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1743/" ]
I just configured my VPS, I am using Centos, everything works fine, but if I am setting my permalinks to Custom Structure, then accept the homepage none of the posts come, it shows me 404 page, I think this is because I haven't enabled curl, but I don't know where is my php.ini file in my centos? OK my curl is enabled...
You need to add: Options +FollowSymLinks It's often but not always enabled in most hosting environments. We have a server that has it off by default for PCI compliance.
8,357
<p>I'm really having a few issues with inserting terms. Here is my scenario: I have a taxonomy called veda_release_type:</p> <pre><code>//Release Type and Region $labels = array( 'name'=&gt; _x('Release Types/Regions', 'taxonomy general name' ), 'singular_name' =&gt; _x('Release Type/R...
[ { "answer_id": 8361, "author": "t31os", "author_id": 31073, "author_profile": "https://wordpress.stackexchange.com/users/31073", "pm_score": 2, "selected": false, "text": "<p>You could possibly be receiving an object back from <code>term_exists($term, $taxonomy, $parent)</code> if the ta...
2011/02/02
[ "https://wordpress.stackexchange.com/questions/8357", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2234/" ]
I'm really having a few issues with inserting terms. Here is my scenario: I have a taxonomy called veda\_release\_type: ``` //Release Type and Region $labels = array( 'name'=> _x('Release Types/Regions', 'taxonomy general name' ), 'singular_name' => _x('Release Type/Region', 'taxonomy s...
The hierarchy is cached and it's not invalidated properly. This is a bug, still unresolved as of WP 3.1. A workaround would be to call `delete_option("{$taxonomy}_children");` directly. See the \_get\_term\_hierarchy() function.
8,375
<p>I am not sure how WordPress cache the queries. I had the impression that whenever I execute a query through wpdb class, it gets cached. For example, on codex under Select a Row and Select a Var, it says the whole query is cached for later use. And I think which means if more data is requested in another query, parti...
[ { "answer_id": 8377, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 4, "selected": true, "text": "<p>Nope, doesn't work like that. The database-related caching is minimal and mostly covers using precisely same queries d...
2011/02/02
[ "https://wordpress.stackexchange.com/questions/8375", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1521/" ]
I am not sure how WordPress cache the queries. I had the impression that whenever I execute a query through wpdb class, it gets cached. For example, on codex under Select a Row and Select a Var, it says the whole query is cached for later use. And I think which means if more data is requested in another query, partials...
Nope, doesn't work like that. The database-related caching is minimal and mostly covers using precisely same queries during single page load. Best way to cache persistently database and/or computationally intensive results is using [Transients API](http://codex.wordpress.org/Transients_API) to store results for fittin...
8,391
<p>I'm using a custom post type and custom taxonomies, and using the following to display the terms of the taxonomies on the post page:</p> <pre><code>the_terms( $post-&gt;ID, 'taxname', 'beforetext', ', '); </code></pre> <p>Is there a way to loop through all the taxonomies assigned to this post and display the terms...
[ { "answer_id": 8393, "author": "Norcross", "author_id": 403, "author_profile": "https://wordpress.stackexchange.com/users/403", "pm_score": 2, "selected": false, "text": "<p>I <em>think</em> what you're looking for is get_the_term_list . Give this a shot</p>\n\n<pre><code>get_the_term_li...
2011/02/02
[ "https://wordpress.stackexchange.com/questions/8391", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/49/" ]
I'm using a custom post type and custom taxonomies, and using the following to display the terms of the taxonomies on the post page: ``` the_terms( $post->ID, 'taxname', 'beforetext', ', '); ``` Is there a way to loop through all the taxonomies assigned to this post and display the terms in an unordered list, rather...
This answer was a joint effort with tnorthcutt so I made it *community wiki*. There are several interesting functions available: `the_taxonomies()`, which calls `get_the_taxonomies()`, which in turn calls `get_object_taxonomies()` and `wp_get_object_terms()`. * [`the_taxonomies()`](http://codex.wordpress.org/Function...
8,416
<p>I've been told by my clients that scheduled jobs are not run some times as expected. I never questioned myself about how wp_cron actually works, I thought it was kinda self-explanatory. But now I doubt it.</p> <p>Codex says that timestamp argument is:</p> <blockquote> <p>the first time that you want the event to...
[ { "answer_id": 8418, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>Yes, event is triggered as soon as possible after scheduled time has passed.</p>\n" }, { "answer_id": 8419, ...
2011/02/03
[ "https://wordpress.stackexchange.com/questions/8416", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/421/" ]
I've been told by my clients that scheduled jobs are not run some times as expected. I never questioned myself about how wp\_cron actually works, I thought it was kinda self-explanatory. But now I doubt it. Codex says that timestamp argument is: > > the first time that you want the event to occur. This must be in a ...
Yes, the event will trigger when the wp-cron process gets run. If something is preventing wp-cron from running, then it won't trigger at all. If you're having it not work, then something about your server configuration is preventing it from working. For these cases, you can generally work around them by adding this de...
8,427
<p>When you register a custom column like so:</p> <pre><code>//Register thumbnail column for au-gallery type add_filter('manage_edit-au-gallery_columns', 'thumbnail_column'); function thumbnail_column($columns) { $columns['thumbnail'] = 'Thumbnail'; return $columns; } </code></pre> <p>by default it appears as the las...
[ { "answer_id": 8430, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": false, "text": "<p>the only way i know how is to create your own array of columns</p>\n\n<pre><code>// Add to admin_init function...
2011/02/03
[ "https://wordpress.stackexchange.com/questions/8427", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2618/" ]
When you register a custom column like so: ``` //Register thumbnail column for au-gallery type add_filter('manage_edit-au-gallery_columns', 'thumbnail_column'); function thumbnail_column($columns) { $columns['thumbnail'] = 'Thumbnail'; return $columns; } ``` by default it appears as the last one on the right. How ca...
You are basically asking a PHP question, but I'll answer it because it's in the context of WordPress. You need to **rebuild the columns array, inserting your column before the column you want it to be left of**: ``` add_filter('manage_posts_columns', 'thumbnail_column'); function thumbnail_column($columns) { $new = ...
8,428
<p>How can I allow each user to manage their own terms for a custom taxonomy when logged in on edit-tags page? user will only show &amp; manage terms that only created by him not others for a custom taxonomy. But Admin and editor can manage all. How can I do that?</p> <p>Any help will be appreciated. Thanks. </p>
[ { "answer_id": 8432, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 2, "selected": false, "text": "<p>Hmmm. You are going to need to keep track of who added which terms which you can currently best do in a usermet...
2011/02/03
[ "https://wordpress.stackexchange.com/questions/8428", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1581/" ]
How can I allow each user to manage their own terms for a custom taxonomy when logged in on edit-tags page? user will only show & manage terms that only created by him not others for a custom taxonomy. But Admin and editor can manage all. How can I do that? Any help will be appreciated. Thanks.
Thanks for the AWESOME solution MikeSchinkel :D I just did the following updates in the code and it worked like a charm: ``` add_filter('list_terms_exclusions', 'yoursite_list_terms_exclusions', 10, 2); function yoursite_list_terms_exclusions( $exclusions ) { $currentScreen = get_current_screen(); if( curre...
8,436
<p>The theme I purchased came without custom fields in the post/product editor. It uses a custom post type in its own admin php file. I've managed to add custom fields by pulling the following code out of wordpress core metabox.php file however I'm unsure how to get it to work. Its missing the area where the custom fie...
[ { "answer_id": 8439, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<p>Are you sure support for custom fields is implemented at all? Support of meta for custom post type must be declared i...
2011/02/03
[ "https://wordpress.stackexchange.com/questions/8436", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
The theme I purchased came without custom fields in the post/product editor. It uses a custom post type in its own admin php file. I've managed to add custom fields by pulling the following code out of wordpress core metabox.php file however I'm unsure how to get it to work. Its missing the area where the custom field ...
Is display of the "Custom Fields" metabox enabled for your Custom Post Type's Edit Screen? To check: 1) Edit (Post Type) Screen 2) Click the "Screen Options" tab in the upper right-hand corner 3) Ensure the "Custom Fields" checkbox is enabled WordPress 3.1 made some (ahem) *decisions* regarding which metaboxes shoul...
8,438
<p>I'm having a problem with entries for a custom post type not being ordered as expected inside a custom query:</p> <pre><code>&lt;h4&gt;Related projects&lt;/h4&gt; &lt;?php $rp_args = array( 'post_type' =&gt; 'work', 'post_status' =&gt; 'p...
[ { "answer_id": 8441, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 3, "selected": false, "text": "<p>Yep - I'm stupid.</p>\n\n<p>Post Types Order plugin has an option (set by default) which overrides any ordering don...
2011/02/03
[ "https://wordpress.stackexchange.com/questions/8438", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I'm having a problem with entries for a custom post type not being ordered as expected inside a custom query: ``` <h4>Related projects</h4> <?php $rp_args = array( 'post_type' => 'work', 'post_status' => 'publish', 'o...
Yep - I'm stupid. Post Types Order plugin has an option (set by default) which overrides any ordering done in queries. Turn that off and the problem goes away.
8,449
<p>I'm using custom permalinks "/%category%/%postname%/". Whenever a post title contains quotes or apostrophes they appear in the URL. </p> <p>Can someone tell me how prevent them from appearing in the slug?</p> <p>I am running WordPress 3.0.4.</p>
[ { "answer_id": 8451, "author": "Fernando Briano", "author_id": 298, "author_profile": "https://wordpress.stackexchange.com/users/298", "pm_score": 2, "selected": false, "text": "<p>I've seen there are some plugins to work around this problem. Check <a href=\"http://wordpress.org/extend/p...
2011/02/03
[ "https://wordpress.stackexchange.com/questions/8449", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1462/" ]
I'm using custom permalinks "/%category%/%postname%/". Whenever a post title contains quotes or apostrophes they appear in the URL. Can someone tell me how prevent them from appearing in the slug? I am running WordPress 3.0.4.
In WordPress, "---" and " -- " become em-dashes (— `&#8212;`) and "--" becomes an en-dash (— `#8212;`). The [sanitize\_title\_with\_dashes()](http://core.trac.wordpress.org/browser/tags/3.0.1/wp-includes/formatting.php) function doesn't catch these. That function uses the databased copy, but the title displayed to th...