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
33,456
<p>I've written a plugin that allows users to bookmark their favorite posts, but have run into a small problem when using it on a multisite network.</p> <p>Each time a post is bookmarked, the ID of that post is stored in an array of IDs in the current user's meta table. This all works great, until it's used on a MS se...
[ { "answer_id": 33671, "author": "Brad Vincent", "author_id": 10253, "author_profile": "https://wordpress.stackexchange.com/users/10253", "pm_score": 2, "selected": false, "text": "<p>why not store the blog id together with the array of postIds, so you will have something like this stored...
2011/11/10
[ "https://wordpress.stackexchange.com/questions/33456", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2418/" ]
I've written a plugin that allows users to bookmark their favorite posts, but have run into a small problem when using it on a multisite network. Each time a post is bookmarked, the ID of that post is stored in an array of IDs in the current user's meta table. This all works great, until it's used on a MS setup. If v...
WordPress distinguishes usermeta keys between sites by using the database prefix for each site. For example, instead of using the favorite\_posts key, you'd use the meta key wp\_23\_favorite\_posts. To get the prefix, you can use `$wpdb->get_blog_prefix()`. But wait, there's actually a whole API dedicated to this. Ra...
33,458
<p>I am trying to embed the admin "new post" WordPress page into an iframe:</p> <pre><code>&lt;iframe height="500px" frameborder="0" width="740px" src="my_wordpress_domain/wp-admin/post-new.php"/&gt; </code></pre> <p>For some reason the iframe loads a blank page. The link itself works in a separate tab and so does th...
[ { "answer_id": 33459, "author": "cboettig", "author_id": 10120, "author_profile": "https://wordpress.stackexchange.com/users/10120", "pm_score": 0, "selected": false, "text": "<p>There's no straight forward way around this if you are using wordpress.com hosted page. If you have independ...
2011/11/10
[ "https://wordpress.stackexchange.com/questions/33458", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4186/" ]
I am trying to embed the admin "new post" WordPress page into an iframe: ``` <iframe height="500px" frameborder="0" width="740px" src="my_wordpress_domain/wp-admin/post-new.php"/> ``` For some reason the iframe loads a blank page. The link itself works in a separate tab and so does the wordpress home page. Is this ...
By default WordPress doesn’t allow to embed the admin pages into a frame. From `wp-includes/default-filters.php`: ``` add_action( 'admin_init', 'send_frame_options_header', 10, 0 ); ``` To enable embedding, remove the action in a plugin: ``` remove_action( 'admin_init', 'send_frame_options_header' ); ``` Be aware...
33,482
<p>I have a drop down menu that displays all of the terms for one of my custom taxonomies using get_categories (). It displays fine in alphabetical form. However, what i want to know is how can i have the terms listed in a hierarchial form in a drop down menu, so they appear like this -</p> <p>Parent Category 1</p> <...
[ { "answer_id": 33485, "author": "GavinR", "author_id": 2001, "author_profile": "https://wordpress.stackexchange.com/users/2001", "pm_score": 0, "selected": false, "text": "<p>If you are trying to just print the heirarchical categories on the page, you can use this code:</p>\n\n<pre><code...
2011/11/11
[ "https://wordpress.stackexchange.com/questions/33482", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I have a drop down menu that displays all of the terms for one of my custom taxonomies using get\_categories (). It displays fine in alphabetical form. However, what i want to know is how can i have the terms listed in a hierarchial form in a drop down menu, so they appear like this - Parent Category 1 * Child One * ...
`wp_dropdown_categories` [has a hierarchical and depth options available.](http://codex.wordpress.org/Function_Reference/wp_dropdown_categories) ``` $args = array( 'show_option_all' => 'All Tshirt Categories', 'orderby' => 'ID', 'order' => 'ASC', 'hide_empty' => 1, ...
33,510
<p>I need to add TinyMCE to descriptions of images. For it, I'm using this code in my functions.php:</p> <pre><code>function add_tiny_mce_hook() { if (function_exists('wp_tiny_mce')){ wp_tiny_mce(false, array( 'remove_linebreaks' =&gt; false, 'mode' =&gt; 'text...
[ { "answer_id": 36637, "author": "Jörg", "author_id": 11187, "author_profile": "https://wordpress.stackexchange.com/users/11187", "pm_score": 0, "selected": false, "text": "<p>Try increasing priority for the <a href=\"http://codex.wordpress.org/Plugin_API/Filter_Reference#Database_Reads\"...
2011/11/11
[ "https://wordpress.stackexchange.com/questions/33510", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10196/" ]
I need to add TinyMCE to descriptions of images. For it, I'm using this code in my functions.php: ``` function add_tiny_mce_hook() { if (function_exists('wp_tiny_mce')){ wp_tiny_mce(false, array( 'remove_linebreaks' => false, 'mode' => 'textareas', ...
i had the same "problem" just two days ago. Finally it worked somehow but wasn't reliable at all. Switching editors just didn't work occasionally and as said, wasn't a reliable solution. The only reason to use tinyMCE here was the ability to add links to attachments. I took an other route and came to this solution: <...
33,532
<p>What function can I use in a plugin to get the dimensions of every image size (in an array preferably) that is defined in a child theme?</p> <p>Just for clarification I am not asking how to <em>create</em> a new image size.</p>
[ { "answer_id": 33533, "author": "MTT", "author_id": 1057, "author_profile": "https://wordpress.stackexchange.com/users/1057", "pm_score": 7, "selected": true, "text": "<p><a href=\"https://wordpress.stackexchange.com/questions/16143/get-intermediate-image-sizes-get-the-size-names-but-how...
2011/11/11
[ "https://wordpress.stackexchange.com/questions/33532", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1057/" ]
What function can I use in a plugin to get the dimensions of every image size (in an array preferably) that is defined in a child theme? Just for clarification I am not asking how to *create* a new image size.
[Found it here](https://wordpress.stackexchange.com/questions/16143/get-intermediate-image-sizes-get-the-size-names-but-how-do-i-get-the-sizes). The answer is: ``` global $_wp_additional_image_sizes; print '<pre>'; print_r( $_wp_additional_image_sizes ); print '</pre>'; ```
33,541
<p>I have created a custom query in hopes of showing the top posts from some child categories. The query has a big flaw: some posts belong to two categories; but, even if they get marked in BOTH categories, they only appear in one.</p> <p>For example, a post marked in both "Navigating Difference" and "Learning Exchang...
[ { "answer_id": 33554, "author": "DennisT", "author_id": 5778, "author_profile": "https://wordpress.stackexchange.com/users/5778", "pm_score": 1, "selected": false, "text": "<p>Use this instead as your loop query..</p>\n\n<pre><code>&lt;?php\n query_posts( 'category_name=YOUR_CAT_NAME&...
2011/11/11
[ "https://wordpress.stackexchange.com/questions/33541", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10210/" ]
I have created a custom query in hopes of showing the top posts from some child categories. The query has a big flaw: some posts belong to two categories; but, even if they get marked in BOTH categories, they only appear in one. For example, a post marked in both "Navigating Difference" and "Learning Exchanges" will o...
Use this instead as your loop query.. ``` <?php query_posts( 'category_name=YOUR_CAT_NAME&showposts=15' ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> ```
33,545
<p>I have a feed from an events calendar that once put in the WordPress RSS widget displays the feed items in reverse chronological order. So the events that are farthest in the future display first, and the events that are coming up soon are displaying last.</p> <p>We are only displaying the title from the feed (the ...
[ { "answer_id": 34676, "author": "Chris Cox", "author_id": 1718, "author_profile": "https://wordpress.stackexchange.com/users/1718", "pm_score": 2, "selected": false, "text": "<p>Easiest way would be replacing the core RSS widget with a custom job that reverses the feed items before displ...
2011/11/11
[ "https://wordpress.stackexchange.com/questions/33545", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/399/" ]
I have a feed from an events calendar that once put in the WordPress RSS widget displays the feed items in reverse chronological order. So the events that are farthest in the future display first, and the events that are coming up soon are displaying last. We are only displaying the title from the feed (the event name...
This should do the trick. Put the following code in your functions.php and then check out the RSS Widget. It will have an option to reverse the order of the feeds. ``` /** * RSS widget class */ class Reverse_Widget_RSS extends WP_Widget { function __construct() { $widget_ops = array( 'description' => __('Entrie...
33,552
<p>I noticed when you typein the user's “biographical info” on the profile, it shows up in one page! Looks really terrible. So:</p> <p>Is there a way to use tinyMCE or other solution for user “biographical info” without messing with any core file, and without any plugin?</p> <p>Thanks a lot.</p>
[ { "answer_id": 33575, "author": "Sagive", "author_id": 7990, "author_profile": "https://wordpress.stackexchange.com/users/7990", "pm_score": 2, "selected": false, "text": "<p>Add this to your <code>functions.php</code>:</p>\n<pre class=\"lang-php prettyprint-override\"><code>/***********...
2011/11/12
[ "https://wordpress.stackexchange.com/questions/33552", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5021/" ]
I noticed when you typein the user's “biographical info” on the profile, it shows up in one page! Looks really terrible. So: Is there a way to use tinyMCE or other solution for user “biographical info” without messing with any core file, and without any plugin? Thanks a lot.
Just adding this to the theme's functions.php solve the problem (prevent stripping of the html from the author's bio): ``` remove_filter('pre_user_description', 'wp_filter_kses'); add_filter( 'pre_user_description', 'wp_filter_post_kses' ); ```
33,574
<p>I have started work on an open source theme framework that pulls in lots of great code &amp; resources from elsewhere. For example it uses:</p> <ul> <li>jQuery</li> <li><a href="https://github.com/devinsays/options-framework-theme" rel="nofollow">Option Framework Theme</a></li> <li><a href="http://lesscss.org/" rel...
[ { "answer_id": 33575, "author": "Sagive", "author_id": 7990, "author_profile": "https://wordpress.stackexchange.com/users/7990", "pm_score": 2, "selected": false, "text": "<p>Add this to your <code>functions.php</code>:</p>\n<pre class=\"lang-php prettyprint-override\"><code>/***********...
2011/11/12
[ "https://wordpress.stackexchange.com/questions/33574", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3310/" ]
I have started work on an open source theme framework that pulls in lots of great code & resources from elsewhere. For example it uses: * jQuery * [Option Framework Theme](https://github.com/devinsays/options-framework-theme) * [LESS](http://lesscss.org/) etc etc. Most of these external projects are hosted on Github...
Just adding this to the theme's functions.php solve the problem (prevent stripping of the html from the author's bio): ``` remove_filter('pre_user_description', 'wp_filter_kses'); add_filter( 'pre_user_description', 'wp_filter_post_kses' ); ```
33,583
<p>I found this code :</p> <pre><code> // Get total number of pages global $wp_query; $total = $wp_query-&gt;max_num_pages; // Only paginate if we have more than one page if ( $total &gt; 1 ) { // Get the current page if ( !$current_page = get_query_var('paged') ) $c...
[ { "answer_id": 43639, "author": "Andre Lohan", "author_id": 13573, "author_profile": "https://wordpress.stackexchange.com/users/13573", "pm_score": 2, "selected": false, "text": "<p><a href=\"http://codex.wordpress.org/Function_Reference/paginate_links\" rel=\"nofollow\">http://codex.wor...
2011/11/12
[ "https://wordpress.stackexchange.com/questions/33583", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10225/" ]
I found this code : ``` // Get total number of pages global $wp_query; $total = $wp_query->max_num_pages; // Only paginate if we have more than one page if ( $total > 1 ) { // Get the current page if ( !$current_page = get_query_var('paged') ) $current_page = 1; ...
<http://codex.wordpress.org/Function_Reference/paginate_links> What you are looking for is 'end\_size', add this to argument array with the value you want.
33,600
<p>I have an issue that I believe can be solved one of two ways.</p> <p>I am using Featured Images in posts for content on a home page slider. What I would like to have happen is to have the destination links on click to be custom. Not the post or image URL of the post/featured image being used to feed the slider.</p>...
[ { "answer_id": 33605, "author": "andresmijares", "author_id": 4907, "author_profile": "https://wordpress.stackexchange.com/users/4907", "pm_score": 0, "selected": false, "text": "<p>I don't get your logic, however I assume you just want to display a post featured image into a slider loca...
2011/11/13
[ "https://wordpress.stackexchange.com/questions/33600", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5087/" ]
I have an issue that I believe can be solved one of two ways. I am using Featured Images in posts for content on a home page slider. What I would like to have happen is to have the destination links on click to be custom. Not the post or image URL of the post/featured image being used to feed the slider. 1) I thought...
I cleaned up the code u have given and it should work as you intend. Let me know if your still having problems. ``` <div id="slider"> <?php $c = get_option('wpns_category'); $n = get_option('wpns_slices'); $s = new WP_Query( array( 'cat' => $c, 'posts_per_page' => $n ) ); if( $s->have_posts() ): while...
33,610
<p>I need to attach meta data to every menu item, with a key 'foo'. Is it possible to do that, without editing core WP?</p> <p>A quick look at the nav-menu files showed that no hooks exist near the place I want to add the input box (below Description, here - <a href="http://cl.ly/0v2Z0X1n2e1L431t0h1G" rel="noreferrer"...
[ { "answer_id": 33816, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 4, "selected": true, "text": "<p>here is a quick code that should do the job, paste this in your theme's functions.php file</p>\n\n<p>basically...
2011/11/13
[ "https://wordpress.stackexchange.com/questions/33610", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8310/" ]
I need to attach meta data to every menu item, with a key 'foo'. Is it possible to do that, without editing core WP? A quick look at the nav-menu files showed that no hooks exist near the place I want to add the input box (below Description, here - <http://cl.ly/0v2Z0X1n2e1L431t0h1G>)
here is a quick code that should do the job, paste this in your theme's functions.php file basically what it does is hide all regular class input boxes and adds a new select dropdown which changes the value of the hidden input based on the selected value. and it looks like this; ![enter image description here](https...
33,633
<p>I'm developing a custom theme which uses categories for positioning, all of which begin with an underscore (e.g. _position1). I have an SQL query as below to get a list of these categories (those starting with an underscore).</p> <pre><code>SELECT name,term_id FROM `wp_terms` WHERE name LIKE '\_%'; </code></pre> <...
[ { "answer_id": 33637, "author": "Rutwick Gangurde", "author_id": 4740, "author_profile": "https://wordpress.stackexchange.com/users/4740", "pm_score": 0, "selected": false, "text": "<p>A better idea would be to create a custom taxonomy as 'Positions', and put all your position values und...
2011/11/13
[ "https://wordpress.stackexchange.com/questions/33633", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10238/" ]
I'm developing a custom theme which uses categories for positioning, all of which begin with an underscore (e.g. \_position1). I have an SQL query as below to get a list of these categories (those starting with an underscore). ``` SELECT name,term_id FROM `wp_terms` WHERE name LIKE '\_%'; ``` How would I go about tu...
If you use the built in [**`get_terms`**](http://codex.wordpress.org/Function_Reference/get_terms) function you end up with a quick one liner: ``` function get_positional_ids(){ return get_terms( 'category', array('fields' => 'ids', 'name__like' => '_')); } ``` no custom SQL, safe and simple.
33,640
<p>I am trying to search for posts in specific taxonomies but any time I search, I get results from all the other pages instead of Wordpress searching within the selected category in the taxonomy.</p> <p>I named my taxonomy: "publication_categories". It contains all categories for a custom post type which I named "pub...
[ { "answer_id": 33642, "author": "Carpy", "author_id": 1778, "author_profile": "https://wordpress.stackexchange.com/users/1778", "pm_score": 1, "selected": false, "text": "<p>Possibly this added to your form?</p>\n\n<pre><code>&lt;input type=\"hidden\" name=\"post_type\" value=\"publicati...
2011/11/13
[ "https://wordpress.stackexchange.com/questions/33640", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10241/" ]
I am trying to search for posts in specific taxonomies but any time I search, I get results from all the other pages instead of Wordpress searching within the selected category in the taxonomy. I named my taxonomy: "publication\_categories". It contains all categories for a custom post type which I named "publication"...
I see a few problems with your code. 1. you are missing post\_type field in your form. 2. the name of the taxonomy dropdown should be the name of your custom taxonomy. 3. the form method is set to GET yet you check the selected with POST. so your form should look something like this: ``` <form method="get" id="searc...
33,662
<p>I'm using fetch_feed (based on Simplepie) to display an array of RSS feeds (favicon &amp; headlines only). Documentation on the <a href="http://simplepie.org/wiki/reference/simplepie/get_favicon#use_css_to_add_the_favicon_to_each_item_s_title" rel="nofollow">simplepie website</a> says to use get_favicon in the style...
[ { "answer_id": 33666, "author": "markratledge", "author_id": 268, "author_profile": "https://wordpress.stackexchange.com/users/268", "pm_score": 0, "selected": false, "text": "<p>You have to tell apache to parse css files for php. One way is to edit .htaccess and add the directive below ...
2011/11/14
[ "https://wordpress.stackexchange.com/questions/33662", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1697/" ]
I'm using fetch\_feed (based on Simplepie) to display an array of RSS feeds (favicon & headlines only). Documentation on the [simplepie website](http://simplepie.org/wiki/reference/simplepie/get_favicon#use_css_to_add_the_favicon_to_each_item_s_title) says to use get\_favicon in the stylesheet. And I'm using the [fetch...
You can't ( and shouldn't ) have php in your css files, css should be static and unchanging. If you need to generate dynamic css, you can put it inline in the header, or have your theme add a url via wordpress from which to generate the css stylesheet dynamically. ``` add_action('wp_head',createfunction("","echo '<sty...
33,686
<p>I'm simply trying to display a specific post id from my custom post type 'homepage_video'. I'm sure that this is the correct code but it seems to be returning all of the posts rather than just Post Id 40.</p> <pre><code>&lt;?php query_posts('post_id=40&amp;post_type=homepage_video'); ...
[ { "answer_id": 33693, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": false, "text": "<p><code>post_id</code> is not a valid argument for <code>query_post</code> Change <code>post_id</code> to <code...
2011/11/14
[ "https://wordpress.stackexchange.com/questions/33686", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5883/" ]
I'm simply trying to display a specific post id from my custom post type 'homepage\_video'. I'm sure that this is the correct code but it seems to be returning all of the posts rather than just Post Id 40. ``` <?php query_posts('post_id=40&post_type=homepage_video'); while (have...
`post_id` is not a valid argument for `query_post` Change `post_id` to `p`, so you get: ``` query_posts('p=40&post_type=homepage_video'); while (have_posts()): the_post(); ?> <div id="video-panel-blue"> <?php get_custom_field('home-video-iframe', TRUE); ?> </div> <?php endwhile; ?> ``` to see the list of...
33,689
<p>I am looking for some modules that implement add meta box as shown <a href="http://wefunction.com/2008/10/tutorial-creating-custom-write-panels-in-wordpress/" rel="nofollow">here</a> perhaps with some ajax magic.</p> <p>If you have any modules I could check out would be welcome.</p>
[ { "answer_id": 33691, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 0, "selected": false, "text": "<p>I'm not exactly sure what you're asking here, but the most basic example you can get here, along with everyth...
2011/11/14
[ "https://wordpress.stackexchange.com/questions/33689", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9652/" ]
I am looking for some modules that implement add meta box as shown [here](http://wefunction.com/2008/10/tutorial-creating-custom-write-panels-in-wordpress/) perhaps with some ajax magic. If you have any modules I could check out would be welcome.
I recently published a meta box class named [**`My Meta Box`**](https://github.com/bainternet/My-Meta-Box) which takes care of most of the metabox creation and data saving and that was forked out of from Meta Box script by Rilwis. Using the class is simple eg: ``` <?php require_once("meta-box-class/my-meta-box-class...
33,697
<p>A friend of mine is investigating the use of WordPress for a dynamic site with some hierarchy. Really, at the moment he just wants "nothing fancier than photos and links between pages," but knowing him, it's going to get more complex from there.</p> <p>The tricky requirement, though, is that he needs to be able to...
[ { "answer_id": 33698, "author": "Nicole", "author_id": 8337, "author_profile": "https://wordpress.stackexchange.com/users/8337", "pm_score": 2, "selected": false, "text": "<p>You might want to give this tutorial a try:</p>\n\n<p><a href=\"http://mossiso.com/2009/07/20/convert-wp-to-stati...
2011/11/14
[ "https://wordpress.stackexchange.com/questions/33697", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/46/" ]
A friend of mine is investigating the use of WordPress for a dynamic site with some hierarchy. Really, at the moment he just wants "nothing fancier than photos and links between pages," but knowing him, it's going to get more complex from there. The tricky requirement, though, is that he needs to be able to archive th...
Turn on pretty permalinks, and run a spider/archiver on the address of your website. This should give you a static site you can place on a CD/DVD/USB drive. You can use a tool such as <http://www.httrack.com/> to do the latter part. If you're on linux you can use the following command: ``` # Mirror website to a stati...
33,736
<p>I am having some problems with the Nginx rewrite algorithm for WordPress. </p> <p>I am using this for the rewrite and it works good; </p> <pre><code> server_name www.domain.com domain.com; if ($host != 'domain.com') { rewrite ^/(.*) http://domain.com/$1 permanent; } </code></pre> <p>it makes t...
[ { "answer_id": 33739, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 3, "selected": true, "text": "<h2>The correct Nginx rewrite rules for WordPress are:</h2>\n<pre><code>location / {\n try_files $uri $uri/ /in...
2011/11/14
[ "https://wordpress.stackexchange.com/questions/33736", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9728/" ]
I am having some problems with the Nginx rewrite algorithm for WordPress. I am using this for the rewrite and it works good; ``` server_name www.domain.com domain.com; if ($host != 'domain.com') { rewrite ^/(.*) http://domain.com/$1 permanent; } ``` it makes this url; ``` http://domain.com/?...
The correct Nginx rewrite rules for WordPress are: -------------------------------------------------- ``` location / { try_files $uri $uri/ /index.php?q=$uri&$args; } ``` This sends everything through index.php and keeps the appended query string intact. If your running PHP-FPM you should also add this ...
33,767
<p>managed to create a custom menu area in the admin but now want to place 2 post types to it.</p> <p>They already exist - questions &amp; answers, but can't find a way to put their menu links into the custom menu.</p> <pre><code>add_action('admin_menu', 'mt_add_pages'); function mt_add_pages() { add_menu_page(...
[ { "answer_id": 33739, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 3, "selected": true, "text": "<h2>The correct Nginx rewrite rules for WordPress are:</h2>\n<pre><code>location / {\n try_files $uri $uri/ /in...
2011/11/15
[ "https://wordpress.stackexchange.com/questions/33767", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3978/" ]
managed to create a custom menu area in the admin but now want to place 2 post types to it. They already exist - questions & answers, but can't find a way to put their menu links into the custom menu. ``` add_action('admin_menu', 'mt_add_pages'); function mt_add_pages() { add_menu_page(__('Competition','comp'),...
The correct Nginx rewrite rules for WordPress are: -------------------------------------------------- ``` location / { try_files $uri $uri/ /index.php?q=$uri&$args; } ``` This sends everything through index.php and keeps the appended query string intact. If your running PHP-FPM you should also add this ...
33,768
<p>I am using qtranslate plugin for my WordPress site to make it a multi-language site.</p> <p>Now I have got a requirement like</p> <p>For English the url should look like www.sitename.com/contact-en For French the url should look like www.sitename.com/fr/contact-fr</p> <p>How can I accomplish this? (qTranslate is ...
[ { "answer_id": 33739, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 3, "selected": true, "text": "<h2>The correct Nginx rewrite rules for WordPress are:</h2>\n<pre><code>location / {\n try_files $uri $uri/ /in...
2011/11/15
[ "https://wordpress.stackexchange.com/questions/33768", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10289/" ]
I am using qtranslate plugin for my WordPress site to make it a multi-language site. Now I have got a requirement like For English the url should look like www.sitename.com/contact-en For French the url should look like www.sitename.com/fr/contact-fr How can I accomplish this? (qTranslate is the plugin used) Note: ...
The correct Nginx rewrite rules for WordPress are: -------------------------------------------------- ``` location / { try_files $uri $uri/ /index.php?q=$uri&$args; } ``` This sends everything through index.php and keeps the appended query string intact. If your running PHP-FPM you should also add this ...
33,775
<p>I'm trying to add more rows in the media picker modal window. Is there any clean way to achieve doing this ?</p> <p>Thanks !</p>
[ { "answer_id": 54416, "author": "brasofilo", "author_id": 12615, "author_profile": "https://wordpress.stackexchange.com/users/12615", "pm_score": 0, "selected": false, "text": "<p>This works but the big issue is to solve the pagination, because it is completely broken.</p>\n\n<pre><code>...
2011/11/15
[ "https://wordpress.stackexchange.com/questions/33775", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3071/" ]
I'm trying to add more rows in the media picker modal window. Is there any clean way to achieve doing this ? Thanks !
my plugin: <http://wordpress.org/extend/plugins/mediapicker-more-rows/> **I found a way to fix the pagination** There is a way you can 'hook' into paginate\_links. There is no official hook for it, but you can change the $wp\_query->found\_posts variable. What I did here is 'hooking' into the paginate\_links by abus...
33,779
<p>I am using WordPress 3.2.1 multi-user. I need to show posts from a specific sub domain in my home page, for example: <a href="http://mysite.com/sub-blog" rel="nofollow">http://mysite.com/sub-blog</a>. I need to show posts from sub-blog in my home page.</p> <p>Is their any special code to query from a specific blog?...
[ { "answer_id": 33789, "author": "chrisguitarguy", "author_id": 6035, "author_profile": "https://wordpress.stackexchange.com/users/6035", "pm_score": 2, "selected": false, "text": "<p>You're probably going to have to write some custom SQL for that. Here's an example function that would d...
2011/11/15
[ "https://wordpress.stackexchange.com/questions/33779", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7376/" ]
I am using WordPress 3.2.1 multi-user. I need to show posts from a specific sub domain in my home page, for example: <http://mysite.com/sub-blog>. I need to show posts from sub-blog in my home page. Is their any special code to query from a specific blog?
You're probably going to have to write some custom SQL for that. Here's an example function that would do this. It's slightly insecure as we can't use $wpdb->prepare to put the blog\_id in (it surrounds anything inserted with quotes). ``` <?php function wpse33779_get_posts_from_blog( $blog_id = 1 ) { // is this is...
33,784
<p>I'm using Taxonomy Images to associate images with categories. I'm using the following code, one is to display the categories, the other to display the images.</p> <p>Here is the code that displays my categories.</p> <pre><code>&lt;?php $cat_id = get_query_var('cat'); $catlist = get_categories('hide_empty=0&amp;ch...
[ { "answer_id": 33805, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 0, "selected": false, "text": "<p>As described via the plugins wordpress download page instructions:</p>\n\n<pre><code>$image_id = apply_filter...
2011/11/15
[ "https://wordpress.stackexchange.com/questions/33784", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9218/" ]
I'm using Taxonomy Images to associate images with categories. I'm using the following code, one is to display the categories, the other to display the images. Here is the code that displays my categories. ``` <?php $cat_id = get_query_var('cat'); $catlist = get_categories('hide_empty=0&child_of=' . $cat_id); echo "<...
Got this working by using the code below. It will show the categories and the image associated with it. ``` <?php $cat_id = get_query_var('cat'); $catlist = get_categories('hide_empty=0&child_of=' . $cat_id); echo "<ul>"; foreach($catlist as $categories_item) { echo '<h1><a href="' . get_category_link( $categori...
33,818
<p>Ok here's the solution:</p> <pre><code>&lt;?php $wp_user_search1 = new WP_User_Query( array( 'meta_key' =&gt; 'state' , 'meta_value' =&gt; 'NM', )); $listers1 = $wp_user_search1-&gt;get_results(); $lister_ids1 = array(); foreach($listers1 as $lister1) { $lister_ids1[] = $lister1-&gt;ID; } $ids1 = implode(',...
[ { "answer_id": 33801, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 3, "selected": true, "text": "<p>There is nothing you can do, the % symbol is not a neutral character and whatever 2 characters immediatly fol...
2011/11/15
[ "https://wordpress.stackexchange.com/questions/33818", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10301/" ]
Ok here's the solution: ``` <?php $wp_user_search1 = new WP_User_Query( array( 'meta_key' => 'state' , 'meta_value' => 'NM', )); $listers1 = $wp_user_search1->get_results(); $lister_ids1 = array(); foreach($listers1 as $lister1) { $lister_ids1[] = $lister1->ID; } $ids1 = implode(',', $lister_ids1); $wp_user_s...
There is nothing you can do, the % symbol is not a neutral character and whatever 2 characters immediatly follow it are used to represent a character. This is called percent encoding. <http://en.wikipedia.org/wiki/Percent-encoding> For example, to encode a % you would use %25. Thus the answer is: **No, it is not po...
33,828
<p>I trying to set a meta_box with a single checkbox, everything goes fine, however if I uncheck it and save the post, it marks again as checked, I've been taking a look but I cannot find my mistake.</p> <p>Take a look a my code.</p> <pre><code>function am_checkbox_option() { global $post; $custom = get_post_...
[ { "answer_id": 33801, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 3, "selected": true, "text": "<p>There is nothing you can do, the % symbol is not a neutral character and whatever 2 characters immediatly fol...
2011/11/15
[ "https://wordpress.stackexchange.com/questions/33828", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4907/" ]
I trying to set a meta\_box with a single checkbox, everything goes fine, however if I uncheck it and save the post, it marks again as checked, I've been taking a look but I cannot find my mistake. Take a look a my code. ``` function am_checkbox_option() { global $post; $custom = get_post_custom($post->ID); ...
There is nothing you can do, the % symbol is not a neutral character and whatever 2 characters immediatly follow it are used to represent a character. This is called percent encoding. <http://en.wikipedia.org/wiki/Percent-encoding> For example, to encode a % you would use %25. Thus the answer is: **No, it is not po...
33,864
<p>I found this question asked elsewhere, but it was unanswered, so I'm asking myself.</p> <p>I have a custom post type (Features) that shares my Categories and Tags with my standard posts. I'm listing my categories with this:</p> <pre><code>&lt;?php wp_list_categories('title_li=&amp;hierarchical=false'); ?&gt; </cod...
[ { "answer_id": 33866, "author": "Rutwick Gangurde", "author_id": 4740, "author_profile": "https://wordpress.stackexchange.com/users/4740", "pm_score": 0, "selected": false, "text": "<p>First, check if this is set in your code for registering the CPT: <code>'has_archive' =&gt; true</code>...
2011/11/16
[ "https://wordpress.stackexchange.com/questions/33864", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7571/" ]
I found this question asked elsewhere, but it was unanswered, so I'm asking myself. I have a custom post type (Features) that shares my Categories and Tags with my standard posts. I'm listing my categories with this: ``` <?php wp_list_categories('title_li=&hierarchical=false'); ?> ``` The resulting list includes ca...
I found this answer on the WordPress forum to be of help: <http://wordpress.org/support/topic/custom-post-type-posts-not-displayed?replies=5#post-2805344> basically, the poster references a post by Justin Tadlock (who is pretty much an authority in WordPress theme and plugin desing by the way. Follow his blog if you ...
33,868
<p><strong><em>Problem:</em></strong> </p> <p>Before I created meta-boxes I did things the old fashion way by entering custom fields directly. I went through the process of filling in the ID and the Value by hand and hitting the "update button". I would input whatever I wanted, <code>spaces</code> and <code>.</code> (...
[ { "answer_id": 35765, "author": "cr0z3r", "author_id": 4513, "author_profile": "https://wordpress.stackexchange.com/users/4513", "pm_score": 0, "selected": false, "text": "<p>In case you are still looking for an answer; I think you will have to get your hands dirty on this. First off, yo...
2011/11/16
[ "https://wordpress.stackexchange.com/questions/33868", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6423/" ]
***Problem:*** Before I created meta-boxes I did things the old fashion way by entering custom fields directly. I went through the process of filling in the ID and the Value by hand and hitting the "update button". I would input whatever I wanted, `spaces` and `.` (periods) and they would be correctly applied in my d...
You may have build your meta box wrong: If your custom field names are not valid variable names [PHP will convert](http://www.php.net/manual/en/language.variables.external.php) all characters not matching `[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]` to underscores. The reason: register\_globals. A request field must be ab...
33,885
<p>I am using Wordpress as a CMS for a project which makes extensive use of custom post types. I need to display columns in admin panels for each custom post type in a different way.</p> <p>I've already created the necessary columns and populated them. What I need to do is to adjust the CSS a bit. Most importantly I'm...
[ { "answer_id": 33886, "author": "Geert", "author_id": 4936, "author_profile": "https://wordpress.stackexchange.com/users/4936", "pm_score": 3, "selected": false, "text": "<p>You should be able to set the column width using CSS quite easily. You can use the <code>.column-{name}</code> cla...
2011/11/16
[ "https://wordpress.stackexchange.com/questions/33885", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8421/" ]
I am using Wordpress as a CMS for a project which makes extensive use of custom post types. I need to display columns in admin panels for each custom post type in a different way. I've already created the necessary columns and populated them. What I need to do is to adjust the CSS a bit. Most importantly I'm trying to...
I found a solution that works for me! I dropped this code in functions.php : ``` add_action('admin_head', 'my_column_width'); function my_column_width() { echo '<style type="text/css">'; echo '.column-mycolumn { text-align: center; width:60px !important; overflow:hidden }'; echo '</style>'; } ```
33,891
<p>I managed to get the #content field html with this jquery call:</p> <pre><code>jQuery("#content").html() </code></pre> <p>This seems to be failing though on "Add New Post" pages. Any tips on how to get the contents of the #content div?</p> <p>Cheers</p>
[ { "answer_id": 33886, "author": "Geert", "author_id": 4936, "author_profile": "https://wordpress.stackexchange.com/users/4936", "pm_score": 3, "selected": false, "text": "<p>You should be able to set the column width using CSS quite easily. You can use the <code>.column-{name}</code> cla...
2011/11/16
[ "https://wordpress.stackexchange.com/questions/33891", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9652/" ]
I managed to get the #content field html with this jquery call: ``` jQuery("#content").html() ``` This seems to be failing though on "Add New Post" pages. Any tips on how to get the contents of the #content div? Cheers
I found a solution that works for me! I dropped this code in functions.php : ``` add_action('admin_head', 'my_column_width'); function my_column_width() { echo '<style type="text/css">'; echo '.column-mycolumn { text-align: center; width:60px !important; overflow:hidden }'; echo '</style>'; } ```
33,893
<p>I have created user meta options using this tutorial. Now I want to know how to allow users to edit (update) certain custom user meta options that I created.</p> <p>Users already have a template account page where they have access to some user meta options. I added the a function to the users' page to update the me...
[ { "answer_id": 38733, "author": "Tribalpixel", "author_id": 11987, "author_profile": "https://wordpress.stackexchange.com/users/11987", "pm_score": 2, "selected": true, "text": "<p>\"edit_user_profile_update\" is not an action...\ncheck: <a href=\"http://codex.wordpress.org/Plugin_API/Ac...
2011/11/16
[ "https://wordpress.stackexchange.com/questions/33893", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1893/" ]
I have created user meta options using this tutorial. Now I want to know how to allow users to edit (update) certain custom user meta options that I created. Users already have a template account page where they have access to some user meta options. I added the a function to the users' page to update the meta field u...
"edit\_user\_profile\_update" is not an action... check: <http://codex.wordpress.org/Plugin_API/Action_Reference> update\_usermeta() is deprecated in wp 3 and above, use update\_user\_meta() your form is lacking some standard hidden fields like: ``` <input type="hidden" name="user_id" id="user_id" value="<?php echo...
33,897
<p>How do you display the archives of a Custom Post Type by Year &amp; Month? </p>
[ { "answer_id": 33898, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 3, "selected": false, "text": "<p>You don't, the official line from the Wordpress developers was that custom post types weren't intended to do ...
2011/11/16
[ "https://wordpress.stackexchange.com/questions/33897", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8063/" ]
How do you display the archives of a Custom Post Type by Year & Month?
Yes, you can. All you need is make a filter for `wp_get_archives();` so it accepts `post_type` parameter: ``` function my_custom_post_type_archive_where($where,$args){ $post_type = isset($args['post_type']) ? $args['post_type'] : 'post'; $where = "WHERE post_type = '$post_type' AND post_status = 'publis...
33,917
<p>Prior to the 3.3 beta 3 I used thickbox on the front end with the below script. Since beta 3 the lightbox has stopped working. Is there an error in my code or did the function change?</p> <pre><code>function add_themescript(){ if(!is_admin()){ wp_enqueue_script('thickbox',null,array('jquery')); wp_enque...
[ { "answer_id": 33921, "author": "Pippin", "author_id": 2418, "author_profile": "https://wordpress.stackexchange.com/users/2418", "pm_score": 0, "selected": false, "text": "<p>WP 3.3 uses jQuery 1.7. It's possible that the thickbox script doesn't work with 1.7. I know some other scripts, ...
2011/11/16
[ "https://wordpress.stackexchange.com/questions/33917", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1057/" ]
Prior to the 3.3 beta 3 I used thickbox on the front end with the below script. Since beta 3 the lightbox has stopped working. Is there an error in my code or did the function change? ``` function add_themescript(){ if(!is_admin()){ wp_enqueue_script('thickbox',null,array('jquery')); wp_enqueue_style('thic...
This is possibly related to an issue in Wordpress regarding cache that has just been fixed within the last hour: <http://core.trac.wordpress.org/changeset/19318> Here's the Trac ticket: <http://core.trac.wordpress.org/ticket/19240> Clearing your cache may help in the meantime before beta 4/RC1
33,923
<p>I've browsed tons of Q/A on stackexchange, google, wordpress forums... but haven't found yet a definitive answer to what looks like to be a common issue since the introduction of custom post types.</p> <p>I've set my permalinks structure from Wordpress admin permalink settings page as:</p> <pre><code>/%post_id%/%p...
[ { "answer_id": 33921, "author": "Pippin", "author_id": 2418, "author_profile": "https://wordpress.stackexchange.com/users/2418", "pm_score": 0, "selected": false, "text": "<p>WP 3.3 uses jQuery 1.7. It's possible that the thickbox script doesn't work with 1.7. I know some other scripts, ...
2011/11/16
[ "https://wordpress.stackexchange.com/questions/33923", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8421/" ]
I've browsed tons of Q/A on stackexchange, google, wordpress forums... but haven't found yet a definitive answer to what looks like to be a common issue since the introduction of custom post types. I've set my permalinks structure from Wordpress admin permalink settings page as: ``` /%post_id%/%post_name%/ ``` sinc...
This is possibly related to an issue in Wordpress regarding cache that has just been fixed within the last hour: <http://core.trac.wordpress.org/changeset/19318> Here's the Trac ticket: <http://core.trac.wordpress.org/ticket/19240> Clearing your cache may help in the meantime before beta 4/RC1
33,925
<p>I want to add custom user meta fields to registration page. I use WP multisite so I have to modify <code>wp-signup.php</code>.</p> <p>Adding some field is easy for me(I am programmer :P).</p> <p>But I have a problem with this line of code:</p> <pre><code>wpmu_signup_user($user_name, $user_email, apply_filters('ad...
[ { "answer_id": 33983, "author": "David Vogel", "author_id": 10348, "author_profile": "https://wordpress.stackexchange.com/users/10348", "pm_score": 2, "selected": false, "text": "<p>Easiest way I know is by using Gravity Forms &amp; <a href=\"http://www.gravityforms.com/add-ons/user-regi...
2011/11/16
[ "https://wordpress.stackexchange.com/questions/33925", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10334/" ]
I want to add custom user meta fields to registration page. I use WP multisite so I have to modify `wp-signup.php`. Adding some field is easy for me(I am programmer :P). But I have a problem with this line of code: ``` wpmu_signup_user($user_name, $user_email, apply_filters('add_signup_meta', array())); ``` I have...
Easiest way I know is by using Gravity Forms & [User Registration add-on](http://www.gravityforms.com/add-ons/user-registration/)
33,926
<p>How can I get the ID of a post (or page) based on the $query_vars variable? I want to do something like </p> <pre><code>$query_vars['post_id'] </code></pre> <p>But I don't have a reference page that has the list of $query_vars perams. The code will be using the template_redirect action hook. </p>
[ { "answer_id": 33930, "author": "goldenapples", "author_id": 290, "author_profile": "https://wordpress.stackexchange.com/users/290", "pm_score": 0, "selected": false, "text": "<p>If you're on a single post or page view, try using <code>get_queried_object_id()</code>.</p>\n\n<p>Or, if you...
2011/11/16
[ "https://wordpress.stackexchange.com/questions/33926", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8902/" ]
How can I get the ID of a post (or page) based on the $query\_vars variable? I want to do something like ``` $query_vars['post_id'] ``` But I don't have a reference page that has the list of $query\_vars perams. The code will be using the template\_redirect action hook.
When viewing a single post, `get_the_ID();` used within the loop will return the current post's ID. > > But I don't have a reference page that has the list of $query\_vars params... > > > Dumping it ``` global $wp_query; var_dump($wp_query->query_vars); ``` would provide such a reference. Where you'd subseque...
33,939
<p>I have this code for display posts between two particular dates:</p> <pre><code>$s = '2011-10-23'; $e = '2011-11-17'; function filter_where($where = '') { $where .= ' AND post_date &gt;= $s AND post_date &lt;= $e'; return $where; } add_filter('posts_where', 'filter_where'); query_posts($query_string)...
[ { "answer_id": 33941, "author": "Stephen Harris", "author_id": 9364, "author_profile": "https://wordpress.stackexchange.com/users/9364", "pm_score": 3, "selected": true, "text": "<p>I think its because the SQL statement needs the dates inside the quotation marks. Try</p>\n\n<pre><code>$w...
2011/11/16
[ "https://wordpress.stackexchange.com/questions/33939", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6097/" ]
I have this code for display posts between two particular dates: ``` $s = '2011-10-23'; $e = '2011-11-17'; function filter_where($where = '') { $where .= ' AND post_date >= $s AND post_date <= $e'; return $where; } add_filter('posts_where', 'filter_where'); query_posts($query_string); ``` But that's n...
I think its because the SQL statement needs the dates inside the quotation marks. Try ``` $where .= " AND post_date >= '$s' AND post_date <= '$e'"; ``` That should work, otherwise, try ``` $where .= " AND post_date >= '".$s."' AND post_date <= '".$e."'"; ```
33,952
<p>I am looking for a plugin that adds a star rating to a comment, transforming the comment into a user review. </p> <p><a href="http://demo.dailywp.com/reviewengine/product/apple-macbook-pro-2010" rel="nofollow">Here is an example.</a> I have bought this theme but it is a theme, not a plugin and really limits the use...
[ { "answer_id": 33941, "author": "Stephen Harris", "author_id": 9364, "author_profile": "https://wordpress.stackexchange.com/users/9364", "pm_score": 3, "selected": true, "text": "<p>I think its because the SQL statement needs the dates inside the quotation marks. Try</p>\n\n<pre><code>$w...
2011/11/17
[ "https://wordpress.stackexchange.com/questions/33952", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9803/" ]
I am looking for a plugin that adds a star rating to a comment, transforming the comment into a user review. [Here is an example.](http://demo.dailywp.com/reviewengine/product/apple-macbook-pro-2010) I have bought this theme but it is a theme, not a plugin and really limits the use case of wordpress. I have also loo...
I think its because the SQL statement needs the dates inside the quotation marks. Try ``` $where .= " AND post_date >= '$s' AND post_date <= '$e'"; ``` That should work, otherwise, try ``` $where .= " AND post_date >= '".$s."' AND post_date <= '".$e."'"; ```
33,960
<p>How do I escape a right bracket in a short code? </p> <p>I'm working on a Google Map plugin that has encoded points. Sometimes the polygons have the ] in it, which makes WP think that it's the end of the shortcode. </p> <p>For example:</p> <pre><code>[my_shortcode latitude='36.93' longitude='-72.98' encoded_poin...
[ { "answer_id": 33963, "author": "Johannes Pille", "author_id": 9745, "author_profile": "https://wordpress.stackexchange.com/users/9745", "pm_score": 5, "selected": true, "text": "<p>I don't know of an official escape syntax for shortcodes and there likely isn't one.</p>\n\n<p>When wordpr...
2011/11/17
[ "https://wordpress.stackexchange.com/questions/33960", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4509/" ]
How do I escape a right bracket in a short code? I'm working on a Google Map plugin that has encoded points. Sometimes the polygons have the ] in it, which makes WP think that it's the end of the shortcode. For example: ``` [my_shortcode latitude='36.93' longitude='-72.98' encoded_points='ortlF~g]tM?cZEH`z]}|@DQf...
I don't know of an official escape syntax for shortcodes and there likely isn't one. When wordpress parses for shortcodes it looks for *[* and *]*. If you want to use square brackets within a shortcode, using the respective [html ASCII entities](http://www.ascii.cl/htmlcodes.htm) escapes them. I.e. replacing *[* by `...
33,989
<p>I am new to wordpress, I wanted to know where this definition is mentioned in wordpress</p> <pre><code>return apply_filters('check_password', $check, $password, $hash, $user_id); </code></pre> <p>I found it in <code>pluggable .php</code> file line no <code>1470</code> I wanted to know this because there are two t...
[ { "answer_id": 33991, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 2, "selected": false, "text": "<p>apply_filters is a generic function that takes the 'check_password' tag and executes all the functions that h...
2011/11/17
[ "https://wordpress.stackexchange.com/questions/33989", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10166/" ]
I am new to wordpress, I wanted to know where this definition is mentioned in wordpress ``` return apply_filters('check_password', $check, $password, $hash, $user_id); ``` I found it in `pluggable .php` file line no `1470` I wanted to know this because there are two types of password saved one is simple but with en...
apply\_filters is a generic function that takes the 'check\_password' tag and executes all the functions that have attached themselves to it via the `add_filter` call. To see which functions are hooking into the 'check\_password' filter, use the wordpress hooks database to see all instances here: <http://adambrown.in...
33,999
<p>Basically what I want is to create an EVENT post type. So people can put in a date and time of the event. (I've got this far... this is fine).</p> <p>The bit that I can't seem to figure is now I want to be able to make pages as SUB PAGES of that meeting. I'm not really bothered how I do this to be honest, although ...
[ { "answer_id": 34003, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 3, "selected": true, "text": "<p>Unfortunately at the moment that isn't really possible. You can set up the posts manually or via a custom UI t...
2011/11/17
[ "https://wordpress.stackexchange.com/questions/33999", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4529/" ]
Basically what I want is to create an EVENT post type. So people can put in a date and time of the event. (I've got this far... this is fine). The bit that I can't seem to figure is now I want to be able to make pages as SUB PAGES of that meeting. I'm not really bothered how I do this to be honest, although I figured ...
Unfortunately at the moment that isn't really possible. You can set up the posts manually or via a custom UI to have the right parentage, but the permalinks will not work, defeating the point. What's more even if it did work, after the first event, you'd have clashing permalinks, and wordpress would rename your second ...
34,030
<p>I am trying to change some of the titles of my posts and their respective permalinks. After I edit the title and permalink and click 'ok', the permalink appears to have changed temporarily. However, when I click 'update', the permalink changes back to what it was originally.</p> <p>Is there anything that may be pre...
[ { "answer_id": 37776, "author": "Susan Grant", "author_id": 11635, "author_profile": "https://wordpress.stackexchange.com/users/11635", "pm_score": 2, "selected": false, "text": "<p>I changed the title of a page which was a \"parent\" to a few other pages - as you say the permalink kept ...
2011/11/17
[ "https://wordpress.stackexchange.com/questions/34030", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7877/" ]
I am trying to change some of the titles of my posts and their respective permalinks. After I edit the title and permalink and click 'ok', the permalink appears to have changed temporarily. However, when I click 'update', the permalink changes back to what it was originally. Is there anything that may be preventing th...
Have you somehow hidden/removed the slug metabox? (is something like this located in your functions.php?) ``` function remove_post_meta_box() { remove_meta_box('slugdiv', 'post', 'normal'); } add_action('admin_menu', 'remove_post_meta_box'); ``` If that's the case, it's causing the error. There is a [Trac](http:...
34,047
<p>I'm trying to make a nav to access all the different galleries on a single page.</p> <p>Instead of hard-coding all their names out. I was curious if it was possible to make this dynamic and just call all the ID's of all the galleries, with maybe an exclusionary on the two that are slideshows.</p> <p>Anyone got any...
[ { "answer_id": 34051, "author": "Johannes Pille", "author_id": 9745, "author_profile": "https://wordpress.stackexchange.com/users/9745", "pm_score": 4, "selected": true, "text": "<p>All your Galleries are stored a table called <code>wp_ngg_gallery</code> in your wordpress database. (For ...
2011/11/18
[ "https://wordpress.stackexchange.com/questions/34047", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8798/" ]
I'm trying to make a nav to access all the different galleries on a single page. Instead of hard-coding all their names out. I was curious if it was possible to make this dynamic and just call all the ID's of all the galleries, with maybe an exclusionary on the two that are slideshows. Anyone got any fresh ideas?
All your Galleries are stored a table called `wp_ngg_gallery` in your wordpress database. (For the sake of completeness: nextGen Gallery creates 2 more tables for albums and pictures, respectively) ``` $gallery_ids = $wpdb->get_results( "SELECT gid FROM ".$wpdb->prefix."ngg_gallery ORDER BY gid ASC", ARRAY_A); ``...
34,056
<p>I building a site in WordPress (my own theme) that includes a very simple "sign up" email form. Person enters name and email address and hits submit button. Client currently using a script through Bluehost so I want to recreate vs. using a form plugin. </p> <p>The form is fine. After hitting "submit" person is redi...
[ { "answer_id": 34051, "author": "Johannes Pille", "author_id": 9745, "author_profile": "https://wordpress.stackexchange.com/users/9745", "pm_score": 4, "selected": true, "text": "<p>All your Galleries are stored a table called <code>wp_ngg_gallery</code> in your wordpress database. (For ...
2011/11/18
[ "https://wordpress.stackexchange.com/questions/34056", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5686/" ]
I building a site in WordPress (my own theme) that includes a very simple "sign up" email form. Person enters name and email address and hits submit button. Client currently using a script through Bluehost so I want to recreate vs. using a form plugin. The form is fine. After hitting "submit" person is redirected to ...
All your Galleries are stored a table called `wp_ngg_gallery` in your wordpress database. (For the sake of completeness: nextGen Gallery creates 2 more tables for albums and pictures, respectively) ``` $gallery_ids = $wpdb->get_results( "SELECT gid FROM ".$wpdb->prefix."ngg_gallery ORDER BY gid ASC", ARRAY_A); ``...
34,071
<p>I want to develop a site like <a href="http://www.webpresent.biz/" rel="nofollow">http://www.webpresent.biz/</a> Should I develop in wordpress? How much effort is required? Plugins available?</p> <p>Help would be appreciated.</p>
[ { "answer_id": 34051, "author": "Johannes Pille", "author_id": 9745, "author_profile": "https://wordpress.stackexchange.com/users/9745", "pm_score": 4, "selected": true, "text": "<p>All your Galleries are stored a table called <code>wp_ngg_gallery</code> in your wordpress database. (For ...
2011/11/18
[ "https://wordpress.stackexchange.com/questions/34071", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6985/" ]
I want to develop a site like <http://www.webpresent.biz/> Should I develop in wordpress? How much effort is required? Plugins available? Help would be appreciated.
All your Galleries are stored a table called `wp_ngg_gallery` in your wordpress database. (For the sake of completeness: nextGen Gallery creates 2 more tables for albums and pictures, respectively) ``` $gallery_ids = $wpdb->get_results( "SELECT gid FROM ".$wpdb->prefix."ngg_gallery ORDER BY gid ASC", ARRAY_A); ``...
34,077
<p>I'm not using the full settings api, just this code:</p> <pre><code>register_setting( 'my_options', 'my_options', 'my_options_validate' ); </code></pre> <p>Then my validation:</p> <pre><code> $options = get_option('my_options'); if(error_found){ add_settings_error( 'my_options', 'settings_updated', 'erro...
[ { "answer_id": 34093, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 3, "selected": true, "text": "<blockquote>\n<p>does simply setting an error message result in its display? do I have to use the full settings a...
2011/11/18
[ "https://wordpress.stackexchange.com/questions/34077", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6593/" ]
I'm not using the full settings api, just this code: ``` register_setting( 'my_options', 'my_options', 'my_options_validate' ); ``` Then my validation: ``` $options = get_option('my_options'); if(error_found){ add_settings_error( 'my_options', 'settings_updated', 'error_message_here', 'error'); } re...
> > does simply setting an error message result in its display? do I have to use the full settings api to have errors displayed? do I have do anything to disable the "settings updated" message on postback? > > > You need to add a call to `settings_errors`, e.g.: ``` /** * Displays all messages registered to 'you...
34,084
<p>I'm modifying the layout and content of the wordpress admin panel using a custom plugin. For most sections I have been able to change the page heading (i.e. the title wrapped in h2 tags at the top of each page), however I've been unable to do so for sections to relating post types, specifically adding and editing po...
[ { "answer_id": 34086, "author": "Geert", "author_id": 4936, "author_profile": "https://wordpress.stackexchange.com/users/4936", "pm_score": 3, "selected": true, "text": "<p>In <code>wp-admin/edit.php</code> at line 189 you can see that the title text is grabbed from the labels of the pos...
2011/11/18
[ "https://wordpress.stackexchange.com/questions/34084", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10371/" ]
I'm modifying the layout and content of the wordpress admin panel using a custom plugin. For most sections I have been able to change the page heading (i.e. the title wrapped in h2 tags at the top of each page), however I've been unable to do so for sections to relating post types, specifically adding and editing posts...
In `wp-admin/edit.php` at line 189 you can see that the title text is grabbed from the labels of the post type: ``` <h2><?php echo esc_html( $post_type_object->labels->name ); ?> ... </h2> ``` When you register a new post type ([`register_post_type`](http://codex.wordpress.org/Function_Reference/register_post_type))...
34,116
<p>I don't have the feeling that my blog is particularly slow, but that's because I haven't really started out yet. I'm very worried that it will get slow soon, especially because I will have blog posts with (optimized/compressed) 40-50 photos. This can't be changed, but other things can.</p> <p>I already read a lot a...
[ { "answer_id": 34127, "author": "Nick Davis", "author_id": 6145, "author_profile": "https://wordpress.stackexchange.com/users/6145", "pm_score": 3, "selected": true, "text": "<p>I was in a similar situation recently and started using W3 Total Cache too.</p>\n\n<p>I'm not sure what settin...
2011/11/18
[ "https://wordpress.stackexchange.com/questions/34116", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6903/" ]
I don't have the feeling that my blog is particularly slow, but that's because I haven't really started out yet. I'm very worried that it will get slow soon, especially because I will have blog posts with (optimized/compressed) 40-50 photos. This can't be changed, but other things can. I already read a lot about it, w...
I was in a similar situation recently and started using W3 Total Cache too. I'm not sure what settings you have at the moment, but it's worth experimenting a bit if you can to see that you're really using W3 Total Cache to the max For example, I originally only had Page Cache and Browser Cache checked on the main scr...
34,117
<p>I creating shopping cart, based on <strong>custom post types</strong>. And for this cart I have two related custom taxonomies. </p> <ul> <li>I need to create <strong>shop.mysite.com</strong> instead of <strong>mysyte.com/shop</strong> only for <strong>this one</strong> custom post type. </li> <li>I <strong>dont ne...
[ { "answer_id": 34128, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 2, "selected": true, "text": "<p>While multisite would give you exactly what you wanted via domain mapping, you've opted to throw away this opt...
2011/11/18
[ "https://wordpress.stackexchange.com/questions/34117", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10380/" ]
I creating shopping cart, based on **custom post types**. And for this cart I have two related custom taxonomies. * I need to create **shop.mysite.com** instead of **mysyte.com/shop** only for **this one** custom post type. * I **dont need multisite** solution. * All **posts** of current post types will be opened as...
While multisite would give you exactly what you wanted via domain mapping, you've opted to throw away this option in favour of the much more time consuming and harder method of manual htaccess rewrites etc. The challenges you face include: 1. Telling wordpress to rewrite the permalink URLs it outputs to shop.mysite.c...
34,118
<p>How do I get the $post Variable in a WP_Query started loop? I have to get the excerpt, raw $post->post_content and further things. This is why I have to get Access to the Variable itself. </p> <p>How am I able to do this?</p> <p>Thank you in advance!</p>
[ { "answer_id": 34121, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 0, "selected": false, "text": "<pre><code>$your_query = new WP_Query( $args );\nwhile( $your_query-&gt;have_posts() ) :\n $your_query-&gt;the_post...
2011/11/18
[ "https://wordpress.stackexchange.com/questions/34118", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8760/" ]
How do I get the $post Variable in a WP\_Query started loop? I have to get the excerpt, raw $post->post\_content and further things. This is why I have to get Access to the Variable itself. How am I able to do this? Thank you in advance!
``` $query = new WP_Query( $args ); while( $query->have_posts() ) { // this fills in the $post global with the next post from the query $query->the_post(); // we're now ina classic wordpress loop, and can use all the usual stuff the_title(); the_content(); echo $post->post_content; } // lets cl...
34,141
<p>is there any Way to Catch Last widget box or div from same widget area?? i mean i have 4 widgets in footer widget area but due to design issue my 3rd widget box style+width is different.so i want to add extra class to 3rd box container using php.is there any way to do that? please reply.</p> <p>Thanks in advance. :...
[ { "answer_id": 34415, "author": "marcochiesi", "author_id": 10236, "author_profile": "https://wordpress.stackexchange.com/users/10236", "pm_score": 1, "selected": false, "text": "<p>Usually in Worpdress every widget has a unique id of the form \"widget_type-xx\" where widget_type is the ...
2011/11/18
[ "https://wordpress.stackexchange.com/questions/34141", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9456/" ]
is there any Way to Catch Last widget box or div from same widget area?? i mean i have 4 widgets in footer widget area but due to design issue my 3rd widget box style+width is different.so i want to add extra class to 3rd box container using php.is there any way to do that? please reply. Thanks in advance. :)
Add the following code in your functions.php file of the theme directory. Replace widget name "Home Widget Area" with your widget's name ``` /*=============WIDGETs CSS CLASS CONTROLLER==============*/ $GLOBALS['my_widget_num']=1; function edei_widget_class_adder($params){ if( $params[0]['name']=='Home ...
34,142
<p>I recently updated the WP of a friend's site that I'm working on. Now his navigation bar is messed up and I'm new to WP so I'm not sure where to go to fix it.</p> <p>Here's the site: <a href="http://www.millermusiclessons.com/" rel="nofollow">http://www.millermusiclessons.com/</a></p> <p>Here's what the nav should...
[ { "answer_id": 34144, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 2, "selected": true, "text": "<p>It's not WordPress that messed it up, it's something with your theme.</p>\n<p>On the <em>working</em> site, your navig...
2011/11/18
[ "https://wordpress.stackexchange.com/questions/34142", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10181/" ]
I recently updated the WP of a friend's site that I'm working on. Now his navigation bar is messed up and I'm new to WP so I'm not sure where to go to fix it. Here's the site: <http://www.millermusiclessons.com/> Here's what the nav should look like: <http://www.millermusicllc.com/> Thanks
It's not WordPress that messed it up, it's something with your theme. On the *working* site, your navigation bar looks like this: ``` <ul class="sf-menu sf-js-enabled sf-shadow"> <li class="page_item page-item-4 current_page_item"><a href="http://www.millermusicllc.com/" title="Home">Home</a></li> <li class="...
34,159
<p>I'm using this code to call some custom post meta named port_excerpt:</p> <pre><code>&lt;?php global $wp_query; $postid = $wp_query-&gt;post-&gt;ID; echo get_post_meta($postid, 'port_excerpt', true); ?&gt; </code></pre> <p>This works like a dream when used on the template it is intended for: <a href="http://themef...
[ { "answer_id": 34150, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 0, "selected": false, "text": "<p>Your best bet is to require them to enter a piece of information that is specific to the USA.</p>\n\n<p>e.g. ...
2011/11/18
[ "https://wordpress.stackexchange.com/questions/34159", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5205/" ]
I'm using this code to call some custom post meta named port\_excerpt: ``` <?php global $wp_query; $postid = $wp_query->post->ID; echo get_post_meta($postid, 'port_excerpt', true); ?> ``` This works like a dream when used on the template it is intended for: <http://themeforward.com/demo2/portfolio/new-one/>. But the...
After some thought, I have a better answer. Although keep in mind all of this can be circumvented by having a friend living in the US: 1. Credit card transaction - This is your best bet for verifying, however it's possible the person is foreign and has a US credit card, be it for business purposes, or to order things ...
34,176
<p>Here is my case, I'm making some experiments with post types, basically I created a post type called Slider where the featured image is will display in the slide.</p> <p>Now, when user type something like domain.com/slider/slide1, or try to reach the slider post, I want to display a not found page instead of the si...
[ { "answer_id": 34177, "author": "Jeremy Jared", "author_id": 5339, "author_profile": "https://wordpress.stackexchange.com/users/5339", "pm_score": 0, "selected": false, "text": "<p>You could just copy your index.php file and name it 404.php. Then if a page or attachment page wasn't found...
2011/11/19
[ "https://wordpress.stackexchange.com/questions/34176", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4907/" ]
Here is my case, I'm making some experiments with post types, basically I created a post type called Slider where the featured image is will display in the slide. Now, when user type something like domain.com/slider/slide1, or try to reach the slider post, I want to display a not found page instead of the single page,...
I have a script that wil; display a good 404 page for certain pages. Now I do not yet know what custom post types are, as I am just starting, but I think you can edit the script to fit your needs. ``` add_action('template_redirect', 'my_template_redirect'); function my_template_redirect() { global $wp_query, $post...
34,250
<p>I'm having issues with my @font-face code in my style.css file for a theme. I've already tested the theme as an HTML site, and the paths are the same. The style.css file uses a relative path to a fonts folder like so:</p> <p>`@font-face{</p> <pre><code>font-family:'Fertigo_PRO-webfont'; src:url('./fonts/Ferti...
[ { "answer_id": 34242, "author": "johnny_n", "author_id": 10408, "author_profile": "https://wordpress.stackexchange.com/users/10408", "pm_score": 0, "selected": false, "text": "<p>This <em>might</em> work for you... </p>\n\n<p><a href=\"http://wordpress.org/extend/plugins/newsletter-sign-...
2011/11/20
[ "https://wordpress.stackexchange.com/questions/34250", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10417/" ]
I'm having issues with my @font-face code in my style.css file for a theme. I've already tested the theme as an HTML site, and the paths are the same. The style.css file uses a relative path to a fonts folder like so: `@font-face{ ``` font-family:'Fertigo_PRO-webfont'; src:url('./fonts/Fertigo_PRO-webfont.eot');...
[This is what finally worked for me](http://www.silenceit.ca/2011/02/28/how-to-integrate-mailchimp-with-contact-form-7). The code needs to be updated tho. I don't have time now to get back to the refactored code but if someone requests it I will do it in due time.
34,251
<p>I'm using the following code in my function.php to display the top commenters in my theme:</p> <pre><code>function top_comment_authors($amount = 5){ global $wpdb; $results = $wpdb-&gt;get_results(' SELECT COUNT(comment_author_email) AS comments_count, comment_author_email, comment_auth...
[ { "answer_id": 34273, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 3, "selected": true, "text": "<p>Extend the WHERE clause:</p>\n\n\n\n<pre><code>WHERE\n comment_author_email != \"\" \n AND comment_author_email !...
2011/11/20
[ "https://wordpress.stackexchange.com/questions/34251", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6903/" ]
I'm using the following code in my function.php to display the top commenters in my theme: ``` function top_comment_authors($amount = 5){ global $wpdb; $results = $wpdb->get_results(' SELECT COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_autho...
Extend the WHERE clause: ``` WHERE comment_author_email != "" AND comment_author_email != "YOUR_MAIL_ADDRESS" AND comment_type = "" AND comment_approved = 1 ) ``` If you want to exclude multiple email addresses, use the `NOT IN` operator and a comma separated list of strings: ``` AND comment_aut...
34,270
<p>I have the following code, which causes an infinite loop for some reason. Can anybody explain what's going on please?</p> <p>Thanks!</p> <pre><code>&lt;?php $flagged_stores = new WP_Query( array ( 'post_type' =&gt; 'store', 'orderby' =&gt; 'post_id', 'meta_key' =&gt; 'flagged', 'limit' =&gt; 10 ) ); if($flag...
[ { "answer_id": 34271, "author": "Michael", "author_id": 4884, "author_profile": "https://wordpress.stackexchange.com/users/4884", "pm_score": 1, "selected": false, "text": "<p>try and use <code>'posts_per_page'</code> instead of <code>'limit'</code> - <a href=\"http://codex.wordpress.org...
2011/11/20
[ "https://wordpress.stackexchange.com/questions/34270", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10423/" ]
I have the following code, which causes an infinite loop for some reason. Can anybody explain what's going on please? Thanks! ``` <?php $flagged_stores = new WP_Query( array ( 'post_type' => 'store', 'orderby' => 'post_id', 'meta_key' => 'flagged', 'limit' => 10 ) ); if($flagged_stores->have_posts()): ?> ...
Look at this answer: [get custom post type by tag](https://wordpress.stackexchange.com/questions/27909/get-custom-post-type-by-tag/33154#33154) I believe you'd use `$flagged_stores->the_post()` inside `while` loop.
34,287
<p>Would need some more help with the </p> <p>Did ask a question how to import some code with php, in this case it's a sidebar that will be used on some of the pages on a website, It's wordpress and it can execute php from post / page's and have also tested directly in the main code</p> <p>When i did ask the question...
[ { "answer_id": 34288, "author": "chris", "author_id": 116907, "author_profile": "https://wordpress.stackexchange.com/users/116907", "pm_score": 0, "selected": false, "text": "<p>include is like</p>\n\n<pre><code>include = 'thefile.php';\n</code></pre>\n\n<p>on another note you need to al...
2011/11/20
[ "https://wordpress.stackexchange.com/questions/34287", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
Would need some more help with the Did ask a question how to import some code with php, in this case it's a sidebar that will be used on some of the pages on a website, It's wordpress and it can execute php from post / page's and have also tested directly in the main code When i did ask the question the best and mos...
The Wordpress method to include php files is to use this function: ``` <?php get_template_part('myfile'); ?> ``` which will include the file myfile.php that is in the same template directory. See <http://codex.wordpress.org/Function_Reference/get_template_part> for other parameters.
34,291
<p>I just came across this page with almost similar requirements as mine</p> <p><a href="https://wordpress.stackexchange.com/questions/33250/multiple-endpoints-to-same-page">Multiple endpoints to same page</a></p> <p>i have to achieve same functionality but i also want to pass some parameters to the page where all th...
[ { "answer_id": 34358, "author": "IFightCode", "author_id": 8096, "author_profile": "https://wordpress.stackexchange.com/users/8096", "pm_score": -1, "selected": false, "text": "<p>If your words made senses to me correctly, possible solutions are here:</p>\n\n<p>For the first part, you ma...
2011/11/20
[ "https://wordpress.stackexchange.com/questions/34291", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9415/" ]
I just came across this page with almost similar requirements as mine [Multiple endpoints to same page](https://wordpress.stackexchange.com/questions/33250/multiple-endpoints-to-same-page) i have to achieve same functionality but i also want to pass some parameters to the page where all these URL will be map. say exa...
You can use the same answer as the question you referred to (I have answered it). Here's how you would change to pass the arguments: ``` <?php add_action('init', 'add_my_rule'); function add_my_rule() { global $wp; $wp->add_query_var('args'); add_rewrite_rule('test\/finaldestinati...
34,295
<p>In this function, I need to exclude any categories from $categories which are children of "Uncategorized".</p> <pre><code>function get_cats(){ $post_cats= array(); $categories = get_the_category(); foreach($categories as $cat){ array_push($post_cats, $cat-&gt;cat_ID); } return $post_ca...
[ { "answer_id": 34299, "author": "brownian", "author_id": 9769, "author_profile": "https://wordpress.stackexchange.com/users/9769", "pm_score": 0, "selected": false, "text": "<p>I believe this can help (inside <code>foreach</code>):</p>\n\n<pre><code>if( $cat-&gt;cat_name != 'Uncategorize...
2011/11/20
[ "https://wordpress.stackexchange.com/questions/34295", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6620/" ]
In this function, I need to exclude any categories from $categories which are children of "Uncategorized". ``` function get_cats(){ $post_cats= array(); $categories = get_the_category(); foreach($categories as $cat){ array_push($post_cats, $cat->cat_ID); } return $post_cats; } ``` Thank...
Check if `$cat->category_parent != 1` (assuming `uncategorized` has the default ID of 1). If your subcategories are deeper than one level you'll need to use [`get_ancestors`](http://codex.wordpress.org/Function_Reference/get_ancestors) to determine the top level category.
34,303
<p>I'm new to WP and am not sure how to re-size a picture.</p> <p>I want to scale down the pic of the guy on this page: <a href="http://www.millermusiclessons.com/" rel="nofollow">http://www.millermusiclessons.com/</a></p> <p>If you view the page source and find the source of the picture, it already has height and wi...
[ { "answer_id": 34304, "author": "Jeremy Jared", "author_id": 5339, "author_profile": "https://wordpress.stackexchange.com/users/5339", "pm_score": 0, "selected": false, "text": "<p>You can change them using css, but that isn't good practice since the server still loads the full size imag...
2011/11/20
[ "https://wordpress.stackexchange.com/questions/34303", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10181/" ]
I'm new to WP and am not sure how to re-size a picture. I want to scale down the pic of the guy on this page: <http://www.millermusiclessons.com/> If you view the page source and find the source of the picture, it already has height and width attributes assigned to it. When I edit these attributes in Notepad++ and re...
``` #sidebar_img img { width: 250px !important; height: auto; } #sidebar_img { text-align: center; } ``` use this css.. change 250px with whatever you want.
34,317
<p>I've built a basic meta box and have this in my functions.php.</p> <p>The current code:</p> <pre><code>add_action( 'admin_print_styles-post-new.php', 'portfolio_admin_style', 11 ); add_action( 'admin_print_styles-post.php', 'portfolio_admin_style', 11 ); function portfolio_admin_style() { global $post_type; ...
[ { "answer_id": 34319, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 2, "selected": false, "text": "<p>Use the <code>admin_enqueue_scripts</code> or <code>admin_print_styles</code> action hooks and <a href=\"http://cod...
2011/11/20
[ "https://wordpress.stackexchange.com/questions/34317", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5205/" ]
I've built a basic meta box and have this in my functions.php. The current code: ``` add_action( 'admin_print_styles-post-new.php', 'portfolio_admin_style', 11 ); add_action( 'admin_print_styles-post.php', 'portfolio_admin_style', 11 ); function portfolio_admin_style() { global $post_type; if( 'portfolio' ==...
Remove the wp\_enqueue\_style line from the above code and replace it with this: ``` add_action( 'admin_print_styles-post-new.php', 'portfolio_admin_style', 11 ); add_action( 'admin_print_styles-post.php', 'portfolio_admin_style', 11 ); function portfolio_admin_style() { global $post_type; if( 'portfolio' == ...
34,320
<p>I have a custom post type, Doctors, that I need to create a dropdown nav for. I just want it to populate a select list with all the posts of that CPT and navigate to that post on selection. </p> <p>I'm doing a couple other dropdowns with wp_dropdown_categories, but I guess there's no built in function for listing...
[ { "answer_id": 34327, "author": "chrisguitarguy", "author_id": 6035, "author_profile": "https://wordpress.stackexchange.com/users/6035", "pm_score": 3, "selected": false, "text": "<p>You'll need to use <code>get_posts</code> and roll your own drop down.</p>\n\n<p>Something like this (som...
2011/11/20
[ "https://wordpress.stackexchange.com/questions/34320", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10439/" ]
I have a custom post type, Doctors, that I need to create a dropdown nav for. I just want it to populate a select list with all the posts of that CPT and navigate to that post on selection. I'm doing a couple other dropdowns with wp\_dropdown\_categories, but I guess there's no built in function for listing a post ty...
You'll need to use `get_posts` and roll your own drop down. Something like this (somewhere in `functions.php`): ``` <?php function wpse34320_type_dropdown( $post_type ) { $posts = get_posts( array( 'post_type' => $post_type, 'numberposts' => -1 ) ); if( ! $posts ) ...
34,328
<p>This code works fine and returns two StdClass Objects for each of my two posts:</p> <pre><code> $children = get_pages($args); foreach ($children as $cake=&gt;$element) { $args = array( 'post_id' =&gt; $ID ); $Comments = get_...
[ { "answer_id": 34327, "author": "chrisguitarguy", "author_id": 6035, "author_profile": "https://wordpress.stackexchange.com/users/6035", "pm_score": 3, "selected": false, "text": "<p>You'll need to use <code>get_posts</code> and roll your own drop down.</p>\n\n<p>Something like this (som...
2011/11/20
[ "https://wordpress.stackexchange.com/questions/34328", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10099/" ]
This code works fine and returns two StdClass Objects for each of my two posts: ``` $children = get_pages($args); foreach ($children as $cake=>$element) { $args = array( 'post_id' => $ID ); $Comments = get_comments( $args ); ...
You'll need to use `get_posts` and roll your own drop down. Something like this (somewhere in `functions.php`): ``` <?php function wpse34320_type_dropdown( $post_type ) { $posts = get_posts( array( 'post_type' => $post_type, 'numberposts' => -1 ) ); if( ! $posts ) ...
34,363
<p>I am using this code:</p> <pre><code>add_menu_page($page_title, $menu_title, $this-&gt;capability, $menu_slug, $function); </code></pre> <p>Which is adding top level admin page. When I add:</p> <pre><code>add_submenu_page( $menu_slug, 'sub menu 1', 'sub menu 1', $this-&gt;capability, $menu_slug . '_sub_menu_page_...
[ { "answer_id": 34821, "author": "Paul", "author_id": 9485, "author_profile": "https://wordpress.stackexchange.com/users/9485", "pm_score": 4, "selected": true, "text": "<p>Unless I misunderstand the question, this should do the trick:</p>\n\n<pre><code>add_action('admin_menu', 'add_menu_...
2011/11/21
[ "https://wordpress.stackexchange.com/questions/34363", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/784/" ]
I am using this code: ``` add_menu_page($page_title, $menu_title, $this->capability, $menu_slug, $function); ``` Which is adding top level admin page. When I add: ``` add_submenu_page( $menu_slug, 'sub menu 1', 'sub menu 1', $this->capability, $menu_slug . '_sub_menu_page_1', $function ); ``` I get not only the d...
Unless I misunderstand the question, this should do the trick: ``` add_action('admin_menu', 'add_menu_pages'); function add_menu_pages() { add_menu_page('Menu Title', 'Menu Title', 10, 'main_menu', 'submenu_1_callback'); add_submenu_page('main_menu', 'Sub Menu Title 1', 'Sub Menu Title 1', 10, 'main_menu' , ...
34,386
<p>I try to get thumbnail URL correctly...</p> <p>In my functions.php, I have theses lines:</p> <pre><code>&lt;?php add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 'emphasis', 132, 82, true ); ?&gt; &lt;?php function w_thumbnail_src() { if (has_post_thumbnail()) { $thumb = wp_get_attachme...
[ { "answer_id": 34390, "author": "Kevin Langley Jr.", "author_id": 9968, "author_profile": "https://wordpress.stackexchange.com/users/9968", "pm_score": 2, "selected": false, "text": "<p>You are using the wrong function to set the size of the image. You want to use <code>add_image_size('...
2011/11/21
[ "https://wordpress.stackexchange.com/questions/34386", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10464/" ]
I try to get thumbnail URL correctly... In my functions.php, I have theses lines: ``` <?php add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 'emphasis', 132, 82, true ); ?> <?php function w_thumbnail_src() { if (has_post_thumbnail()) { $thumb = wp_get_attachment_image_src(get_post_thumbnai...
You are not using [`set_post_thumbnail_size`](http://codex.wordpress.org/Function_Reference/set_post_thumbnail_size) properly. Try with: ``` add_image_size( 'emphasis', 132, 82, true ); ```
34,393
<p>How can I retrieve the permalink to a user (author) profile dynamically outside the loop by ID?</p> <p>an alternative to <code>the_author_link()</code>, but for outside the loop.</p> <h3>Example:</h3> <pre><code>get_author_link($user_id); </code></pre>
[ { "answer_id": 34397, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 3, "selected": true, "text": "<p>I believe the function you want is <a href=\"http://codex.wordpress.org/Function_Reference/get_author_posts_url\" re...
2011/11/21
[ "https://wordpress.stackexchange.com/questions/34393", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10468/" ]
How can I retrieve the permalink to a user (author) profile dynamically outside the loop by ID? an alternative to `the_author_link()`, but for outside the loop. ### Example: ``` get_author_link($user_id); ```
I believe the function you want is [get\_author\_posts\_url](http://codex.wordpress.org/Function_Reference/get_author_posts_url).
34,401
<p>Is there a similar way to select / perform DOM manipulation on the server-side (PHP) like the way jQuery works?</p> <p>For example, if I wanted to modify content of each <code>&lt;pre class="raw"&gt;...&lt;/pre&gt;</code> elements inside of a post content, in jQuery you can easily capture them all with:</p> <pre><...
[ { "answer_id": 34405, "author": "chamberlainpi", "author_id": 9710, "author_profile": "https://wordpress.stackexchange.com/users/9710", "pm_score": 1, "selected": false, "text": "<p>Answering to myself (and perhaps some other developers curious about this question), there is a PHP server...
2011/11/21
[ "https://wordpress.stackexchange.com/questions/34401", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9710/" ]
Is there a similar way to select / perform DOM manipulation on the server-side (PHP) like the way jQuery works? For example, if I wanted to modify content of each `<pre class="raw">...</pre>` elements inside of a post content, in jQuery you can easily capture them all with: ``` //In jQuery, this will obtain a collect...
You may also take a look at [phpQuery](http://code.google.com/p/phpquery/).
34,410
<p>I'd like to get a list (array) of all the post types I registered.</p> <p>Precisely I would like to retrieve their slugs.</p> <p>Could someone help me? thanks!</p>
[ { "answer_id": 34413, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 2, "selected": false, "text": "<p>When you call <code>register_post_type()</code>, it adds your new post type to a global variable called <code>$wp_pos...
2011/11/21
[ "https://wordpress.stackexchange.com/questions/34410", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8421/" ]
I'd like to get a list (array) of all the post types I registered. Precisely I would like to retrieve their slugs. Could someone help me? thanks!
@EAMann's answer is correct, but there's already a build in WordPress function for fetching all registered post types: `get_post_types` ``` <?php // hook into init late, so everything is registered // you can also use get_post_types where ever. Any time after init is usually fine. add_action( 'init', 'wpse34410_init'...
34,429
<p>I need to display the online status (online/offline) for each author page (custom author page template).</p> <p>is_user_logged_in() only applies to the current user and I can't find a relevant approach targeting the current author e.g. is_author_logged_in()</p> <p>Any ideas?</p> <h1>Answer</h1> <p>One Trick Pony...
[ { "answer_id": 34431, "author": "brock", "author_id": 10143, "author_profile": "https://wordpress.stackexchange.com/users/10143", "pm_score": 1, "selected": false, "text": "<p>To my knowledge there is not a way to do this using the built-in <a href=\"http://codex.wordpress.org/Function_R...
2011/11/21
[ "https://wordpress.stackexchange.com/questions/34429", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9451/" ]
I need to display the online status (online/offline) for each author page (custom author page template). is\_user\_logged\_in() only applies to the current user and I can't find a relevant approach targeting the current author e.g. is\_author\_logged\_in() Any ideas? Answer ====== One Trick Pony was kind enough to ...
I would use [transients](http://codex.wordpress.org/Transients_API) to do this: * create a user-online-update function that you hook on `init`; it would look something like this: ``` // get the user activity the list $logged_in_users = get_transient('online_status'); // get current user ID $user = wp_get_current_use...
34,461
<p>I have Wordpress (v3.2.1) set up at domain.org.nz/wordpress with a number of pages set up as domain.org.nz/wordpress/services/example. I want to set up a subdomain, example.domain.org.nz to point to domain.org.nz/wordpress/services/example. When the subdomain is entered into the address bar, it (preferably) should s...
[ { "answer_id": 34470, "author": "marcochiesi", "author_id": 10236, "author_profile": "https://wordpress.stackexchange.com/users/10236", "pm_score": 0, "selected": false, "text": "<p>First you have to configure your server (DNS + Apache) to let the subdomains point to the main site domain...
2011/11/22
[ "https://wordpress.stackexchange.com/questions/34461", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10487/" ]
I have Wordpress (v3.2.1) set up at domain.org.nz/wordpress with a number of pages set up as domain.org.nz/wordpress/services/example. I want to set up a subdomain, example.domain.org.nz to point to domain.org.nz/wordpress/services/example. When the subdomain is entered into the address bar, it (preferably) should stay...
Either try placing an index.php file inside your subdomain folder with the following code: ``` <?php header("HTTP/1.1 301 Moved Permanently"); header("Status: 301 Moved Permanently"); header("Location: http://www.my-domain.com/my-permalink/"); ?> ``` or use cPanel to setup/redirect the subdomain to any address you w...
34,462
<p>I have parent posts (custom post type hierarch=true) with ID 1, 2, 3, 4.</p> <p>The parent posts with ID 2 and 4 have child pages.</p> <p>I need to retrieve only posts 2 and 4 and all of their child pages.</p> <p>Something like this</p> <pre><code>$argsch = array('orderby' =&gt; 'date','order' =&gt; 'DESC','post...
[ { "answer_id": 34465, "author": "marcochiesi", "author_id": 10236, "author_profile": "https://wordpress.stackexchange.com/users/10236", "pm_score": 3, "selected": true, "text": "<p>You have two options:</p>\n\n<ol>\n<li><p>Call get_posts multiple times: one for the parent pages using <co...
2011/11/22
[ "https://wordpress.stackexchange.com/questions/34462", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5878/" ]
I have parent posts (custom post type hierarch=true) with ID 1, 2, 3, 4. The parent posts with ID 2 and 4 have child pages. I need to retrieve only posts 2 and 4 and all of their child pages. Something like this ``` $argsch = array('orderby' => 'date','order' => 'DESC','post_type' => 'products', 'include' => '2, 4'...
You have two options: 1. Call get\_posts multiple times: one for the parent pages using `post__in => array(2,4)`, and two for the child pages of each parent with `post_parent => 2` and `post_parent => 4` and finally merge all the results into a single array. 2. Write directly your SQL query and use `$wpdb->get_results...
34,464
<p>I want to make my single wordpress installation a closed community. Only people who know the registration key should be able to sign up. I already added some more fields to the registration form but I can't fin a simple solution for the registration form to check if the code is correct!?</p> <p>Looking forward for ...
[ { "answer_id": 34465, "author": "marcochiesi", "author_id": 10236, "author_profile": "https://wordpress.stackexchange.com/users/10236", "pm_score": 3, "selected": true, "text": "<p>You have two options:</p>\n\n<ol>\n<li><p>Call get_posts multiple times: one for the parent pages using <co...
2011/11/22
[ "https://wordpress.stackexchange.com/questions/34464", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10436/" ]
I want to make my single wordpress installation a closed community. Only people who know the registration key should be able to sign up. I already added some more fields to the registration form but I can't fin a simple solution for the registration form to check if the code is correct!? Looking forward for some ideas...
You have two options: 1. Call get\_posts multiple times: one for the parent pages using `post__in => array(2,4)`, and two for the child pages of each parent with `post_parent => 2` and `post_parent => 4` and finally merge all the results into a single array. 2. Write directly your SQL query and use `$wpdb->get_results...
34,471
<p>I'm developing the <a href="http://wordpress.org/extend/plugins/wordpress-file-monitor-plus/" rel="nofollow">wordpress file monitor plus</a> plugin.</p> <p>Its purpose is to scan for altered files and it works fine for a single installation of WP. But when you look at multi-site it's not something that wants to be ...
[ { "answer_id": 34474, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 0, "selected": false, "text": "<p>First <a href=\"https://wordpress.stackexchange.com/questions/25910/uninstall-activate-deactivate-a-plugin-typical-...
2011/11/22
[ "https://wordpress.stackexchange.com/questions/34471", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4610/" ]
I'm developing the [wordpress file monitor plus](http://wordpress.org/extend/plugins/wordpress-file-monitor-plus/) plugin. Its purpose is to scan for altered files and it works fine for a single installation of WP. But when you look at multi-site it's not something that wants to be enabled on all sub sites, as they al...
You could check if the constant `SITE_ID_CURRENT_SITE` matches `get_current_site()->id`. The following does this for the activation. During runtime you have to check it again. ``` register_activation_hook( __FILE__, 'force_main_site_installation' ); function force_main_site_installation() { if ( defined( 'SITE_ID...
34,496
<p>I have a custom post type named "Resources" which has a Taxonomy named "Types." I have it manually pulling each term which isn't the most elegant solution and every time there is a new term added, I have to add it in manually. </p> <p>I need a way for the Terms to populate with the posts associated listed below. I...
[ { "answer_id": 35919, "author": "YoYurec", "author_id": 10661, "author_profile": "https://wordpress.stackexchange.com/users/10661", "pm_score": 3, "selected": true, "text": "<p>Try this piece of code for page template. I've used it on one of my projects. It outputs taxonomy term one by o...
2011/11/22
[ "https://wordpress.stackexchange.com/questions/34496", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1753/" ]
I have a custom post type named "Resources" which has a Taxonomy named "Types." I have it manually pulling each term which isn't the most elegant solution and every time there is a new term added, I have to add it in manually. I need a way for the Terms to populate with the posts associated listed below. I have a cu...
Try this piece of code for page template. I've used it on one of my projects. It outputs taxonomy term one by one with list of all posts with this term. (Just replace **YOUR\_TAXONOMY\_SLUG** to yours) ``` <div id="content"> <h2 class="entry-title"><?php the_title(); ?></h2> <div id="post-<?php the_ID(); ?>" <?php...
34,505
<p>I have a friend who is interested in starting a side business where she would freelance websites. I have recommended for her Wordpress as probably the best choice where she could most quickly start making useful, customized websites for clients.</p> <p>While I have done a decent amount with Wordpress I am not reall...
[ { "answer_id": 35919, "author": "YoYurec", "author_id": 10661, "author_profile": "https://wordpress.stackexchange.com/users/10661", "pm_score": 3, "selected": true, "text": "<p>Try this piece of code for page template. I've used it on one of my projects. It outputs taxonomy term one by o...
2011/11/22
[ "https://wordpress.stackexchange.com/questions/34505", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10500/" ]
I have a friend who is interested in starting a side business where she would freelance websites. I have recommended for her Wordpress as probably the best choice where she could most quickly start making useful, customized websites for clients. While I have done a decent amount with Wordpress I am not really plugged ...
Try this piece of code for page template. I've used it on one of my projects. It outputs taxonomy term one by one with list of all posts with this term. (Just replace **YOUR\_TAXONOMY\_SLUG** to yours) ``` <div id="content"> <h2 class="entry-title"><?php the_title(); ?></h2> <div id="post-<?php the_ID(); ?>" <?php...
34,506
<p>I'm going crazy...</p> <pre><code>&lt;?php query_posts(array('cat' =&gt; 3, 'posts_per_page' =&gt; 1)); ?&gt; </code></pre> <p>This shows 1 post (there is two in the category) >> OK</p> <pre><code>&lt;?php query_posts(array('posts_per_page' =&gt; 1)); ?&gt; </code></pre> <p>This shows 4 posts (there is four in t...
[ { "answer_id": 34509, "author": "Rachel Baker", "author_id": 8054, "author_profile": "https://wordpress.stackexchange.com/users/8054", "pm_score": 0, "selected": false, "text": "<p>You are calling an array with only one paramater. Change your code to: \n<code>&lt;?php query_posts('posts...
2011/11/22
[ "https://wordpress.stackexchange.com/questions/34506", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10464/" ]
I'm going crazy... ``` <?php query_posts(array('cat' => 3, 'posts_per_page' => 1)); ?> ``` This shows 1 post (there is two in the category) >> OK ``` <?php query_posts(array('posts_per_page' => 1)); ?> ``` This shows 4 posts (there is four in the whole database) >> WTF? :P This is crazy... or am I ? Note: I onl...
If you want to change your array to exclude sticky, then this should work `get_posts( array( 'post__not_in' => get_option( 'sticky_posts' ), 'posts_per_page' => 1 ) );`
34,549
<p>How can I create a slug for a page in WordPress? I see that there are custom formats available, but I would like to be able to specify things like: </p> <pre><code>mydomain.com/about mydomain.com/home mydomain.com/portfolio </code></pre> <p>etc. Is there a plugin or technique that I could use to accomplish this...
[ { "answer_id": 34551, "author": "Emery King", "author_id": 10519, "author_profile": "https://wordpress.stackexchange.com/users/10519", "pm_score": 0, "selected": false, "text": "<p>You can edit the slug at the top of the \"edit page\" page</p>\n" }, { "answer_id": 34557, "aut...
2011/11/23
[ "https://wordpress.stackexchange.com/questions/34549", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10518/" ]
How can I create a slug for a page in WordPress? I see that there are custom formats available, but I would like to be able to specify things like: ``` mydomain.com/about mydomain.com/home mydomain.com/portfolio ``` etc. Is there a plugin or technique that I could use to accomplish this?
The custom permalink you will most likely want to use is /%postname%/ Which will get the structure that you show above. (mydomain.com/about, mydomain.com/home) If you want to edit the slug, it's right underneath the title of the post ("Permalink"), click edit.
34,596
<p>I need to used TextArea with Wysiwyg editor. That works when textarea is write on page ( Not dynamic , static ).. but my problem is for dynamically textarea.</p> <p>My code :</p> <pre><code>add_action('admin_head', 'load_tiny_mce'); function load_tiny_mce() { // The 'mode' and 'editor_selector' options are...
[ { "answer_id": 34622, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>Add this function to you JavaScript:</p>\n\n<pre><code>function textarea_to_tinymce(id){\n if ( typeof( tin...
2011/11/23
[ "https://wordpress.stackexchange.com/questions/34596", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9716/" ]
I need to used TextArea with Wysiwyg editor. That works when textarea is write on page ( Not dynamic , static ).. but my problem is for dynamically textarea. My code : ``` add_action('admin_head', 'load_tiny_mce'); function load_tiny_mce() { // The 'mode' and 'editor_selector' options are for adding // ...
Add this function to you JavaScript: ``` function textarea_to_tinymce(id){ if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) { tinyMCE.execCommand('mceAddControl', false, id); } } ``` then when you create the textarea dynamically call it and pass the textarea's id to...
34,608
<p>On my site I've got two types of users, Subscribers and Partners.</p> <p>I've used <a href="http://wordpress.org/extend/plugins/cimy-user-extra-fields/" rel="nofollow">Cimy User Extra Fields</a> to add additional fields to the registration form. I've also used a plugin called <a href="http://wordpress.org/extend/pl...
[ { "answer_id": 34622, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>Add this function to you JavaScript:</p>\n\n<pre><code>function textarea_to_tinymce(id){\n if ( typeof( tin...
2011/11/23
[ "https://wordpress.stackexchange.com/questions/34608", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9218/" ]
On my site I've got two types of users, Subscribers and Partners. I've used [Cimy User Extra Fields](http://wordpress.org/extend/plugins/cimy-user-extra-fields/) to add additional fields to the registration form. I've also used a plugin called [WP Roles at Registration](http://wordpress.org/extend/plugins/wp-roles-at-...
Add this function to you JavaScript: ``` function textarea_to_tinymce(id){ if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) { tinyMCE.execCommand('mceAddControl', false, id); } } ``` then when you create the textarea dynamically call it and pass the textarea's id to...
34,612
<p>I am trying to extend the Walker_Nav_Menu walker to make some changes to the way WP outputs menus. The method I have to override is start_el, so I created my Walker and copied the base method:</p> <pre><code>&lt;?php class myCustom_Walker_Nav_Menu extends Walker_Nav_Menu { function start_el(&amp;$output, $item,...
[ { "answer_id": 34622, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>Add this function to you JavaScript:</p>\n\n<pre><code>function textarea_to_tinymce(id){\n if ( typeof( tin...
2011/11/23
[ "https://wordpress.stackexchange.com/questions/34612", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3765/" ]
I am trying to extend the Walker\_Nav\_Menu walker to make some changes to the way WP outputs menus. The method I have to override is start\_el, so I created my Walker and copied the base method: ``` <?php class myCustom_Walker_Nav_Menu extends Walker_Nav_Menu { function start_el(&$output, $item, $depth, $args) { ...
Add this function to you JavaScript: ``` function textarea_to_tinymce(id){ if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) { tinyMCE.execCommand('mceAddControl', false, id); } } ``` then when you create the textarea dynamically call it and pass the textarea's id to...
34,619
<p>I'm breaking my head trying to create a short code to display certain loop, however I'm totally cut, I can not figure it out how to do it, since it's the first time I try to do it... I do now want to set any parameter, just put exactly as it if... I would appreciate if anyone can light me...</p> <p>This is the code...
[ { "answer_id": 34620, "author": "Wordpressor", "author_id": 1869, "author_profile": "https://wordpress.stackexchange.com/users/1869", "pm_score": 0, "selected": false, "text": "<p>I'm displaying my loops this way: </p>\n\n<pre><code>function loop_shortcode( $atts = '' ) {\n\n (your ...
2011/11/23
[ "https://wordpress.stackexchange.com/questions/34619", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4907/" ]
I'm breaking my head trying to create a short code to display certain loop, however I'm totally cut, I can not figure it out how to do it, since it's the first time I try to do it... I do now want to set any parameter, just put exactly as it if... I would appreciate if anyone can light me... This is the code I want to...
Take a look at my latest plugin [**`ShortCodes UI`**](http://wordpress.org/extend/plugins/shortcodes-ui/) which lets you create shortcodes without coding, all you have to do is paste your loop inside the right field of the shortcode (PHP) and you are done.
34,626
<p>I am trying to delete a post with its all attachments. This is the function that i came up with right now; </p> <pre><code>function remove_post(){ if(isset($_POST['post_id']) &amp;&amp; is_numeric($_POST['post_id'])){ $post = get_post($_POST['post_id']); if(get_current_us...
[ { "answer_id": 34627, "author": "keatch", "author_id": 2727, "author_profile": "https://wordpress.stackexchange.com/users/2727", "pm_score": 0, "selected": false, "text": "<p>See the codex for the correct use of <a href=\"http://codex.wordpress.org/Function_Reference/wp_delete_post\" rel...
2011/11/23
[ "https://wordpress.stackexchange.com/questions/34626", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/9728/" ]
I am trying to delete a post with its all attachments. This is the function that i came up with right now; ``` function remove_post(){ if(isset($_POST['post_id']) && is_numeric($_POST['post_id'])){ $post = get_post($_POST['post_id']); if(get_current_user_id() == $post->post...
Maybe this works ``` function remove_post() { if(isset($_POST['post_id']) && is_numeric($_POST['post_id'])) { $post = get_post($_POST['post_id']); if(get_current_user_id() == $post->post_author) { $args = array( 'post_pa...
34,644
<p>Trying to list the categories for post separated by a comma with link to the category archive. </p> <pre><code> &lt;?php foreach((get_the_category()) as $category) { if($category-&gt;name==$homecat) continue; $category_id = get_cat_ID( $category-&gt;ca...
[ { "answer_id": 34645, "author": "Evan Yeung", "author_id": 1878, "author_profile": "https://wordpress.stackexchange.com/users/1878", "pm_score": 0, "selected": false, "text": "<p>If you are in the loop you can use <code>the_category</code>\n<a href=\"http://codex.wordpress.org/Function_R...
2011/11/24
[ "https://wordpress.stackexchange.com/questions/34644", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10515/" ]
Trying to list the categories for post separated by a comma with link to the category archive. ``` <?php foreach((get_the_category()) as $category) { if($category->name==$homecat) continue; $category_id = get_cat_ID( $category->cat_name ); ...
You can use the\_category if you are in the loop: `<?php the_category(', '); ?>` If not, then use this code: ``` <?php $output = ''; foreach((get_the_category()) as $category) { if($category->name==$homecat) continue; $category_id = get_cat_ID( $category->cat_name ); $category_link = get_category_link( $...
34,656
<p>Let's say for (a classic) example that I want to create an <strong>event</strong> custom <strong>post type</strong>, which will have assigned some specific fields/properties. One of them: <strong>location venue</strong>. </p> <p>Location venue, which I'm thinking should be a tag in a custom taxonomy, would have, be...
[ { "answer_id": 34659, "author": "Joshua Abenazer", "author_id": 10251, "author_profile": "https://wordpress.stackexchange.com/users/10251", "pm_score": 0, "selected": false, "text": "<p>The coordinates could be added using metaboxes. Check out the example here <a href=\"http://codex.word...
2011/11/24
[ "https://wordpress.stackexchange.com/questions/34656", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/967/" ]
Let's say for (a classic) example that I want to create an **event** custom **post type**, which will have assigned some specific fields/properties. One of them: **location venue**. Location venue, which I'm thinking should be a tag in a custom taxonomy, would have, besides the title, also an **url** and a pair of **...
This sounds like a good idea as it would let you query by location etc. I don't know what you plan to use the co-ordinates for, but it makes no sense to have them attached to an event (unless that event is a one-off in the middle of a field, but I guess that would be an edge case?). As for implementation, this is a ve...
34,702
<p>I've been working on this shortcode w/o any success...</p> <pre><code>function loop_shortcode( $atts = '' ) { '&lt;div class="clear"&gt;&lt;/div&gt; &lt;div class="childs grid_12"&gt; &lt;?php $the_query = new WP_Query( array( "post_parent" =&gt; "8", "post_type" =&gt; "page", ...
[ { "answer_id": 34707, "author": "Andres Yanez", "author_id": 10229, "author_profile": "https://wordpress.stackexchange.com/users/10229", "pm_score": 2, "selected": false, "text": "<p>I am not very good with shortcodes because I almost not use these, but here is my contribution.</p>\n\n<p...
2011/11/25
[ "https://wordpress.stackexchange.com/questions/34702", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4907/" ]
I've been working on this shortcode w/o any success... ``` function loop_shortcode( $atts = '' ) { '<div class="clear"></div> <div class="childs grid_12"> <?php $the_query = new WP_Query( array( "post_parent" => "8", "post_type" => "page", "posts_per_page" => 4, "sort_col...
There is a multitude issues wrong with the above. For one, `post_parent` in the query arguments needs to be an integer. You're assigning it a string. A number of your calls to wordpress functions, such as `the_excerpt()` and `wp_reset_query()` are missing ending semicolons. `$atts` is an associative array of attributes...
34,721
<p>I need a conditional which exits if the context is not a front-end view <i>including AJAX requests.</i> I have this at the moment:</p> <pre><code>if (is_admin() &amp;&amp; !DOING_AJAX) return; </code></pre> <p>The <code>DOING_AJAX</code> bit is required since <code>is_admin()</code> returns <code>true</code> f...
[ { "answer_id": 37806, "author": "gagn", "author_id": 11624, "author_profile": "https://wordpress.stackexchange.com/users/11624", "pm_score": 1, "selected": false, "text": "<p>Probably you are using AJAX hook </p>\n\n<pre><code>add_action('wp_ajax_{your_hook}', 'your_function');\n</code><...
2011/11/25
[ "https://wordpress.stackexchange.com/questions/34721", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10569/" ]
I need a conditional which exits if the context is not a front-end view *including AJAX requests.* I have this at the moment: ``` if (is_admin() && !DOING_AJAX) return; ``` The `DOING_AJAX` bit is required since `is_admin()` returns `true` for ajax requests. However I believe `DOING_AJAX` will be `true` for ALL...
`DOING_AJAX` and `WP_ADMIN` (this constant is checked within `is_admin()` ) are defined in admin-ajax.php and set tro true. Both are not very helpfull in this situation. Add a parameter to your ajax request if the request come from the front-end: ``` <?php function my_action_javascript() { ?> <script type="text/jav...
34,730
<p>My basic scenario is the following: </p> <p>I have a directory on my server that gets filled with images via ftp every once in a while. I would want to move these images to the wp upload directory and then add them to the media library with <code>wp_insert_attachment()</code>. I thought <code>wp_handle_sideload()<...
[ { "answer_id": 35042, "author": "sanchothefat", "author_id": 1733, "author_profile": "https://wordpress.stackexchange.com/users/1733", "pm_score": 2, "selected": true, "text": "<p>Your files array needs to mimic the $_FILES global so you need to make a dummy page with some file inputs th...
2011/11/25
[ "https://wordpress.stackexchange.com/questions/34730", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10571/" ]
My basic scenario is the following: I have a directory on my server that gets filled with images via ftp every once in a while. I would want to move these images to the wp upload directory and then add them to the media library with `wp_insert_attachment()`. I thought `wp_handle_sideload()` to be the correct function...
Your files array needs to mimic the $\_FILES global so you need to make a dummy page with some file inputs that prints or dumps the contents of $\_FILES to see how it is structured. Make a variable that looks like that with your data and pass that `wp_handle_sideload()`. **EDIT:** This answer was correct at the time ...
34,754
<p>Read below if you want to start from where I left off in core. But the basic question is: I need to add a "title" attribute to my stylesheets and wp_enqueue_style() doesn't allow for that parameter, as far as I can tell. Other than a hard embed, are there any ways WordPress allows us to add the title to a stylesheet...
[ { "answer_id": 34755, "author": "Tom Auger", "author_id": 3687, "author_profile": "https://wordpress.stackexchange.com/users/3687", "pm_score": 4, "selected": true, "text": "<p>Okay, here's where I'm at with a solution. </p>\n\n<pre><code>wp_enqueue_style( 'my-handle', 'mystyle.css' );\n...
2011/11/25
[ "https://wordpress.stackexchange.com/questions/34754", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3687/" ]
Read below if you want to start from where I left off in core. But the basic question is: I need to add a "title" attribute to my stylesheets and wp\_enqueue\_style() doesn't allow for that parameter, as far as I can tell. Other than a hard embed, are there any ways WordPress allows us to add the title to a stylesheet?...
Okay, here's where I'm at with a solution. ``` wp_enqueue_style( 'my-handle', 'mystyle.css' ); global $wp_styles; $wp_styles->add_data( 'my-handle', 'title', 'my_stylesheet_title' ); ``` Don't like using the global. Is there something better?
34,759
<p>I want to export all Wordpress categories (no posts, just categories) from one blog to another. How can I do that ?</p>
[ { "answer_id": 34769, "author": "Ünsal Korkmaz", "author_id": 1372, "author_profile": "https://wordpress.stackexchange.com/users/1372", "pm_score": 2, "selected": false, "text": "<p>You cant export only categories (or taxonomies generally). Just export all content with Tools/Export and y...
2011/11/25
[ "https://wordpress.stackexchange.com/questions/34759", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1822/" ]
I want to export all Wordpress categories (no posts, just categories) from one blog to another. How can I do that ?
This answer is essentially the same as Ünsal's, but I'd like to elaborate a bit because despite being right his answer didn't help me (I was just trying to remember what I'd done in the past, I should have read his more carefully and I would have figured it out, but I think for others a full description would be useful...
34,813
<p>I'm registering multiple metaboxes in my write posts panels. In functions.php:</p> <pre><code>$meta_boxes[] = array( 'id' =&gt; 'products', 'title' =&gt; 'Products', 'pages' =&gt; array('post', 'page', 'link'), // multiple post types, accept custom post types 'context' =&gt; 'normal', // normal, adv...
[ { "answer_id": 34882, "author": "tollmanz", "author_id": 4850, "author_profile": "https://wordpress.stackexchange.com/users/4850", "pm_score": 1, "selected": false, "text": "<p>If I understand your question correctly, you would like to get all metadata for \"products\" across all posts. ...
2011/11/26
[ "https://wordpress.stackexchange.com/questions/34813", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10392/" ]
I'm registering multiple metaboxes in my write posts panels. In functions.php: ``` $meta_boxes[] = array( 'id' => 'products', 'title' => 'Products', 'pages' => array('post', 'page', 'link'), // multiple post types, accept custom post types 'context' => 'normal', // normal, advanced, side (optional) ...
If I understand your question correctly, you would like to get all metadata for "products" across all posts. In other words, multiple posts have metadata with key "products" and you want to get those values. If this is correct, you should use `get_post_custom_values`, which is well documented in the codex: <http://code...
34,822
<p>I'm souping up a WP theme with the BuddyPress plugin to make a cool hybrid of sorts between the two. Anyway... I'm using the following to grab author RSS urls. <strong>The problem being the colon ":" is being stripped on the pages and I can't figure out why. Does anybody have a solution for this?</strong></p> <p...
[ { "answer_id": 34882, "author": "tollmanz", "author_id": 4850, "author_profile": "https://wordpress.stackexchange.com/users/4850", "pm_score": 1, "selected": false, "text": "<p>If I understand your question correctly, you would like to get all metadata for \"products\" across all posts. ...
2011/11/27
[ "https://wordpress.stackexchange.com/questions/34822", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5205/" ]
I'm souping up a WP theme with the BuddyPress plugin to make a cool hybrid of sorts between the two. Anyway... I'm using the following to grab author RSS urls. **The problem being the colon ":" is being stripped on the pages and I can't figure out why. Does anybody have a solution for this?** ``` <a href="<?php echo "...
If I understand your question correctly, you would like to get all metadata for "products" across all posts. In other words, multiple posts have metadata with key "products" and you want to get those values. If this is correct, you should use `get_post_custom_values`, which is well documented in the codex: <http://code...
34,841
<p>I am working on a plugin and want to change the default post date to something like 'posted one min ago' OR 'posted 1 hour ago', OR 'posted on month ago'.</p>
[ { "answer_id": 34845, "author": "Joshua Abenazer", "author_id": 10251, "author_profile": "https://wordpress.stackexchange.com/users/10251", "pm_score": 2, "selected": false, "text": "<p>Try this code inside your loop.</p>\n\n<pre><code>&lt;?php echo 'posted' . human_time_diff( get_the_ti...
2011/11/27
[ "https://wordpress.stackexchange.com/questions/34841", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/13549/" ]
I am working on a plugin and want to change the default post date to something like 'posted one min ago' OR 'posted 1 hour ago', OR 'posted on month ago'.
Straight from my framework as `human_time_diff()` involves caching. ``` /** * Time since an entry was posted * * Adapted from binary bonsai * @link http://binarybonsai.com/code/timesince.txt * @license unknown - original source unavailable * * @todo check human_time_diff(); as a replacement * @link http...
34,849
<p>I am using the advanced custom fields plugin to upload images for an image gallery. I am attempting to retrieve the different sizes of images that are saved in the uploads folder and having problems. </p> <p>$image = wp_get_attachment_image_src(get_sub_field('image'), 'full'); </p> <p>When I echo out the results o...
[ { "answer_id": 34867, "author": "patnz", "author_id": 4093, "author_profile": "https://wordpress.stackexchange.com/users/4093", "pm_score": 2, "selected": true, "text": "<p>What's in get_sub_field('image')? <a href=\"http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_s...
2011/11/27
[ "https://wordpress.stackexchange.com/questions/34849", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10475/" ]
I am using the advanced custom fields plugin to upload images for an image gallery. I am attempting to retrieve the different sizes of images that are saved in the uploads folder and having problems. $image = wp\_get\_attachment\_image\_src(get\_sub\_field('image'), 'full'); When I echo out the results of this I ge...
What's in get\_sub\_field('image')? [wp\_get\_attachment\_image\_src()](http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src) parameter 1 should be the attachment id, not the attachment src, if that's what you have. I use the following function to get an attachment ID from an image url as as far a...
34,883
<p>I have a local copy of the latest version of wordpress that I set up using</p> <pre><code>svn co http://core.svn.wordpress.org/trunk/ </code></pre> <p>There is a diff that I want to pull into my local fileset:</p> <p><a href="http://core.trac.wordpress.org/attachment/ticket/19371/19371.diff" rel="nofollow">http:/...
[ { "answer_id": 34886, "author": "tollmanz", "author_id": 4850, "author_profile": "https://wordpress.stackexchange.com/users/4850", "pm_score": 3, "selected": true, "text": "<p>The command you need is <code>patch</code> which is not specific to SVN. It's really easy to do. See this articl...
2011/11/28
[ "https://wordpress.stackexchange.com/questions/34883", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4400/" ]
I have a local copy of the latest version of wordpress that I set up using ``` svn co http://core.svn.wordpress.org/trunk/ ``` There is a diff that I want to pull into my local fileset: <http://core.trac.wordpress.org/attachment/ticket/19371/19371.diff> Is this something that I can do with subversion? What command...
The command you need is `patch` which is not specific to SVN. It's really easy to do. See this article: <http://jungels.net/articles/diff-patch-ten-minutes.html>
34,888
<p>I am building a WP site with an events feature. The events page was made with custom post types.</p> <p>I want to make it possible for people to search/ filter events by dates. For example, they can search for all events happening between 2nd December, 2011 and 1st March, 2012 and get results from events that have ...
[ { "answer_id": 34890, "author": "Anh Tran", "author_id": 2051, "author_profile": "https://wordpress.stackexchange.com/users/2051", "pm_score": 2, "selected": false, "text": "<p>How do you store the event date: using the default <code>post_date</code> field of the post or a custom meta fi...
2011/11/28
[ "https://wordpress.stackexchange.com/questions/34888", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10241/" ]
I am building a WP site with an events feature. The events page was made with custom post types. I want to make it possible for people to search/ filter events by dates. For example, they can search for all events happening between 2nd December, 2011 and 1st March, 2012 and get results from events that have their date...
There two things that you need to do to make this happen: 1) Create metadata for the data for each event 2) Query for the posts using meta\_query For #1, you need to add a metabox that allows the user to add a date for the event. This data should be stored as metadata using the `add_post_meta` or `update_post_meta`....
34,891
<p>I'm having a tough time getting this to work. It's not the first time I run into problems with pagination, or I would say with WPs URL system.</p> <p>Basically I have this URL: </p> <pre><code>http://example.com/location/dc </code></pre> <p>and loads up the <code>taxonomy-location.php</code> template.</p> <p>No...
[ { "answer_id": 34893, "author": "Joshua Abenazer", "author_id": 10251, "author_profile": "https://wordpress.stackexchange.com/users/10251", "pm_score": 1, "selected": false, "text": "<p>Try adding <code>'paged' =&gt; get_query_var( 'page' )</code> to your query.</p>\n\n<p>EDIT : For pagi...
2011/11/28
[ "https://wordpress.stackexchange.com/questions/34891", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1983/" ]
I'm having a tough time getting this to work. It's not the first time I run into problems with pagination, or I would say with WPs URL system. Basically I have this URL: ``` http://example.com/location/dc ``` and loads up the `taxonomy-location.php` template. Now, I'm adding the pagination feature to the theme. ...
Try adding `'paged' => get_query_var( 'page' )` to your query. EDIT : For pagination to work properly the posts per page should be greater than 'Blog pages show at most' under Settings-> Reading section of the WordPress Admin. So there are two ways you can make this work out. 1. You can set 'Blog pages show at most' ...
34,894
<p>I have created a custom post type "portfolio" with something like this :</p> <pre><code>$args = array( 'labels' =&gt; $labels, 'public' =&gt; true, 'publicly_queryable' =&gt; true, 'show_ui' =&gt; true, 'query_var' =&gt; true, //'menu_icon' =&gt; get_stylesheet_directory_uri() . '/article16....
[ { "answer_id": 34897, "author": "Joshua Abenazer", "author_id": 10251, "author_profile": "https://wordpress.stackexchange.com/users/10251", "pm_score": 6, "selected": true, "text": "<p>Try this code for adding scripts to the edit pages of your portfolio custom post type.</p>\n\n<pre><cod...
2011/11/28
[ "https://wordpress.stackexchange.com/questions/34894", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2661/" ]
I have created a custom post type "portfolio" with something like this : ``` $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, //'menu_icon' => get_stylesheet_directory_uri() . '/article16.png', 'rewrite' => true, ...
Try this code for adding scripts to the edit pages of your portfolio custom post type. ``` add_action( 'admin_print_scripts-post-new.php', 'portfolio_admin_script', 11 ); add_action( 'admin_print_scripts-post.php', 'portfolio_admin_script', 11 ); function portfolio_admin_script() { global $post_type; if( 'por...
34,919
<p>My category page navigation doesn't seem to be showing up at all, what am I missing in my coding?</p> <pre><code>&lt;?php get_header(); ?&gt; &lt;div class="inner-page"&gt; &lt;div class="page-spacer"&gt;&lt;/div&gt; &lt;!-- Content Start --&gt; &lt;div id="content-top"&gt;&lt;/div&gt; &lt;div id="category...
[ { "answer_id": 34921, "author": "kovshenin", "author_id": 1316, "author_profile": "https://wordpress.stackexchange.com/users/1316", "pm_score": 2, "selected": true, "text": "<p>You should take a closer look at the [http://codex.wordpress.org/Template_Hierarchy Template Hierarchy]. From w...
2011/11/28
[ "https://wordpress.stackexchange.com/questions/34919", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1859/" ]
My category page navigation doesn't seem to be showing up at all, what am I missing in my coding? ``` <?php get_header(); ?> <div class="inner-page"> <div class="page-spacer"></div> <!-- Content Start --> <div id="content-top"></div> <div id="category-content-wrapper"> <div id="category-content" role="mai...
You should take a closer look at the [http://codex.wordpress.org/Template\_Hierarchy Template Hierarchy]. From what I understood in your code is that you're trying to list posts in the category where ID = 5. You can easily map that to the `category-slug.php` or `category-id.php` template files, so you won't have to do ...
34,927
<p>I have a custom post type where i need a field called country along with its flag.</p> <p>Now i am divided in between two choices: [1] to create a custom post type called country with title(name of country) and featured image(flag)</p> <p>... or</p> <p>[ 2]. to register a taxonomy called country and add a custom...
[ { "answer_id": 34930, "author": "Kaaviar", "author_id": 3071, "author_profile": "https://wordpress.stackexchange.com/users/3071", "pm_score": 1, "selected": false, "text": "<p>I'd say neither one nor the other :)</p>\n\n<p>You should take a look at custom fields with some plugins you can...
2011/11/28
[ "https://wordpress.stackexchange.com/questions/34927", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7247/" ]
I have a custom post type where i need a field called country along with its flag. Now i am divided in between two choices: [1] to create a custom post type called country with title(name of country) and featured image(flag) ... or [ 2]. to register a taxonomy called country and add a custom field in the taxonomy c...
If you need to display the flags of the countries in the post then the best option would be to use custom fields with your own function that will know to translate the value of the custom field in to the right country's image. You can also create a custom taxonomy for that with a custom field (best tutorial in the wor...