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
23,924
<p>I'm making a member-only site that requires users to be logged in to use the site.</p> <p>The homepage is publicly viewable. On the homepage, I'd like to put in a function to redirect users to a page inside the site if they are logged in.</p> <p>The code I tried</p> <pre><code>&lt;?php if (is_user_logged_in() ) {...
[ { "answer_id": 23928, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>I am not sure if you just simplified for example, but make sure you use full URL in <a href=\"http://codex.wordpress...
2011/07/24
[ "https://wordpress.stackexchange.com/questions/23924", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7295/" ]
I'm making a member-only site that requires users to be logged in to use the site. The homepage is publicly viewable. On the homepage, I'd like to put in a function to redirect users to a page inside the site if they are logged in. The code I tried ``` <?php if (is_user_logged_in() ) { wp_redirect ('dashboard' ); ...
I am not sure if you just simplified for example, but make sure you use full URL in [`wp_redirect()`](http://codex.wordpress.org/Function_Reference/wp_redirect) call. Also rather than having it in template, I think it would be more appropriate to run this at `template_redirect` hook.
23,944
<p>I need to change the published year on all of a custom post type from 2010, to 2011.</p> <p>What is the quickest way to do it? I have 200 entries, so manual would take hours!!</p>
[ { "answer_id": 23970, "author": "Rajeev Vyas", "author_id": 6961, "author_profile": "https://wordpress.stackexchange.com/users/6961", "pm_score": 0, "selected": false, "text": "<p>May be you have to write code in plugin file and run...</p>\n\n<p>Use get_posts to get posts for your custom...
2011/07/24
[ "https://wordpress.stackexchange.com/questions/23944", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/784/" ]
I need to change the published year on all of a custom post type from 2010, to 2011. What is the quickest way to do it? I have 200 entries, so manual would take hours!!
Rajeev Vyas is more or less correct... personally I think the best way to do this is to make a tiny plugin that will update all your dates when the plugin is activated. After updating the dates... delete the plugin and keep in mind that if you activate the plugin again all your dates will change again. So step by step...
23,945
<p>I am using a couple of wordpress plugins for my theme, enabling them programmatically.</p> <p>I would not want the user of my theme to be bugged with plugin updates for these plugins, as well as viewing them in the wordpress admin panel plugins lists.</p> <p>Is there a way to exclude these plugins from automatic v...
[ { "answer_id": 23953, "author": "Sean Lee", "author_id": 6851, "author_profile": "https://wordpress.stackexchange.com/users/6851", "pm_score": 1, "selected": false, "text": "<p>To disable plugin update notification:\n<a href=\"http://wordpress.org/extend/plugins/disable-wordpress-plugin-...
2011/07/24
[ "https://wordpress.stackexchange.com/questions/23945", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6329/" ]
I am using a couple of wordpress plugins for my theme, enabling them programmatically. I would not want the user of my theme to be bugged with plugin updates for these plugins, as well as viewing them in the wordpress admin panel plugins lists. Is there a way to exclude these plugins from automatic version checker an...
**RE: Excluding plugins from update checks** Yes you can exclude plugins from the update checker, there's no pretty solution, ie. no convenient filter to just say, here exclude these for me, but it can be done, Mark Jaquith did [a blog on it](http://markjaquith.wordpress.com/2009/12/14/excluding-your-plugin-or-theme-f...
23,946
<p>Is there a way to display posts, scheduled for the future?</p> <p>I want to use the published data as an event date and time, which is obviously in the future. I still would like to use these posts for a loop, and for single pages.</p>
[ { "answer_id": 23950, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 0, "selected": false, "text": "<p>Use </p>\n\n<ul>\n<li><code>'post_status' =&gt; 'draft'</code> to receive all posts that are not published.</li>\n<...
2011/07/24
[ "https://wordpress.stackexchange.com/questions/23946", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/784/" ]
Is there a way to display posts, scheduled for the future? I want to use the published data as an event date and time, which is obviously in the future. I still would like to use these posts for a loop, and for single pages.
``` $args = array( 'post_status' => "future", 'order_by' => 'date', 'order' => 'ASC' ); $yourLoop = new WP_Query($args); ```
23,951
<p>Can anyone recommend plugin that I can use to add a table to a page? I've seen ones that use static data-- you hardcode the figures in the table. I want to pull the data from a custom db table and put it in a table. </p> <p>I looked at <a href="http://wordpress.org/extend/plugins/wp-table-reloaded/" rel="nofollow">...
[ { "answer_id": 23952, "author": "GavinR", "author_id": 2001, "author_profile": "https://wordpress.stackexchange.com/users/2001", "pm_score": 3, "selected": true, "text": "<p>Set up a custom page template and in the content of the template use <a href=\"http://codex.wordpress.org/Class_Re...
2011/07/25
[ "https://wordpress.stackexchange.com/questions/23951", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4509/" ]
Can anyone recommend plugin that I can use to add a table to a page? I've seen ones that use static data-- you hardcode the figures in the table. I want to pull the data from a custom db table and put it in a table. I looked at [WP Table Reloaded](http://wordpress.org/extend/plugins/wp-table-reloaded/), but I'm not s...
Set up a custom page template and in the content of the template use [WPDB](http://codex.wordpress.org/Class_Reference/wpdb) to query your table. Example to get a row: ``` $mylink = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = 10"); ```
23,959
<p>I would like to exclude a category from my categories sidebar widget. If I understand the way this works, the sidebar.php code is not in use since the widget is displaying the categories. (something similar was discussed in this support topic: <a href="http://wordpress.org/support/topic/problem-trying-to-hide-a-ca...
[ { "answer_id": 23952, "author": "GavinR", "author_id": 2001, "author_profile": "https://wordpress.stackexchange.com/users/2001", "pm_score": 3, "selected": true, "text": "<p>Set up a custom page template and in the content of the template use <a href=\"http://codex.wordpress.org/Class_Re...
2011/07/25
[ "https://wordpress.stackexchange.com/questions/23959", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3744/" ]
I would like to exclude a category from my categories sidebar widget. If I understand the way this works, the sidebar.php code is not in use since the widget is displaying the categories. (something similar was discussed in this support topic: <http://wordpress.org/support/topic/problem-trying-to-hide-a-category-in-the...
Set up a custom page template and in the content of the template use [WPDB](http://codex.wordpress.org/Class_Reference/wpdb) to query your table. Example to get a row: ``` $mylink = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = 10"); ```
23,997
<p>I have a custom field in my post called fb_name. I need to be able to get that field name outside of the loop in my sidebar. How can I accomplish this?</p>
[ { "answer_id": 23998, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>If it's a single post or page, you can just pass the global $post->ID:</p>\n\n<pre><code>echo get_post_meta($post-&...
2011/07/25
[ "https://wordpress.stackexchange.com/questions/23997", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7311/" ]
I have a custom field in my post called fb\_name. I need to be able to get that field name outside of the loop in my sidebar. How can I accomplish this?
If it's a single post or page, you can just pass the global $post->ID: ``` echo get_post_meta($post->ID, 'fb_name', true); ```
24,014
<p>I'm trying to add/ update additional values to an option created with the Settings API. I'm trying to do this with my validation callback function, but I'm not getting very far. Here is my code:</p> <pre><code>function tccl_settings_option_validate( $input ) { add_option( 'tccl_settings_option', $input ); } </c...
[ { "answer_id": 24015, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 0, "selected": false, "text": "<p>you don't have to save the option, that's done for you. your validation function should check input then <code>retu...
2011/07/25
[ "https://wordpress.stackexchange.com/questions/24014", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1341/" ]
I'm trying to add/ update additional values to an option created with the Settings API. I'm trying to do this with my validation callback function, but I'm not getting very far. Here is my code: ``` function tccl_settings_option_validate( $input ) { add_option( 'tccl_settings_option', $input ); } ``` This is cau...
Get the option, modify only the values you need to modify in it, then return the results. ``` function tccl_settings_option_validate( $input ) { $options = get_option('tccl_settings_option'); // modify $options using data from $input as needed return $options; } ```
24,043
<p>I don't need my plugin running through wp-admin, including wp-login. How could I prevent it? is_admin works fine but i don't know how to ignore everything related to wp-admin (like wp-login.php). Thanks.</p>
[ { "answer_id": 24044, "author": "onetrickpony", "author_id": 1986, "author_profile": "https://wordpress.stackexchange.com/users/1986", "pm_score": 1, "selected": false, "text": "<p>Check the requested URI:</p>\n\n<pre><code>if(!is_admin()\n &amp;&amp; strpos($_SERVER['REQUEST_URI'], 'wp-...
2011/07/25
[ "https://wordpress.stackexchange.com/questions/24043", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7321/" ]
I don't need my plugin running through wp-admin, including wp-login. How could I prevent it? is\_admin works fine but i don't know how to ignore everything related to wp-admin (like wp-login.php). Thanks.
Check the requested URI: ``` if(!is_admin() && strpos($_SERVER['REQUEST_URI'], 'wp-login.php') === false && strpos($_SERVER['REQUEST_URI'], 'wp-signup.php') === false) { ... } ``` But it's probably better to use a white-list style: `if(is_front_page() || is_singular() || is_archive()) { ... }` These 3 tags shou...
24,066
<p>This question is similar to <a href="https://wordpress.stackexchange.com/questions/23486/multisite-with-entirely-different-domains">Multisite with entirely different domains?</a> which was not answered. I am re-asking.</p> <p>I want to host multiple domains using WP multisite, which is installed and working normal...
[ { "answer_id": 24130, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 0, "selected": false, "text": "<blockquote>\n <p>I've tried the Wordpress MU domain mapping plugin but I'm not satisfied with its behavior. This pl...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24066", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7333/" ]
This question is similar to [Multisite with entirely different domains?](https://wordpress.stackexchange.com/questions/23486/multisite-with-entirely-different-domains) which was not answered. I am re-asking. I want to host multiple domains using WP multisite, which is installed and working normally in "multiple subdom...
Domain mapping is the correct answer to your question, because that isn't how the domain mapping plugin works at all. Take a look at <http://ottopress.com>. It really lives at <http://ottodestruct.com/op/>, but you wouldn't know it, would you? It's a domain mapped site on a multisite installation. If you're getting a...
24,068
<p>Is there any way to replace standard WordPress comments form action, which usually looks like this:</p> <p><code>&lt;form action="&lt;?php echo get_option('siteurl'); ?&gt;/wp-comments-post.php" method="post" id="commentform"&gt;</code></p> <p>to something custom WITHOUT altering comments.php (i.e. for a plugin, s...
[ { "answer_id": 24069, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": false, "text": "<p>simple with jQuery:</p>\n\n<pre><code>//first make sure you have jQuery on that page\nadd_action('wp_enqueue_...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24068", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7336/" ]
Is there any way to replace standard WordPress comments form action, which usually looks like this: `<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">` to something custom WITHOUT altering comments.php (i.e. for a plugin, so you don't have to make end-users edit ...
simple with jQuery: ``` //first make sure you have jQuery on that page add_action('wp_enqueue_scripts','make_sure_i_have_jquery'); function make_sure_i_have_jquery(){ if (!is_admin()) wp_enqueue_script( 'jquery' ); } //then just change the url to you own add_action('wp_footer','change_comment_form'); ...
24,082
<p>I need to give each page a custom/different page template for every language page in WPML.</p> <p>eg: Let i have a test page in English and french. Is there any way out so that in English i give sidebar template while same page in french don't have sidebar template.</p> <p>Note: Solution should not be any core con...
[ { "answer_id": 24088, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>You can accomplish different sidebar content per language with either the <a href=\"http://wordpress.org/extend/pl...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24082", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7341/" ]
I need to give each page a custom/different page template for every language page in WPML. eg: Let i have a test page in English and french. Is there any way out so that in English i give sidebar template while same page in french don't have sidebar template. Note: Solution should not be any core condition to be put ...
You can accomplish different sidebar content per language with either the [plugin Widget Logic](http://wordpress.org/extend/plugins/widget-logic/), or with the [Dynamic Widgets plugin](http://wordpress.org/extend/plugins/dynamic-widgets/) Alternatively you can make different sidebar templates per language and use a co...
24,083
<p>I'm a bit of a PHP MySQL newb but i feel i need to bypass WordPress for the frontend of a site i'm building (it is mainly just RSS and JSON feeds). I was wondering if there are any tutorials or advice I should follow on this or just cut straight to it? </p>
[ { "answer_id": 24084, "author": "mike23", "author_id": 1381, "author_profile": "https://wordpress.stackexchange.com/users/1381", "pm_score": 3, "selected": true, "text": "<p>You want to include <code>wp-load.php</code> at the beginning of your script/page like this :</p>\n\n<pre><code>re...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24083", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1925/" ]
I'm a bit of a PHP MySQL newb but i feel i need to bypass WordPress for the frontend of a site i'm building (it is mainly just RSS and JSON feeds). I was wondering if there are any tutorials or advice I should follow on this or just cut straight to it?
You want to include `wp-load.php` at the beginning of your script/page like this : ``` require_once("/path/to/wordpress/wp-load.php"); ``` You then have access to any WP functions. To manipulate the DB directly, have a look at [`wpdb`](http://codex.wordpress.org/Class_Reference/wpdb).
24,085
<p>I'm trying to query for a custom post type for a gallery system. I have a checkbox to set a gallery as a "featured" gallery (set up through More Fields plugin) - if this is checked then the meta value becomes 1 and then if unchecked it becomes 0. All good. However if the box has never been checked then the meta key ...
[ { "answer_id": 24101, "author": "t31os", "author_id": 31073, "author_profile": "https://wordpress.stackexchange.com/users/31073", "pm_score": 2, "selected": false, "text": "<p>As the ticket pointed out, it's not supported.. until then you'll have to rely on a custom solution. </p>\n\n<p>...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24085", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7343/" ]
I'm trying to query for a custom post type for a gallery system. I have a checkbox to set a gallery as a "featured" gallery (set up through More Fields plugin) - if this is checked then the meta value becomes 1 and then if unchecked it becomes 0. All good. However if the box has never been checked then the meta key is ...
That massive function was a bit scary, I got this working like so - with two arguments (that exclude the features) ``` $args = array( 'meta_query' => array( 'relation' => 'OR', array( // new and edited posts 'key' => 'Set as Featured Post', 'compare' => '!=', ...
24,087
<p>Just wondering, If any body have integrated <a href="http://lab.chasepaymentechxpress.com/Integration/Integration_Tools/Commerce_Web_Services.aspx" rel="nofollow">Chase Paymentech Payment Gateway</a> with WordPress for Shopping Cart purpose?</p>
[ { "answer_id": 24101, "author": "t31os", "author_id": 31073, "author_profile": "https://wordpress.stackexchange.com/users/31073", "pm_score": 2, "selected": false, "text": "<p>As the ticket pointed out, it's not supported.. until then you'll have to rely on a custom solution. </p>\n\n<p>...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24087", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7344/" ]
Just wondering, If any body have integrated [Chase Paymentech Payment Gateway](http://lab.chasepaymentechxpress.com/Integration/Integration_Tools/Commerce_Web_Services.aspx) with WordPress for Shopping Cart purpose?
That massive function was a bit scary, I got this working like so - with two arguments (that exclude the features) ``` $args = array( 'meta_query' => array( 'relation' => 'OR', array( // new and edited posts 'key' => 'Set as Featured Post', 'compare' => '!=', ...
24,103
<p>I have added query_posts() to my index.php file to modify the loop on the posts page:</p> <pre><code>query_posts( 'cat=-4,-7' ); get_template_part( 'loop', 'index' ); </code></pre> <p>This works correctly, but when I click on "Older Posts" (link to /page/2), the latest posts show up instead of the previous ones. H...
[ { "answer_id": 24108, "author": "Michael", "author_id": 4884, "author_profile": "https://wordpress.stackexchange.com/users/4884", "pm_score": 3, "selected": true, "text": "<p>different approach:</p>\n\n<pre><code>global $wp_query;\n$args = array_merge( $wp_query-&gt;query, array( 'catego...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24103", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2001/" ]
I have added query\_posts() to my index.php file to modify the loop on the posts page: ``` query_posts( 'cat=-4,-7' ); get_template_part( 'loop', 'index' ); ``` This works correctly, but when I click on "Older Posts" (link to /page/2), the latest posts show up instead of the previous ones. How can I get my paginatio...
different approach: ``` global $wp_query; $args = array_merge( $wp_query->query, array( 'category__not_in' => array(4,7) ) ); query_posts( $args ); get_template_part( 'loop', 'index' ); ``` if this approach should not work, please check if one or more of the plugins is interfering - deactivate all plugins; if the e...
24,106
<p>I notice that in some plugins you can override functions by ...</p> <ol> <li>Creating an uploads folder</li> <li>Creating a folder with the plugin name</li> <li><p>Using the following code</p> <pre><code>if (!function_exists('function_name')) { function function_name() { } } </code></pre></li> </ol> <p>I...
[ { "answer_id": 24110, "author": "Ciprian", "author_id": 7349, "author_profile": "https://wordpress.stackexchange.com/users/7349", "pm_score": 2, "selected": true, "text": "<p>If the plugin displays content via any function, the code:</p>\n\n<pre><code>if(!function_exists('function_name')...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24106", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2417/" ]
I notice that in some plugins you can override functions by ... 1. Creating an uploads folder 2. Creating a folder with the plugin name 3. Using the following code ``` if (!function_exists('function_name')) { function function_name() { } } ``` Is this standard for all Wordpress plugins or only if they're w...
If the plugin displays content via any function, the code: ``` if(!function_exists('function_name')) function_name(); ``` ... is used for safety. If your plugin is disabled, and the `if (!function_exists('function_name'))` is missing, your theme will throw a fatal error.
24,112
<p>We have a pretty basic load balancing setup with 3 web servers behind a load balancer connected to the same db server and pointing their wp-content/uploads folder to an nfs share. </p> <p>We have the first server rsynching the wordpress files across the other 2 in a cron job to keep the servers in sync (all wp-admi...
[ { "answer_id": 24110, "author": "Ciprian", "author_id": 7349, "author_profile": "https://wordpress.stackexchange.com/users/7349", "pm_score": 2, "selected": true, "text": "<p>If the plugin displays content via any function, the code:</p>\n\n<pre><code>if(!function_exists('function_name')...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24112", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7350/" ]
We have a pretty basic load balancing setup with 3 web servers behind a load balancer connected to the same db server and pointing their wp-content/uploads folder to an nfs share. We have the first server rsynching the wordpress files across the other 2 in a cron job to keep the servers in sync (all wp-admin stuff is...
If the plugin displays content via any function, the code: ``` if(!function_exists('function_name')) function_name(); ``` ... is used for safety. If your plugin is disabled, and the `if (!function_exists('function_name'))` is missing, your theme will throw a fatal error.
24,116
<p>I want to add a field to the comments and have used these codes.</p> <p><strong>functions.php</strong></p> <pre><code>function my_fields($fields) { $fields['url2'] = '&lt;p class="comment-form-url2"&gt; &lt;label for="url2"&gt;URL hittad på webben&lt;/label&gt; ...
[ { "answer_id": 24117, "author": "mike23", "author_id": 1381, "author_profile": "https://wordpress.stackexchange.com/users/1381", "pm_score": 3, "selected": false, "text": "<p>To save your extra field, you have to do :</p>\n\n<pre><code>function save_comment_meta_data( $comment_id ) {\n ...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24116", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5244/" ]
I want to add a field to the comments and have used these codes. **functions.php** ``` function my_fields($fields) { $fields['url2'] = '<p class="comment-form-url2"> <label for="url2">URL hittad på webben</label> <input id="url2" name="url2" type="text" value=""...
There are a couple other hooks in the comment form that you can use. Where you're hooking on only displays if the user isn't logged in. If you want that field for all users (logged in or not), you need to add your form by hooking into both `comment_form_after_fields` and `comment_form_logged_in_after`, both of which ar...
24,118
<p>I'm trying to empty an option created with the Settings API and failing.</p> <p><code>update_option ( 'my_option', '' );</code> appears to do nothing, whereas <code>delete_option ( 'my_option' );</code> destroys the whole option causing other problems. I just want to empty the values and reset it.</p> <p>I'm reall...
[ { "answer_id": 24141, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 2, "selected": false, "text": "<p>Do you want to unset <em>just one option</em>, or do you want to unset <em>every option in the array</em>?<...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24118", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1341/" ]
I'm trying to empty an option created with the Settings API and failing. `update_option ( 'my_option', '' );` appears to do nothing, whereas `delete_option ( 'my_option' );` destroys the whole option causing other problems. I just want to empty the values and reset it. I'm really clueless how to implement this correc...
If you wrote your code correctly, then delete\_option would be the correct way. The question isn't how to clear the option; the question is how to structure your code such that the "option does not exist" case is a valid case. Think about it. The first time you start this code, that option isn't going to exist at all,...
24,148
<p>I am trying to add a stylesheet when users are accessing the blog section of my site from and iPad. The first snippet of code works, however, I don't want to use the absolute path. I want to use wordpress's function.</p> <pre><code>function ipad_css() { if( preg_match('/ipad/i',$_SERVER['HTTP_USER_AGENT'])) {?&gt...
[ { "answer_id": 24151, "author": "Mario", "author_id": 7361, "author_profile": "https://wordpress.stackexchange.com/users/7361", "pm_score": 3, "selected": true, "text": "<p>Try replacing <code>&lt;?php bloginfo('template_directory'); ?&gt;</code> with <code>&lt;?php echo get_template_dir...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24148", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4273/" ]
I am trying to add a stylesheet when users are accessing the blog section of my site from and iPad. The first snippet of code works, however, I don't want to use the absolute path. I want to use wordpress's function. ``` function ipad_css() { if( preg_match('/ipad/i',$_SERVER['HTTP_USER_AGENT'])) {?> <link rel="styl...
Try replacing `<?php bloginfo('template_directory'); ?>` with `<?php echo get_template_directory_uri(); ?>` Also, I wouldn't hook it to the `init`action, why don't use `wp_print_styles` instead? **It is** a style after all.
24,149
<p>For the past two weeks I've been looking for a way to create a query in wordpress that returns all custom post types where a meta_key "mytype-expired" is NOT set to "yes" and then order the results by a second meta_key called "mytype-sort-order" with the highest number value coming first. If no value exists in the ...
[ { "answer_id": 24182, "author": "Wyck", "author_id": 1509, "author_profile": "https://wordpress.stackexchange.com/users/1509", "pm_score": 2, "selected": true, "text": "<p>Though it might take some tweaking you can use the 'orderby' parameter on multiple values.</p>\n\n<p>The difficulty ...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24149", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2677/" ]
For the past two weeks I've been looking for a way to create a query in wordpress that returns all custom post types where a meta\_key "mytype-expired" is NOT set to "yes" and then order the results by a second meta\_key called "mytype-sort-order" with the highest number value coming first. If no value exists in the "m...
Though it might take some tweaking you can use the 'orderby' parameter on multiple values. The difficulty here is more in terms of logic, for example July 3 (date value) and the number 10 (meta value) do not really relate to one another, this would cause problems if not formatted correctly. You best bet is to convert...
24,160
<p>I'm dealing with a rather hackish implementation, where <code>header.php</code> has this line: <code>include_once "tracking.php";</code>. Inside <code>tracking.php</code>, there are these lines:</p> <pre><code>&lt;script type="text/javascript" src="/wp-content/themes/themename/js/jquery-1.3.2.min.js"&gt;&lt;/script...
[ { "answer_id": 24167, "author": "supajb", "author_id": 3493, "author_profile": "https://wordpress.stackexchange.com/users/3493", "pm_score": 1, "selected": false, "text": "<p>try </p>\n\n<pre><code>get_template_part('tracking');\n</code></pre>\n\n<p>as a way of including that file rather...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24160", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/49/" ]
I'm dealing with a rather hackish implementation, where `header.php` has this line: `include_once "tracking.php";`. Inside `tracking.php`, there are these lines: ``` <script type="text/javascript" src="/wp-content/themes/themename/js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="/wp-content/them...
How about using `locate_template()` for the inclusion and `wp_enqueue_script()` for the scripts? There's also `content_url()` to target /wp-content/. Also: How did you inspect it? Sourcecode? FireBug? Try to open source in FF and then click the link. If you get a "file not found", you know what it's about, else it sho...
24,164
<p>I've been trying to decipher a way to display a message to a user on first login and can't seem to get it to work. I'm not sure what I'm missing, or if there's something else I need to do. Any help would be appreciated. I feel like I missing something here.</p> <pre><code>function ap_new_user_message() { $curre...
[ { "answer_id": 24497, "author": "Sean Lee", "author_id": 6851, "author_profile": "https://wordpress.stackexchange.com/users/6851", "pm_score": 0, "selected": false, "text": "<p>You can use <a href=\"http://wordpress.org/extend/plugins/log-user-access/\" rel=\"nofollow\">log-user-access</...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24164", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3296/" ]
I've been trying to decipher a way to display a message to a user on first login and can't seem to get it to work. I'm not sure what I'm missing, or if there's something else I need to do. Any help would be appreciated. I feel like I missing something here. ``` function ap_new_user_message() { $current_user = wp_g...
here's an example that hooks login\_redirect and checks when their account was created, then redirects them to a url of your choice if it's been less than 48 hours: ``` function my_redirect( $to, $requested, $user ){ if( !isset( $user->user_login ) ){ // we only want this to run when credentials have been supplied...
24,166
<p>I just definsed at Setting> Reading a page I have created called "home" as my homepage. The change was ok, but since them all my internal pages url shows an extra /home/in their urls.</p> <p>How can I avoid it?</p> <p>Examples:</p> <p>Before: www.mydomain/internalpage/</p> <p>After the change: www.mydomain*<em>/...
[ { "answer_id": 24497, "author": "Sean Lee", "author_id": 6851, "author_profile": "https://wordpress.stackexchange.com/users/6851", "pm_score": 0, "selected": false, "text": "<p>You can use <a href=\"http://wordpress.org/extend/plugins/log-user-access/\" rel=\"nofollow\">log-user-access</...
2011/07/26
[ "https://wordpress.stackexchange.com/questions/24166", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7062/" ]
I just definsed at Setting> Reading a page I have created called "home" as my homepage. The change was ok, but since them all my internal pages url shows an extra /home/in their urls. How can I avoid it? Examples: Before: www.mydomain/internalpage/ After the change: www.mydomain\**/home/*\*internalpage/
here's an example that hooks login\_redirect and checks when their account was created, then redirects them to a url of your choice if it's been less than 48 hours: ``` function my_redirect( $to, $requested, $user ){ if( !isset( $user->user_login ) ){ // we only want this to run when credentials have been supplied...
24,185
<p>I'd like to run a query through my WordPress database that updates the blog_public values on all individual sites. I'm stuck on how to have the statement look for wp_2_options, wp_3_options, etc.</p> <p>I can do it individually with something like this:</p> <pre><code>UPDATE wp_10_options SET option_value = REPLA...
[ { "answer_id": 24497, "author": "Sean Lee", "author_id": 6851, "author_profile": "https://wordpress.stackexchange.com/users/6851", "pm_score": 0, "selected": false, "text": "<p>You can use <a href=\"http://wordpress.org/extend/plugins/log-user-access/\" rel=\"nofollow\">log-user-access</...
2011/07/27
[ "https://wordpress.stackexchange.com/questions/24185", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7374/" ]
I'd like to run a query through my WordPress database that updates the blog\_public values on all individual sites. I'm stuck on how to have the statement look for wp\_2\_options, wp\_3\_options, etc. I can do it individually with something like this: ``` UPDATE wp_10_options SET option_value = REPLACE(option_value, ...
here's an example that hooks login\_redirect and checks when their account was created, then redirects them to a url of your choice if it's been less than 48 hours: ``` function my_redirect( $to, $requested, $user ){ if( !isset( $user->user_login ) ){ // we only want this to run when credentials have been supplied...
24,195
<p>I'm looking into a way to have global menus across my network of blogs. Basically I am using wordpress as a CMS - the purpose of the network is actually to ringfence content. The sub blogs will be able to customise some areas of the template - but I would like them to share the main site's menu system.</p> <p>This ...
[ { "answer_id": 34256, "author": "user10418", "author_id": 10418, "author_profile": "https://wordpress.stackexchange.com/users/10418", "pm_score": 0, "selected": false, "text": "<p>This is similar to something I'm thinking of doing for one of my sites... I haven't implemented the idea yet...
2011/07/27
[ "https://wordpress.stackexchange.com/questions/24195", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6402/" ]
I'm looking into a way to have global menus across my network of blogs. Basically I am using wordpress as a CMS - the purpose of the network is actually to ringfence content. The sub blogs will be able to customise some areas of the template - but I would like them to share the main site's menu system. This is easy en...
That's an old question, if someone like me landed on this page for WORDPRESS MULTISITE MENU sharing across all network sites without any plugin, Not only menu you can use the same method to share anything other then widgets across all the network sites. here is the solution : Edit your Header.php ``` //store the c...
24,213
<p>I'm writing a custom signup script for users to register with on my MU-setup.</p> <p>One problem I'm having is that <code>wpmu_signup_user()</code> sends the password activation email but it doesn't return the user ID which I need for the rest of the script. - It's my understanding that this doesn't create the user...
[ { "answer_id": 24215, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>Send the email yourself within your signup script with the <a href=\"http://codex.wordpress.org/Function_Reference/...
2011/07/27
[ "https://wordpress.stackexchange.com/questions/24213", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3669/" ]
I'm writing a custom signup script for users to register with on my MU-setup. One problem I'm having is that `wpmu_signup_user()` sends the password activation email but it doesn't return the user ID which I need for the rest of the script. - It's my understanding that this doesn't create the user account, just an ent...
If you want to force add a MU user and activate them, and email them, this will do it. It's a slightly altered version of a piece of the code in user-new.php. ``` wpmu_signup_user( $new_user_login, $new_user_email, array( 'add_to_blog' => $blogid, 'new_role' => $role ) ); $key = $wpdb->get_var( $wpdb->prepare( "SELECT...
24,220
<p>I want to make the following happen in Wordpress </p> <ol> <li>People answer questions in paginated or single page form.</li> <li>Each next set of options is dependent on the option the user selects preiviously</li> <li>At the end, the user is directed to a page which is a common ending for all questionnaire trees....
[ { "answer_id": 24215, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>Send the email yourself within your signup script with the <a href=\"http://codex.wordpress.org/Function_Reference/...
2011/07/27
[ "https://wordpress.stackexchange.com/questions/24220", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7417/" ]
I want to make the following happen in Wordpress 1. People answer questions in paginated or single page form. 2. Each next set of options is dependent on the option the user selects preiviously 3. At the end, the user is directed to a page which is a common ending for all questionnaire trees. 4. All this questionnair...
If you want to force add a MU user and activate them, and email them, this will do it. It's a slightly altered version of a piece of the code in user-new.php. ``` wpmu_signup_user( $new_user_login, $new_user_email, array( 'add_to_blog' => $blogid, 'new_role' => $role ) ); $key = $wpdb->get_var( $wpdb->prepare( "SELECT...
24,222
<p>We're using the Feed Wordpress (Syndication) plugin to ingest external feeds resulting in posts published in WordPress.</p> <p>The plugin pulls the 'source' URL from the feed. We can display the source URL fine against the post on home and post page, but if the feed owner did not include a source URL, it does not e...
[ { "answer_id": 25537, "author": "Mediaforce", "author_id": 7792, "author_profile": "https://wordpress.stackexchange.com/users/7792", "pm_score": 2, "selected": false, "text": "<p>What about the \"syndication_permalink\"? This is automatically pulled from the feed by FeedWordpress. </p>\n...
2011/07/27
[ "https://wordpress.stackexchange.com/questions/24222", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4833/" ]
We're using the Feed Wordpress (Syndication) plugin to ingest external feeds resulting in posts published in WordPress. The plugin pulls the 'source' URL from the feed. We can display the source URL fine against the post on home and post page, but if the feed owner did not include a source URL, it does not exist. We ...
What about the "syndication\_permalink"? This is automatically pulled from the feed by FeedWordpress. Then put something like ``` <?php if (is_syndicated()) : ?> <p><a href="<?php the_syndication_permalink(); ?>" target="_blank">Source</a></p> <?php endif; ?> ``` in your single post loop.
24,237
<p>I need to add a bit of document ready jQuery to post/page editors in admin. I'm hacking an old plugin that adds a text box to the editor page and handles inserting that text in a template file, but the text input is only html; this document ready function adds the class of mceEditor to the text box. This function wo...
[ { "answer_id": 24238, "author": "Mario", "author_id": 7361, "author_profile": "https://wordpress.stackexchange.com/users/7361", "pm_score": 3, "selected": false, "text": "<p>Some time ago I needed something like this, this is what I used:</p>\n\n<pre><code>function admin_js() { ?&gt;\n ...
2011/07/27
[ "https://wordpress.stackexchange.com/questions/24237", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/268/" ]
I need to add a bit of document ready jQuery to post/page editors in admin. I'm hacking an old plugin that adds a text box to the editor page and handles inserting that text in a template file, but the text input is only html; this document ready function adds the class of mceEditor to the text box. This function works...
I'd be inclined to just do a one off enqueue and be done with it.. It means you have to manage an additional file(the JS file), but when you're writing code it's usually a good idea to create some form of organisation with your files(or at least get into the habit of doing so), ie. javascript/jquery in one folder, css...
24,260
<p>Can anyone help me filter wp_get_attachment_link so that a particular occurence of it links to the 'medium' or other size image rather than the full size. I have the following in a page template:</p> <pre><code>$args = array( 'post_type' =&gt; 'attachment', 'numberposts' =&gt; -1, 'post_status' =&gt; null, 'post_p...
[ { "answer_id": 24268, "author": "Mario", "author_id": 7361, "author_profile": "https://wordpress.stackexchange.com/users/7361", "pm_score": 0, "selected": false, "text": "<p>You can specify the size you want to link in the <code>wp_get_attachment_link</code> function, isn't the code you ...
2011/07/27
[ "https://wordpress.stackexchange.com/questions/24260", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7401/" ]
Can anyone help me filter wp\_get\_attachment\_link so that a particular occurence of it links to the 'medium' or other size image rather than the full size. I have the following in a page template: ``` $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID ...
I think I've answered my own question sort of.... As I was using a child theme of Hybrid I activated the cleaner gallery extension in the functions.php file: `add_theme_support( 'cleaner-gallery' );` Then, based on the topic [here](http://themehybrid.com/support/topic/cleaner-gallery-link-to-larger-image) I created ...
24,275
<p>I've a strange problem with an Autofocus theme.</p> <p>In my templates file, header.php, I've a code like this (and is correct)</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml...
[ { "answer_id": 24266, "author": "jjeaton", "author_id": 300, "author_profile": "https://wordpress.stackexchange.com/users/300", "pm_score": 3, "selected": true, "text": "<p>You can edit the page at any time after it is published. I would not recommend using maintenance mode, as then your...
2011/07/27
[ "https://wordpress.stackexchange.com/questions/24275", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2727/" ]
I've a strange problem with an Autofocus theme. In my templates file, header.php, I've a code like this (and is correct) ``` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> ``` When I look at the so...
You can edit the page at any time after it is published. I would not recommend using maintenance mode, as then your entire site will be unavailable while you are editing the page. When you are editing, your site is unaffected until you click "Update" and save the changes to the published post. No users will receive e...
24,278
<p>I'm working on a plugin and having some difficulties getting a new table created. I get the "The plugin generated x characters of unexpected output during activation" error. Is there a way of viewing the actual error? I believe that a redirect is involved in this process, hence the reason I don't see the actual erro...
[ { "answer_id": 61483, "author": "Lars Koudal", "author_id": 667, "author_profile": "https://wordpress.stackexchange.com/users/667", "pm_score": 1, "selected": false, "text": "<p>Interesting question, so I had a look on Google and some guy named Jason had a solution:</p>\n\n<pre><code>br_...
2011/07/28
[ "https://wordpress.stackexchange.com/questions/24278", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4850/" ]
I'm working on a plugin and having some difficulties getting a new table created. I get the "The plugin generated x characters of unexpected output during activation" error. Is there a way of viewing the actual error? I believe that a redirect is involved in this process, hence the reason I don't see the actual error o...
Interestingly the ability to display errors and output from a plugin on activation seems to be build in to WordPress. If you take a look at `wp-admin/plugins.php` there's a case in the `$action` switch statement that says `error_scrape` -- hinted at in Lars' answer. Looks like this: ``` <?php // wp-admin/plugins.php ...
24,292
<p>I'm creating a new website based on a theme using custom post type and WordPress 3.2.1.</p> <p>The problem is that my content was previously using %postname% permalinks and all my SEO is build on this. Using CPT add a slug like : <a href="http://mysite.com/slug-cpt/postname" rel="nofollow noreferrer">http://mysite....
[ { "answer_id": 33277, "author": "Joakim Ling", "author_id": 10133, "author_profile": "https://wordpress.stackexchange.com/users/10133", "pm_score": 2, "selected": false, "text": "<p>This is a tricky one, I had exactly the same problem but after a lot of debugging and troubleshooting I ma...
2011/07/28
[ "https://wordpress.stackexchange.com/questions/24292", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7409/" ]
I'm creating a new website based on a theme using custom post type and WordPress 3.2.1. The problem is that my content was previously using %postname% permalinks and all my SEO is build on this. Using CPT add a slug like : <http://mysite.com/slug-cpt/postname> I tried this rule in the register\_post\_type function bu...
This is a tricky one, I had exactly the same problem but after a lot of debugging and troubleshooting I managed to fix it. The trick is to add a new rewrite rule: ``` function book_rewrite_rule() { add_rewrite_rule( '(.*?)$', 'index.php?book=$matches[1]', 'top' ); } add_action( 'after_theme_setup', 'book_rewrite_...
24,293
<p>I have the following code to do a foreach loop, I want to target the last item in the loop (e.g if it's looped over 3 events I want to target the 3rd event) to do something slightly different with the css. How would I do that?</p> <pre><code>&lt;?php $pages = get_pages(array('child_of' =&gt; $post-&gt;ID, 'sort_col...
[ { "answer_id": 24294, "author": "Ashfame", "author_id": 1521, "author_profile": "https://wordpress.stackexchange.com/users/1521", "pm_score": 0, "selected": false, "text": "<p>Since <code>$pages</code> is an array, get its count by <code>$pages_count = count( $pages );</code> and then in...
2011/07/28
[ "https://wordpress.stackexchange.com/questions/24293", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4588/" ]
I have the following code to do a foreach loop, I want to target the last item in the loop (e.g if it's looped over 3 events I want to target the 3rd event) to do something slightly different with the css. How would I do that? ``` <?php $pages = get_pages(array('child_of' => $post->ID, 'sort_column' => 'menu_order'));...
You can try this : ``` foreach( $pages as $key => $post ) ``` and : ``` <div class = "event <?php if( $key == ( count( $pages ) - 1 ) ) echo 'last'; ?>" > ``` It will add a `last` class to your last `event` div.
24,297
<p>I have a CPT called "profile" that only supports the editor and thumbnail. Each user is limited to posting just 1 profile.</p> <p>I'm looking for a way to prefill the title and slug fields with the display name of the post author. As it is now, if I click on Publish, the post_status in the db is "Auto Draft" and th...
[ { "answer_id": 24300, "author": "t31os", "author_id": 31073, "author_profile": "https://wordpress.stackexchange.com/users/31073", "pm_score": 2, "selected": true, "text": "<p>You could add a hidden input into the page to pre-set the title field, because it won't be on the page(because th...
2011/07/28
[ "https://wordpress.stackexchange.com/questions/24297", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7408/" ]
I have a CPT called "profile" that only supports the editor and thumbnail. Each user is limited to posting just 1 profile. I'm looking for a way to prefill the title and slug fields with the display name of the post author. As it is now, if I click on Publish, the post\_status in the db is "Auto Draft" and the URL bec...
You could add a hidden input into the page to pre-set the title field, because it won't be on the page(because the type doesn't support titles). Slug is produced from the title, so you should only need add a title value. Something like this should work(though untested).. ``` add_action( 'submitpost_box', 'hidden_typ...
24,301
<p>I would like to remove the entire "Media" section from the main WordPress admin navigation ont he left hand side. What I don't want to do is just "hide" it with CSS or a plugin/function like I have done so below, because it's still accessible via the URL. This is crucial users shouldn't see each others uploads by an...
[ { "answer_id": 24302, "author": "PrivateUser", "author_id": 5074, "author_profile": "https://wordpress.stackexchange.com/users/5074", "pm_score": 0, "selected": false, "text": "<p>Why not you try <a href=\"http://wordpress.org/extend/plugins/role-scoper/\" rel=\"nofollow\">Role scoper pl...
2011/07/28
[ "https://wordpress.stackexchange.com/questions/24301", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4999/" ]
I would like to remove the entire "Media" section from the main WordPress admin navigation ont he left hand side. What I don't want to do is just "hide" it with CSS or a plugin/function like I have done so below, because it's still accessible via the URL. This is crucial users shouldn't see each others uploads by any m...
You are indeed correct, before the admin update(i imagine the UI redesign, etc), unsetting items from the menus would in effect prevent access to those pages, that's clearly changed now and requires additional cap checking. This isn't something i've looked into myself(as i've just found out this moment), so i can't s...
24,314
<p>Question has been asked before about how to synchronize files as well as the database between two Wordpress installations. </p> <p>For the database level, the answer is usually to basically dump one database and insert it onto another server. The problem with this is that you end up losing any changes that have pot...
[ { "answer_id": 24982, "author": "marfarma", "author_id": 4645, "author_profile": "https://wordpress.stackexchange.com/users/4645", "pm_score": 5, "selected": true, "text": "<p>The reality is that what we want is this: <a href=\"http://www.liquibase.org/\" rel=\"nofollow noreferrer\">http...
2011/07/28
[ "https://wordpress.stackexchange.com/questions/24314", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7414/" ]
Question has been asked before about how to synchronize files as well as the database between two Wordpress installations. For the database level, the answer is usually to basically dump one database and insert it onto another server. The problem with this is that you end up losing any changes that have potentially b...
The reality is that what we want is this: <http://www.liquibase.org/> > > Liquibase is an open source (Apache 2.0 Licensed), > database-independent library for tracking, managing and applying > database changes. It is built on a simple premise: All database > changes are stored in a human readable yet trackable fo...
24,351
<p>If there's a value for the custom field, I want it to display the value. If there's no value for the custom field, I want it to display "N/A". I have this working for custom fields but cant replicate the same functionality for a custom taxonomy.</p> <p>This works for a custom field:</p> <pre><code>$url = get_post_...
[ { "answer_id": 25000, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p><code>the_terms()</code> echoes output. To assign output to a variable and check if there is any you need to use <a ...
2011/07/28
[ "https://wordpress.stackexchange.com/questions/24351", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4499/" ]
If there's a value for the custom field, I want it to display the value. If there's no value for the custom field, I want it to display "N/A". I have this working for custom fields but cant replicate the same functionality for a custom taxonomy. This works for a custom field: ``` $url = get_post_meta( get_the_ID(), '...
`the_terms()` echoes output. To assign output to a variable and check if there is any you need to use [`get_the_term_list()`](http://codex.wordpress.org/Function_Reference/get_the_term_list) instead. Note that it might also return `WP_Error` object (which won't be empty) so you will need to check for it as well with [...
24,367
<p>Is there a file where WordPress defines <code>$GLOBALS</code>? </p> <p>I'm just curious as to what WordPress uses it for and for what purpose.</p> <p>That's all!</p>
[ { "answer_id": 24369, "author": "scribu", "author_id": 205, "author_profile": "https://wordpress.stackexchange.com/users/205", "pm_score": 3, "selected": false, "text": "<p>Unfortunately, no.</p>\n\n<p>Globals definitions are scattered throught the codebase.</p>\n\n<p>There's no document...
2011/07/28
[ "https://wordpress.stackexchange.com/questions/24367", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5149/" ]
Is there a file where WordPress defines `$GLOBALS`? I'm just curious as to what WordPress uses it for and for what purpose. That's all!
I'm not sure if all of these are WordPress globals, but I did a quick grep type search of the WordPress files and tried to extract all the globals I could.. This is the list I compiled. It may not be perfect, but should \*hopefully\* represent a lot of the `$GLOBALS` keys that WordPress uses It won't account for globa...
24,377
<p>Is there an exact opposite funciton to this one:</p> <pre><code>get_the_title(ID) </code></pre> <p>I know there's:</p> <pre><code>get_the_id() </code></pre> <p>But it doesn't seem to accept any arguments.</p> <p>So, basically, I'm looking for something like:</p> <pre><code>$title = 'Something'; get_the_id($ti...
[ { "answer_id": 24390, "author": "Michelle", "author_id": 16, "author_profile": "https://wordpress.stackexchange.com/users/16", "pm_score": 3, "selected": true, "text": "<p>I'm not sure how to get it via the title, but you can get it via the slug (which is often more useful in my experien...
2011/07/28
[ "https://wordpress.stackexchange.com/questions/24377", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1869/" ]
Is there an exact opposite funciton to this one: ``` get_the_title(ID) ``` I know there's: ``` get_the_id() ``` But it doesn't seem to accept any arguments. So, basically, I'm looking for something like: ``` $title = 'Something'; get_the_id($title); ``` I already know this solution: ``` global $wpdb; $pos...
I'm not sure how to get it via the title, but you can get it via the slug (which is often more useful in my experience) using this: <http://erikt.tumblr.com/post/278953342/get-a-wordpress-page-id-with-the-slug> Just change "$page" to "$post" if you want to return slugs for posts instead of pages. G'luck!
24,387
<p>I wasn't sure if this was a PHP issue (suited for StackOverflow) or a WordPress issue (suited for StackExchange), however since my issue <strong>appears</strong> to be with the <code>add_action()</code> function, I have placed the question here.</p> <p>Here's some simplified code which causes the same issue (to avo...
[ { "answer_id": 24389, "author": "Andre", "author_id": 7439, "author_profile": "https://wordpress.stackexchange.com/users/7439", "pm_score": 3, "selected": true, "text": "<p>Try:</p>\n\n<pre><code>&lt;?php\n$class = new MyClass();\n\nclass MyClass {\n public function MyClass() {\n ...
2011/07/29
[ "https://wordpress.stackexchange.com/questions/24387", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7429/" ]
I wasn't sure if this was a PHP issue (suited for StackOverflow) or a WordPress issue (suited for StackExchange), however since my issue **appears** to be with the `add_action()` function, I have placed the question here. Here's some simplified code which causes the same issue (to avoid re-posting my couple-hundred li...
Try: ``` <?php $class = new MyClass(); class MyClass { public function MyClass() { add_action('init', array($this, 'core')); } public static function core() { echo "I never get to here"; } } ?> ```
24,401
<p>I have 2 kinds of users...</p> <p>Both uses custom form for registeration....</p> <p>One is parent user and another is child users. Parent user can register and then login and create child users. I have also given interface in theme where parents can manage child users data created by them.</p> <p>Basically site ...
[ { "answer_id": 24405, "author": "Sean Lee", "author_id": 6851, "author_profile": "https://wordpress.stackexchange.com/users/6851", "pm_score": 3, "selected": false, "text": "<p>Try this plugin. <a href=\"http://wordpress.org/extend/plugins/user-switching/screenshots/\" rel=\"noreferrer\"...
2011/07/29
[ "https://wordpress.stackexchange.com/questions/24401", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6961/" ]
I have 2 kinds of users... Both uses custom form for registeration.... One is parent user and another is child users. Parent user can register and then login and create child users. I have also given interface in theme where parents can manage child users data created by them. Basically site is based on article for ...
To login as a user you just need the target user ID and these two functions: ``` wp_set_current_user( $user_id ); wp_set_auth_cookie( $user_id ); ``` If you do this mid-page, make sure you refresh it to reflect the changes.
24,402
<p>I created a custom post type for my blog, to allow easier separation of content. This new post type supports different post formats, but most of them will be galleries.</p> <pre><code>register_post_type('atelier', array( 'label' =&gt; 'L\'Atelier', 'public' =&gt; true, 'supports' =&gt; array('title'...
[ { "answer_id": 39879, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 3, "selected": true, "text": "<p>One option would be to <a href=\"http://codex.wordpress.org/Settings_Writing_Screen#Writing_Settings\" rel=\...
2011/07/29
[ "https://wordpress.stackexchange.com/questions/24402", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7443/" ]
I created a custom post type for my blog, to allow easier separation of content. This new post type supports different post formats, but most of them will be galleries. ``` register_post_type('atelier', array( 'label' => 'L\'Atelier', 'public' => true, 'supports' => array('title', 'editor', 'post-forma...
One option would be to [modify the global Default Post Format setting, via `Dashboard -> Settings -> Writing`](http://codex.wordpress.org/Settings_Writing_Screen#Writing_Settings). Note that this setting is *global*, so it would set the default for *all* post types that support Post Formats. If you have no need of po...
24,403
<p>I have a php/mysql based site with users segregated into different groups... i want to add blogging system to it so that each group has its own blog which can be authored by users who are designated to administer that group and can be read by each user of that group... how can this be done?</p>
[ { "answer_id": 24413, "author": "feeela", "author_id": 7089, "author_profile": "https://wordpress.stackexchange.com/users/7089", "pm_score": 0, "selected": false, "text": "<p>Is that \"php/mysql based site\" a self-done script or do you use a finished software. In the latter case, there ...
2011/07/29
[ "https://wordpress.stackexchange.com/questions/24403", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7444/" ]
I have a php/mysql based site with users segregated into different groups... i want to add blogging system to it so that each group has its own blog which can be authored by users who are designated to administer that group and can be read by each user of that group... how can this be done?
I haven't been working with WordPress too much, so there may be someone who can give you more details. But here's what I've come to understand: If you want to have multiple blogs (one for each group) then you need to EITHER: 1. Filter the posts according to who is logged in 2. Operate a multi-site WordPress install ...
24,416
<p>I have made a custom post type for a child theme. I removed "thumbnail" from the supports array in functions.php and that prevents a featured image meta box from being displayed. However, when in the "add an image" modal dialogue thing, there is still a "Use as featured image" link. Why, oh why? More to the point, d...
[ { "answer_id": 24418, "author": "Scott", "author_id": 4610, "author_profile": "https://wordpress.stackexchange.com/users/4610", "pm_score": 5, "selected": true, "text": "<p>Some where in your theme you should have: </p>\n\n<pre><code>add_theme_support( 'post-thumbnails' );\n</code></pre>...
2011/07/29
[ "https://wordpress.stackexchange.com/questions/24416", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7450/" ]
I have made a custom post type for a child theme. I removed "thumbnail" from the supports array in functions.php and that prevents a featured image meta box from being displayed. However, when in the "add an image" modal dialogue thing, there is still a "Use as featured image" link. Why, oh why? More to the point, does...
Some where in your theme you should have: ``` add_theme_support( 'post-thumbnails' ); ``` Instead of removing support for a post type try only adding support for the post types you want: ``` add_theme_support( 'post-thumbnails', array( 'post', 'movie' ) ); ```
24,423
<p><strong>Example:</strong></p> <p>video cat id = 4 video cat child category id's = 7,8,9 news cat id = 5 news cat child category id's = 11,12,13</p> <p>I wanna display choosen categories ( like video and news ) in the different archive.php?</p> <p>Is it possible thanks.</p> <p>( sorry about my bad Eng )</p> <p>T...
[ { "answer_id": 24447, "author": "chris_s", "author_id": 4273, "author_profile": "https://wordpress.stackexchange.com/users/4273", "pm_score": 0, "selected": false, "text": "<p>So you already know that you need to create a archive-category.php template for each category. Within each templ...
2011/07/29
[ "https://wordpress.stackexchange.com/questions/24423", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7394/" ]
**Example:** video cat id = 4 video cat child category id's = 7,8,9 news cat id = 5 news cat child category id's = 11,12,13 I wanna display choosen categories ( like video and news ) in the different archive.php? Is it possible thanks. ( sorry about my bad Eng ) Thanks for Chris S but its not what i want to do. `...
Create 2 pages category-news.php & category-video.php & put this code in them. Then customize the markup for both as you like ``` <?php $children = get_categories('child_of'=>get_query_var('cat')); $cat = array(get_query_var('cat')); foreach($children as $child) $cat[] = $child->term_id; $catPosts = new WP_Query( ...
24,427
<p>Let me preface this by saying that I hardly ever work with WordPress - in fact, the last time I did a site in WordPress was back during 2.2. Yesterday I made quite a mess of everything and asked several questions here trying to get a basic menu plugin working.</p> <p>I now have the plugin fully functional and behav...
[ { "answer_id": 24433, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 3, "selected": false, "text": "<p>If you use callbacks properly, there's no need for all the redundant code. <a href=\"https://github.com/chi...
2011/07/29
[ "https://wordpress.stackexchange.com/questions/24427", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7429/" ]
Let me preface this by saying that I hardly ever work with WordPress - in fact, the last time I did a site in WordPress was back during 2.2. Yesterday I made quite a mess of everything and asked several questions here trying to get a basic menu plugin working. I now have the plugin fully functional and behaving exactl...
My point of view is that main purpose and benefit of Settings API is **structure**. It helps to keep complex settings setups: * orderly (logic of registration and sections); * secure (nonces, validation callbacks); * extensible (hooking into another page or allowing to be hooked into). As with any such structural ov...
24,442
<p>I'm trying to create <code>&lt;div class="cat-hidden categories"&gt;&lt;/div&gt;</code> where <code>categories</code> is a list of the categories the current post is posted in.</p> <p>When just using <code>the_taxonomies()</code>, it outputs something like this:</p> <pre><code>&lt;div class="cat-hidden Job Type: &...
[ { "answer_id": 24458, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>you can use <a href=\"http://codex.wordpress.org/Function_Reference/wp_get_post_terms\" rel=\"nofollow\"><stro...
2011/07/29
[ "https://wordpress.stackexchange.com/questions/24442", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7457/" ]
I'm trying to create `<div class="cat-hidden categories"></div>` where `categories` is a list of the categories the current post is posted in. When just using `the_taxonomies()`, it outputs something like this: ``` <div class="cat-hidden Job Type: &lt;a href='http://www.cirkut.net/wp/libertyguide/genre/early-career/'...
you can use [**`wp_get_post_terms()`**](http://codex.wordpress.org/Function_Reference/wp_get_post_terms) to get a list of the post categories and just output the category slug which is already phrased for you, something like this: ``` //in your loop echo '<div class="cat-hidden'; $cats = wp_get_post_terms($post->ID,'c...
24,448
<p>I use custom category templates for a few of my categories. Ex: cat-12.php and so on. I use the Fv Simpler Seo and presently it doesnt seem to support an option to edit category templates.</p> <p>Considering that I use custom category templates, is there a function or a way I include custom meta description and cus...
[ { "answer_id": 24450, "author": "Alexey", "author_id": 7314, "author_profile": "https://wordpress.stackexchange.com/users/7314", "pm_score": -1, "selected": false, "text": "<p>Take a closer look at custom category templates.\nThere <strong>must</strong> be an option to edit them.\nMay be...
2011/07/29
[ "https://wordpress.stackexchange.com/questions/24448", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5411/" ]
I use custom category templates for a few of my categories. Ex: cat-12.php and so on. I use the Fv Simpler Seo and presently it doesnt seem to support an option to edit category templates. Considering that I use custom category templates, is there a function or a way I include custom meta description and custom title ...
for meta description of the category you can use followinf dunction ``` //META DESCRIPTION FUNCTION function seometadescription(){ global $post, $posts; if ( is_single() || is_page() ) : $customDesc = 'meta_desc'; if ( have_posts() ) : while ( have_posts() ) : the_post(); ...
24,453
<p>Trying to do the right thing here, and tying myself in a knot! So, in my header.php before <code>wp_admin</code>, I have:</p> <pre><code>wp_enqueue_script('commonfunctions', child_template_directory . '/script/commonfunctions.js', array('jquery', 'jquery-ui-draggable'), '1.0', true); </code></pre> <p>which works. ...
[ { "answer_id": 24455, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<blockquote>\n <p>I since took 'jquery' out as it seems to be loaded twice irrespectively.</p>\n</blockquote>\n\n<p>Th...
2011/07/29
[ "https://wordpress.stackexchange.com/questions/24453", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7216/" ]
Trying to do the right thing here, and tying myself in a knot! So, in my header.php before `wp_admin`, I have: ``` wp_enqueue_script('commonfunctions', child_template_directory . '/script/commonfunctions.js', array('jquery', 'jquery-ui-draggable'), '1.0', true); ``` which works. Basically, I have a custom js file wh...
I think you should just enqueue the script as well (for your validate script). I would wrap it around one whole function as well to avoid issue [#11526](http://core.trac.wordpress.org/ticket/11526): calling out Thus all together: ``` <head> ... <?php function mytheme_enqueue_script() { // Load jQuery wp_enqueue_scr...
24,465
<p>I have set a page as a homepage for my site. There are specific style sheets just for the homepage that I don't need to use globally. I'm still new to WordPress so this is so confusing to me. </p> <p>I have read <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_style" rel="nofollow">http://codex.wo...
[ { "answer_id": 24466, "author": "chrisjlee", "author_id": 5149, "author_profile": "https://wordpress.stackexchange.com/users/5149", "pm_score": 1, "selected": false, "text": "<p>Utilize the wordpress <a href=\"http://codex.wordpress.org/Conditional_Tags\" rel=\"nofollow\">conditional tag...
2011/07/29
[ "https://wordpress.stackexchange.com/questions/24465", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4807/" ]
I have set a page as a homepage for my site. There are specific style sheets just for the homepage that I don't need to use globally. I'm still new to WordPress so this is so confusing to me. I have read <http://codex.wordpress.org/Function_Reference/wp_enqueue_style> but I still don't understand how to incorporate i...
Utilize the wordpress [conditional tags](http://codex.wordpress.org/Conditional_Tags) to selectively enqueue / load your stylesheets. This is best practice so you can call any dependancies as well. I've provided an example of this in practice. Often we only want to include styles for the front page and then style acco...
24,507
<p>I've created my own WP 3.2 plugin. Now I want to put the WYSIWYG editor in it. I've tried the following code:</p> <pre><code>&lt;?php the_editor(null, 'body', null, false); ?&gt; </code></pre> <p>Then it's displayed. I don't know why, but the CSS doesn't look as it should look. Am I missing something? Should I inc...
[ { "answer_id": 33683, "author": "marcochiesi", "author_id": 10236, "author_profile": "https://wordpress.stackexchange.com/users/10236", "pm_score": 0, "selected": false, "text": "<p>I recommend you the following article: <a href=\"http://dannyvankooten.com/450/tinymce-wysiwyg-editor-in-w...
2011/07/30
[ "https://wordpress.stackexchange.com/questions/24507", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7473/" ]
I've created my own WP 3.2 plugin. Now I want to put the WYSIWYG editor in it. I've tried the following code: ``` <?php the_editor(null, 'body', null, false); ?> ``` Then it's displayed. I don't know why, but the CSS doesn't look as it should look. Am I missing something? Should I include any CSS file?! ![weird tin...
Look how I did it in my [Meta Box Class](https://gist.github.com/1748108): ``` $editor_settings = array ( 'textarea_rows' => 8 , 'media_buttons' => FALSE , 'teeny' => TRUE , 'tinymce' => FALSE // a very minimal setup , 'quicktags' => array ( 'buttons' => 'strong,em,link' ) ); wp_edit...
24,537
<p>I'm working on a new Wordpress theme; the default index view displays the excerpts of recent posts. Some posts will be regarding file downloads, and include an image, description, and link to the location where the described files are hosted. The images for these types of posts will be anchored with links(other type...
[ { "answer_id": 24541, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 1, "selected": false, "text": "<p>If I understand it correctly, in you index.php you want to link the image to the full post. You can accomplish tha...
2011/07/31
[ "https://wordpress.stackexchange.com/questions/24537", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7491/" ]
I'm working on a new Wordpress theme; the default index view displays the excerpts of recent posts. Some posts will be regarding file downloads, and include an image, description, and link to the location where the described files are hosted. The images for these types of posts will be anchored with links(other types o...
Because I don't have post thumbnails defined, and since posts may or may not contain multiple images, I ended up doing it this way: I turned off tags in excerpts(I had an excerpt plugin enabling tags in excerpt), then I added the following to the function.php file: ``` function catch_that_image() { global $post...
24,551
<p>i have Wp blog that need to receive a custom paramter on category page for filter the posts like my rule.</p> <p>For example: </p> <blockquote> <p><a href="http://mysite.com/category/teste?myvar=ABC" rel="nofollow">http://mysite.com/category/teste?myvar=ABC</a></p> </blockquote> <p>How can I get the myvar from ...
[ { "answer_id": 24558, "author": "Khalid", "author_id": 7382, "author_profile": "https://wordpress.stackexchange.com/users/7382", "pm_score": 0, "selected": false, "text": "<p>You could use this:</p>\n\n<pre><code>&lt;?php\n$myvar = $_GET['myvar'];\n?&gt;\n</code></pre>\n\n<p>and to make ...
2011/07/31
[ "https://wordpress.stackexchange.com/questions/24551", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5403/" ]
i have Wp blog that need to receive a custom paramter on category page for filter the posts like my rule. For example: > > <http://mysite.com/category/teste?myvar=ABC> > > > How can I get the myvar from URL? I tried a lot of examples on the web, but no one works for the category page. Thanks!
Solved using this code. ``` add_filter( 'category_link','append_parameter', 10, 2 ); function append_parameter( $link, $my_parameter ) { $my_parameter = $_GET['sort']; //get sort value if ( isset($my_parameter) ) { $link = add_query_arg( 'sort', $my_parameter, $link ); } return $link; } ```
24,553
<p>I am trying to create two functions, one that catches the first paragraph of some content, and one that catches the rest, but I have hit a bit of a conundrum.</p> <p>I have this in my single.php:</p> <pre><code>&lt;div class='the_content'&gt; &lt;?php the_content(); ?&gt; &lt;/div&gt; </code></pre> <p>which pro...
[ { "answer_id": 24554, "author": "javipas", "author_id": 3795, "author_profile": "https://wordpress.stackexchange.com/users/3795", "pm_score": 2, "selected": false, "text": "<p>If I have understand you, what you want is permalinks for each paragraph? The known blogger Dave Winer <a href=\...
2011/07/31
[ "https://wordpress.stackexchange.com/questions/24553", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/784/" ]
I am trying to create two functions, one that catches the first paragraph of some content, and one that catches the rest, but I have hit a bit of a conundrum. I have this in my single.php: ``` <div class='the_content'> <?php the_content(); ?> </div> ``` which produces: ``` <div class="the_content"> <p>The con...
The paragraphs are done by the [`wpautop()`](http://core.trac.wordpress.org/browser/branches/3.1/wp-includes/formatting.php#L181) function, hooked to `the_content`, `the_excerpt()` & `comment_text` as well as `'term_description'` for taxonomies. --- The plugin linked by @javipas does an enormous effort to just add th...
24,563
<pre><code>Your `warmHome_cutstr` function causes in the inline stylesheet of the gallery to be displayed. See gallery-post.jpg.[http://themes.trac.wordpress.org/attachment/ticket/4560/gallery-post.jpg][1] To solve this, you need to hook into the_content and remove the gallery shortcode. In functions.php: add_filt...
[ { "answer_id": 24572, "author": "Jeremy Jared", "author_id": 5339, "author_profile": "https://wordpress.stackexchange.com/users/5339", "pm_score": 3, "selected": true, "text": "<p>To remove the Gallery Short-code completely add this to your themes function.php file:</p>\n\n<pre><code>rem...
2011/08/01
[ "https://wordpress.stackexchange.com/questions/24563", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1962/" ]
``` Your `warmHome_cutstr` function causes in the inline stylesheet of the gallery to be displayed. See gallery-post.jpg.[http://themes.trac.wordpress.org/attachment/ticket/4560/gallery-post.jpg][1] To solve this, you need to hook into the_content and remove the gallery shortcode. In functions.php: add_filter( 'th...
To remove the Gallery Short-code completely add this to your themes function.php file: ``` remove_shortcode('gallery', 'gallery_shortcode'); ```
24,580
<p>For efficiency we are trying to hook some JS scripts only a certain page template of a theme that is to hold a form: page-with-form.php</p> <p>On the theme functions.php we've defined a init_method as such:</p> <pre><code>function my_init_method(){ $dir = get_bloginfo('stylesheet_directory')."/js/jquery.js";...
[ { "answer_id": 24581, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 2, "selected": false, "text": "<p>When you loaded your template file, you already passed the <code>'template_redirect'</code> hook, which is too late...
2011/08/01
[ "https://wordpress.stackexchange.com/questions/24580", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7310/" ]
For efficiency we are trying to hook some JS scripts only a certain page template of a theme that is to hold a form: page-with-form.php On the theme functions.php we've defined a init\_method as such: ``` function my_init_method(){ $dir = get_bloginfo('stylesheet_directory')."/js/jquery.js"; wp_deregister_sc...
`init` is much earlier than page template loading and not appropriate place for enqueues (despite many tutorials and docs using it for that). Hook your function to `wp_enqueue_scripts` and make sure you are doing that hooking before `wp_head()` call in template.
24,582
<p>Is there any way to get only parent terms from custom taxonomy or category?</p>
[ { "answer_id": 24586, "author": "Michael", "author_id": 4884, "author_profile": "https://wordpress.stackexchange.com/users/4884", "pm_score": 2, "selected": false, "text": "<p>use the 'parent' parameter:</p>\n\n<p><a href=\"http://codex.wordpress.org/Function_Reference/get_terms\" rel=\"...
2011/08/01
[ "https://wordpress.stackexchange.com/questions/24582", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/888/" ]
Is there any way to get only parent terms from custom taxonomy or category?
Yes, just pass in the parent parameter to `get_terms` when you call it, as Michael pointed out. Since WP 4.5 this is the recommend usage: ``` $myterms = get_terms( array( 'taxonomy' => 'taxonomy_name', 'parent' => 0 ) ); ``` Prior to WP 4.5 this was the default usage: ``` $myterms = get_terms( 'taxonomy_name_here...
24,587
<p>How do I skip wordpress's 404 handling and redirect all 404 errors for static files to 404.html?</p> <p>I read and it seems its not possible when using permalinks?</p> <p>The objective is to reduce the server load for 404 errors by not loading php.</p>
[ { "answer_id": 24611, "author": "bueltge", "author_id": 170, "author_profile": "https://wordpress.stackexchange.com/users/170", "pm_score": 1, "selected": false, "text": "<p>Maybe a simple solution. Use the conditional tag <code>is_404()</code> and create an redirect to your static file;...
2011/08/01
[ "https://wordpress.stackexchange.com/questions/24587", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5384/" ]
How do I skip wordpress's 404 handling and redirect all 404 errors for static files to 404.html? I read and it seems its not possible when using permalinks? The objective is to reduce the server load for 404 errors by not loading php.
### .htaccess skip WordPress 404 error handling for **static files**. ``` <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(robots\.txt|sitemap\.xml(\.gz)?) RewriteCond %{REQUEST_FILENAM...
24,593
<p>I'm using scribu's <a href="http://wordpress.org/extend/plugins/query-multiple-taxonomies/" rel="nofollow">Query Multiple Taxonomies</a> to filter posts through multiple taxonomies (which works great!).</p> <p>However, I'd like to allow people to perform further sorting on the results based on custom fields which h...
[ { "answer_id": 24611, "author": "bueltge", "author_id": 170, "author_profile": "https://wordpress.stackexchange.com/users/170", "pm_score": 1, "selected": false, "text": "<p>Maybe a simple solution. Use the conditional tag <code>is_404()</code> and create an redirect to your static file;...
2011/08/01
[ "https://wordpress.stackexchange.com/questions/24593", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7408/" ]
I'm using scribu's [Query Multiple Taxonomies](http://wordpress.org/extend/plugins/query-multiple-taxonomies/) to filter posts through multiple taxonomies (which works great!). However, I'd like to allow people to perform further sorting on the results based on custom fields which have numeric values (eg. `rate_per__p...
### .htaccess skip WordPress 404 error handling for **static files**. ``` <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(robots\.txt|sitemap\.xml(\.gz)?) RewriteCond %{REQUEST_FILENAM...
24,597
<p>As the title says, how can i increase the login expiration period?</p> <p>Running a local install it's a little annoying to have to keep logging in, despite the fact i have the browser remember login credentials it's an extra step i have to perform everytime i fire up the local server.</p> <p>I assume if i increas...
[ { "answer_id": 24602, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>this doesn't answer your question specifically, but you can pass your user id to <a href=\"http://codex.wordpress.o...
2011/08/01
[ "https://wordpress.stackexchange.com/questions/24597", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/31073/" ]
As the title says, how can i increase the login expiration period? Running a local install it's a little annoying to have to keep logging in, despite the fact i have the browser remember login credentials it's an extra step i have to perform everytime i fire up the local server. I assume if i increase the cookie expi...
Don't know if this is the best way, but I've been using this in functions.php in my themes: ``` function keep_me_logged_in_for_1_year( $expirein ) { return 31556926; // 1 year in seconds } add_filter( 'auth_cookie_expiration', 'keep_me_logged_in_for_1_year' ); ```
24,600
<p>Right now, I have this code:</p> <pre><code>function mr_np_activate(){ // hook uninstall if ( function_exists('register_uninstall_hook') ) register_uninstall_hook(__FILE__,'mr_np_uninstall'); } register_activation_hook(__FILE__,'mr_np_activate'); /** * Delete options * **/ function...
[ { "answer_id": 24604, "author": "t31os", "author_id": 31073, "author_profile": "https://wordpress.stackexchange.com/users/31073", "pm_score": 4, "selected": true, "text": "<p>You could always use an <strong>uninstall.php</strong> file for the plugin instead.</p>\n<p><a href=\"http://code...
2011/08/01
[ "https://wordpress.stackexchange.com/questions/24600", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7512/" ]
Right now, I have this code: ``` function mr_np_activate(){ // hook uninstall if ( function_exists('register_uninstall_hook') ) register_uninstall_hook(__FILE__,'mr_np_uninstall'); } register_activation_hook(__FILE__,'mr_np_activate'); /** * Delete options * **/ function mr_np_uninstal...
You could always use an **uninstall.php** file for the plugin instead. <http://codex.wordpress.org/Function_Reference/register_uninstall_hook> > > If the plugin can not be written without running code within the plugin, then the plugin should create a file named 'uninstall.php' in the base plugin folder. This file w...
24,618
<p>I'm getting confused trying to implement these custom theme hooks. Trying to wrap my head around that.</p> <p>I thought i understood this. but now after reading code for several hours; it's made it worst.</p> <p>How do i modify the argument being passed in the following?</p> <p><code>functions.php</code></p> <pr...
[ { "answer_id": 24625, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 4, "selected": true, "text": "<p>If you want <code>theme_content</code> hook to run with arguments that you pass to <code>theme_content()</code> funct...
2011/08/01
[ "https://wordpress.stackexchange.com/questions/24618", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5149/" ]
I'm getting confused trying to implement these custom theme hooks. Trying to wrap my head around that. I thought i understood this. but now after reading code for several hours; it's made it worst. How do i modify the argument being passed in the following? `functions.php` ``` function theme_content() { do_actio...
If you want `theme_content` hook to run with arguments that you pass to `theme_content()` function you need to write it like this: ``` function theme_content($args) { do_action('theme_content', $args); } ```
24,626
<p>I currently have a static front page and a /blog.</p> <p>My goal is to have the front page be a grid of hand selected images (similar to a portfolio). I would like to be able to easily switch the images are featured on this page without having to change the raw html.</p> <p>Is the best way to do this, using custom...
[ { "answer_id": 24625, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 4, "selected": true, "text": "<p>If you want <code>theme_content</code> hook to run with arguments that you pass to <code>theme_content()</code> funct...
2011/08/01
[ "https://wordpress.stackexchange.com/questions/24626", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7517/" ]
I currently have a static front page and a /blog. My goal is to have the front page be a grid of hand selected images (similar to a portfolio). I would like to be able to easily switch the images are featured on this page without having to change the raw html. Is the best way to do this, using custom fields on a page...
If you want `theme_content` hook to run with arguments that you pass to `theme_content()` function you need to write it like this: ``` function theme_content($args) { do_action('theme_content', $args); } ```
24,646
<p>I've just begun setting up the overstand theme to work with my blog, but I've run into a problem. Check out my site: <a href="http://beachief.com/" rel="nofollow">http://beachief.com/</a>, the problem is pretty obvious. Those two black categories have been like that since I first installed the theme - I have done no...
[ { "answer_id": 24648, "author": "GavinR", "author_id": 2001, "author_profile": "https://wordpress.stackexchange.com/users/2001", "pm_score": 1, "selected": false, "text": "<p>In your style.css, on line ~ 878, modify the \"width\" line so that the block reads:</p>\n\n<pre><code>ul.latesto...
2011/08/02
[ "https://wordpress.stackexchange.com/questions/24646", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7523/" ]
I've just begun setting up the overstand theme to work with my blog, but I've run into a problem. Check out my site: <http://beachief.com/>, the problem is pretty obvious. Those two black categories have been like that since I first installed the theme - I have done nothing to change them. I'd like those two areas to s...
**You should replace this code:** ``` ul.latestoneandhalf { float:left; padding-right:15px; width:225px; } ``` **With this:** ``` ul.latestoneandhalf { float:left; padding-right:15px; width:100%; } ```
24,661
<p>I've created many post with multiple pages with the nextpage-tag. The problem is that these show up as errors in "Google Webmaster Tools" because of duplicate title tags and meta descriptions.</p> <p>The urls are like this:</p> <pre><code>http://mypage.com/mypost/ http://mypage.com/mypost/2 http://mypage.com/mypos...
[ { "answer_id": 24663, "author": "Anh Tran", "author_id": 2051, "author_profile": "https://wordpress.stackexchange.com/users/2051", "pm_score": 2, "selected": false, "text": "<p>Is \"WP SEO\" = \"WordPress SEO by Yoast\"? If so, the plugin has some tags for you:</p>\n\n<ul>\n<li><code>%%p...
2011/08/02
[ "https://wordpress.stackexchange.com/questions/24661", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7531/" ]
I've created many post with multiple pages with the nextpage-tag. The problem is that these show up as errors in "Google Webmaster Tools" because of duplicate title tags and meta descriptions. The urls are like this: ``` http://mypage.com/mypost/ http://mypage.com/mypost/2 http://mypage.com/mypost/3 ``` all of whic...
Is "WP SEO" = "WordPress SEO by Yoast"? If so, the plugin has some tags for you: * `%%page%%` - Replaced with the current page number (i.e. page 2 of 4) * `%%pagetotal%%` - Replaced with the current page total * `%%pagenumber%%` - Replaced with the current page number Just look at the bottom of the page `wp-admin/adm...
24,698
<p>I've read a ton of tutorials and articles and searched for days now, but I still can't seem to get my custom fields to display in the loop and I could use a hand.</p> <p>First off, I definitely have the custom fields enabled and they are taking data. When I edit a post (I'm using the More Fields plugin), I can see ...
[ { "answer_id": 24729, "author": "Aris Blevins", "author_id": 6062, "author_profile": "https://wordpress.stackexchange.com/users/6062", "pm_score": 0, "selected": false, "text": "<p>Sorry to repost here - I can't comment yet. Vote me up to 50 and help us both out.</p>\n\n<p>Anyway, lookin...
2011/08/02
[ "https://wordpress.stackexchange.com/questions/24698", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7550/" ]
I've read a ton of tutorials and articles and searched for days now, but I still can't seem to get my custom fields to display in the loop and I could use a hand. First off, I definitely have the custom fields enabled and they are taking data. When I edit a post (I'm using the More Fields plugin), I can see the native...
Just passing on my solution in case it's of any help to anyone. I'm still not completely sure what happened, but after disabling all plugins and eventually trying a completely separate, vanilla install on my localhost, I determined that something had gone wrong in the theme files. I was able to fix the issues by dow...
24,702
<p>I'm using the <a href="http://wordpress.org/extend/plugins/mailchimp-sts/" rel="nofollow">Mailchimp STS plugin for Wordpress</a>, which uses <a href="http://aws.amazon.com/ses/" rel="nofollow">Amazon SES</a> for transactional emails. The plugin is set up correctly, but the default "From" name appears only as "andrew...
[ { "answer_id": 24703, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>There are two modes email can be sent with the plugin:</p>\n\n<ul>\n<li>simple emails are sent through STS;</li>\n<l...
2011/08/02
[ "https://wordpress.stackexchange.com/questions/24702", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7554/" ]
I'm using the [Mailchimp STS plugin for Wordpress](http://wordpress.org/extend/plugins/mailchimp-sts/), which uses [Amazon SES](http://aws.amazon.com/ses/) for transactional emails. The plugin is set up correctly, but the default "From" name appears only as "andrew" in sent emails. Since there is no option to change th...
There are two modes email can be sent with the plugin: * simple emails are sent through STS; * email with anything that STS doesn't support (custom headers, attachments, etc) are sent through fallback function, that is simply copy of native `wp_mail()` function. For former plugin doesn't set from name at all. For lat...
24,710
<p>I have a template page that has form on that is only used once in my site. The form uses form validation using <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jquery validate plugin</a> (such a great plugin). Once the cart66 Plugin is loaded, the form validation stops working.</p> <p>Rather...
[ { "answer_id": 24713, "author": "Aris Blevins", "author_id": 6062, "author_profile": "https://wordpress.stackexchange.com/users/6062", "pm_score": 2, "selected": false, "text": "<p>It sounds like the javascript from cart66 and your form plugin are in conflict. You can 'turn off' javascri...
2011/08/02
[ "https://wordpress.stackexchange.com/questions/24710", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7557/" ]
I have a template page that has form on that is only used once in my site. The form uses form validation using [jquery validate plugin](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) (such a great plugin). Once the cart66 Plugin is loaded, the form validation stops working. Rather spending ages lookin...
It sounds like the javascript from cart66 and your form plugin are in conflict. You can 'turn off' javascript per page/ post etc. by using the enqueue script function. Hopefully both of your plugins are written well and include their javascript with this method. <http://codex.wordpress.org/Function_Reference/wp_enque...
24,715
<p>This stuff is driving me nuts. The following url does NOT exist and should return a 404: <a href="http://www.easyjob.net/resume/" rel="nofollow">http://www.easyjob.net/resume/</a></p> <p>However, if I try to access it, I get a 301 to <a href="http://www.easyjob.net/r/cover-letter/resume-and-cover-letter/" rel="nofo...
[ { "answer_id": 24748, "author": "Jeremy Jared", "author_id": 5339, "author_profile": "https://wordpress.stackexchange.com/users/5339", "pm_score": 2, "selected": true, "text": "<p>If you remove your Redirect from the .htaccess file, you could try adding a custom 404.php template file to ...
2011/08/02
[ "https://wordpress.stackexchange.com/questions/24715", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7250/" ]
This stuff is driving me nuts. The following url does NOT exist and should return a 404: <http://www.easyjob.net/resume/> However, if I try to access it, I get a 301 to <http://www.easyjob.net/r/cover-letter/resume-and-cover-letter/> Even if I add a redirect to the .htaccess to redirect it somewhere else, I still get...
If you remove your Redirect from the .htaccess file, you could try adding a custom 404.php template file to your theme. I'm not sure exactly what you are asking. Do you want the page to Redirect, or do you want a custom 404 page that displays similar items? To achieve the show similar posts using the 404.php template ...
24,717
<p>Was wondering if there was a class or programming technique that would allow me to check for the installation and activation of a particular plugin and if said plugin were not installed, to have it downloaded from WordPress's plugin repository? </p> <p>I have a plugin I would like to require scribu's Post 2 Post pl...
[ { "answer_id": 24720, "author": "tollmanz", "author_id": 4850, "author_profile": "https://wordpress.stackexchange.com/users/4850", "pm_score": 3, "selected": false, "text": "<p>My method to handle a similar situation was to look for a core class or function in the plugin dependency and c...
2011/08/02
[ "https://wordpress.stackexchange.com/questions/24717", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2234/" ]
Was wondering if there was a class or programming technique that would allow me to check for the installation and activation of a particular plugin and if said plugin were not installed, to have it downloaded from WordPress's plugin repository? I have a plugin I would like to require scribu's Post 2 Post plugin and I...
I would encourage against this, but I understand what you're trying to do and do something similar myself. How I do it =========== I build themes that depend on plugins, plugins that depend on plugins, and plugins that depend on plugins that depend on other plugins. If I'm controlling both sides of the development, I...
24,719
<p>I have been trying and trying to fix jquery issues. i have in my header lots of jquery. I use it for slider and other things that are built into this premade theme. I am unable to add anything that uses jquery because of conflict. i need some help. The board is www.cgwhat.com. The forgot password is jquery and the ...
[ { "answer_id": 24725, "author": "Jared Cobb", "author_id": 6737, "author_profile": "https://wordpress.stackexchange.com/users/6737", "pm_score": 3, "selected": true, "text": "<p>At least one issue I can see is that you're including the jQuery framework at least twice. The first line </p...
2011/08/02
[ "https://wordpress.stackexchange.com/questions/24719", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7558/" ]
I have been trying and trying to fix jquery issues. i have in my header lots of jquery. I use it for slider and other things that are built into this premade theme. I am unable to add anything that uses jquery because of conflict. i need some help. The board is www.cgwhat.com. The forgot password is jquery and the slid...
At least one issue I can see is that you're including the jQuery framework at least twice. The first line ``` <?php wp_enqueue_script("jquery"); ?> ``` Is the preferred method of including jQuery. Your installation of WordPress happens to include jQuery version 1.4.2. This allows good plugin and theme developers to...
24,724
<p>I read the answer for <a href="https://wordpress.stackexchange.com/questions/17622/custom-post-type-archive-with-dynamic-taxonomy-filtering-is-it-possible">this post</a> which says you can do something like this:</p> <pre><code>http://example.com?post_type=car&amp;color=red </code></pre> <p>When viewing $wp_query ...
[ { "answer_id": 24725, "author": "Jared Cobb", "author_id": 6737, "author_profile": "https://wordpress.stackexchange.com/users/6737", "pm_score": 3, "selected": true, "text": "<p>At least one issue I can see is that you're including the jQuery framework at least twice. The first line </p...
2011/08/02
[ "https://wordpress.stackexchange.com/questions/24724", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7152/" ]
I read the answer for [this post](https://wordpress.stackexchange.com/questions/17622/custom-post-type-archive-with-dynamic-taxonomy-filtering-is-it-possible) which says you can do something like this: ``` http://example.com?post_type=car&color=red ``` When viewing $wp\_query everything seems to be working fine. Tha...
At least one issue I can see is that you're including the jQuery framework at least twice. The first line ``` <?php wp_enqueue_script("jquery"); ?> ``` Is the preferred method of including jQuery. Your installation of WordPress happens to include jQuery version 1.4.2. This allows good plugin and theme developers to...
24,736
<p>I have a custom post form that sends data to a page which uses wp_insert_post to create a post. I can easily sanitize most data, but I have some troubles with my tags, I retrieve in an array:</p> <pre><code>$tags = $_POST['tags']; </code></pre> <p>Before using these tags as tags_input, how can I successfully sani...
[ { "answer_id": 26464, "author": "FLX", "author_id": 4284, "author_profile": "https://wordpress.stackexchange.com/users/4284", "pm_score": 3, "selected": true, "text": "<p>If anyone is interested, I solved it like this:</p>\n\n<pre><code> $tags = $_POST['tags'];\n if (count(...
2011/08/02
[ "https://wordpress.stackexchange.com/questions/24736", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4284/" ]
I have a custom post form that sends data to a page which uses wp\_insert\_post to create a post. I can easily sanitize most data, but I have some troubles with my tags, I retrieve in an array: ``` $tags = $_POST['tags']; ``` Before using these tags as tags\_input, how can I successfully sanitize all names? Thanks...
If anyone is interested, I solved it like this: ``` $tags = $_POST['tags']; if (count($tags) > 5){ echo 'Niet meer dan 5 tags'; $stop = true; } if (is_array($tags)) { foreach ($tags as &$tag) { $tag = esc_attr($tag); } ...
24,769
<p>This morning most of the images on my wordpress blog (http://records.photodharma.net) have stopped loading. </p> <p>This even happening on embeds. All the images here are embedded: <a href="http://records.photodharma.net/photos/chiang-mai-photo-albums-of-modern-structures" rel="nofollow">http://records.photodharma....
[ { "answer_id": 24789, "author": "Tom", "author_id": 3482, "author_profile": "https://wordpress.stackexchange.com/users/3482", "pm_score": 0, "selected": false, "text": "<p>The odd thing I see here is they load when you direct link to them, like this:</p>\n\n<p><a href=\"http://photodharm...
2011/08/03
[ "https://wordpress.stackexchange.com/questions/24769", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4360/" ]
This morning most of the images on my wordpress blog (http://records.photodharma.net) have stopped loading. This even happening on embeds. All the images here are embedded: <http://records.photodharma.net/photos/chiang-mai-photo-albums-of-modern-structures> When I view them in Firebug, they appear, but not on the pag...
I've opened [one of the missing images](http://www.photodharma.net/Thailand/Chiang-Man/images/Chiang-Man-Slide-00018.jpg) on a different tab and a 'Forbidden 403' message appears. The page shows as follows: 403 Forbidden You are not allowed to access this page. Possible problems: * Missing index file * Misconfigur...
24,773
<p>whenever admin or any other user logs in a top bar menu ads up. Now I made login for everybody, so I do not want this bar. </p> <p>First I added <code>display:none</code> to <code>admin-bar.css</code>, but the main problem is that wordpress is still adding a white line on the top with: </p> <pre><code>html { m...
[ { "answer_id": 24776, "author": "Rev. Voodoo", "author_id": 3429, "author_profile": "https://wordpress.stackexchange.com/users/3429", "pm_score": 5, "selected": true, "text": "<p><a href=\"http://vudu.me/88\">http://vudu.me/88</a></p>\n\n<p>Has an article about it.</p>\n\n<p>But basicall...
2011/08/03
[ "https://wordpress.stackexchange.com/questions/24773", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7552/" ]
whenever admin or any other user logs in a top bar menu ads up. Now I made login for everybody, so I do not want this bar. First I added `display:none` to `admin-bar.css`, but the main problem is that wordpress is still adding a white line on the top with: ``` html { margin-top: 28px !important; } ``` How to ...
<http://vudu.me/88> Has an article about it. But basically ``` /* Disable the Admin Bar. */ add_filter( 'show_admin_bar', '__return_false' ); ``` or also ``` //REMOVE ADMIN BAR remove_action('init', 'wp_admin_bar_init'); ``` I believe in your functions.php will disable it. Probably a better way than just hiding...
24,788
<p>i want to create conditional tags for the business directory categories as the conditional tags which are provided are for normal categories.which do not work for the business directory categories.can i do ths? if yes, then how?</p> <p>thanks in advance.</p>
[ { "answer_id": 24792, "author": "Tom", "author_id": 3482, "author_profile": "https://wordpress.stackexchange.com/users/3482", "pm_score": -1, "selected": false, "text": "<p>I'm not sure what your \"business directory\" categories are. Are you using a specific plugin to create this busine...
2011/08/03
[ "https://wordpress.stackexchange.com/questions/24788", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7199/" ]
i want to create conditional tags for the business directory categories as the conditional tags which are provided are for normal categories.which do not work for the business directory categories.can i do ths? if yes, then how? thanks in advance.
you can use [has\_term](http://codex.wordpress.org/Function_Reference/has_term) to check if a post as a term which that is what "business directory categories" are (custom taxonomy terms). something like: ``` if (has_term( $term, $taxonomy, $post_id )){ //do your thing } ``` if you want to check if you are in a spec...
24,794
<p>How would I get the top-level parent of a given term?</p> <p>I am using <code>wp_get_object_terms</code> to get taxonomy terms on posts, but instead of showing all tagged terms, I only want to show tagged terms' top-level parents.</p> <p>So if these are my selected terms, I only want to show Breakfast, Lunch and D...
[ { "answer_id": 24795, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": false, "text": "<p>Here is a simple function that will get you the top most parent term of any given term:</p>\n\n<pre><code>fun...
2011/08/03
[ "https://wordpress.stackexchange.com/questions/24794", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3564/" ]
How would I get the top-level parent of a given term? I am using `wp_get_object_terms` to get taxonomy terms on posts, but instead of showing all tagged terms, I only want to show tagged terms' top-level parents. So if these are my selected terms, I only want to show Breakfast, Lunch and Dinner. ``` x BREAKFAST x...
Thanks to Ivaylo for this code, which was based on Bainternet's answer. The first function below, `get_term_top_most_parent`, accepts a term and taxonomy and returns the the term's top-level parent (or the term itself, if it's parentless); the second function (`get_top_parents`) works in the loop, and, given a taxono...
24,829
<p>Read an article about Timthumb script being compromised making WP installations vulnerable. <a href="http://www.theinquirer.net/inquirer/news/2099162/wordpress-blogs-risk" rel="nofollow">Source here</a></p> <p>Taking a look at timthumb.php, There is the following function, which I presume is the culprit.</p> <pre>...
[ { "answer_id": 24831, "author": "Otto", "author_id": 2232, "author_profile": "https://wordpress.stackexchange.com/users/2232", "pm_score": 3, "selected": false, "text": "<p>Best way: Remove the timthumb script from your server and change your theme so as to not require it in the first pl...
2011/08/03
[ "https://wordpress.stackexchange.com/questions/24829", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5411/" ]
Read an article about Timthumb script being compromised making WP installations vulnerable. [Source here](http://www.theinquirer.net/inquirer/news/2099162/wordpress-blogs-risk) Taking a look at timthumb.php, There is the following function, which I presume is the culprit. ``` function checkExternal ($src) { $all...
Best way: Remove the timthumb script from your server and change your theme so as to not require it in the first place. Timthumb isn't really necessary with newer versions of WordPress. The add\_image\_size() function can be used to create custom image sizes in the theme. And most older themes I've seen still using i...
24,851
<p>Is there a way to use wp_enqueue_script() for inline scripts? </p> <p>I'm doing this because my inline script depends on another script and i would like the flexibility of inserting it after it's loaded.</p> <p>Also, It's an inline script because i'm passing php variables into the javascript (like theme path, etc)...
[ { "answer_id": 24863, "author": "scribu", "author_id": 205, "author_profile": "https://wordpress.stackexchange.com/users/205", "pm_score": 6, "selected": true, "text": "<p>Well, you have wp_localize_script(), but that's only for passing data.</p>\n\n<p>Otherwise, you can do this:</p>\n\n...
2011/08/03
[ "https://wordpress.stackexchange.com/questions/24851", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5149/" ]
Is there a way to use wp\_enqueue\_script() for inline scripts? I'm doing this because my inline script depends on another script and i would like the flexibility of inserting it after it's loaded. Also, It's an inline script because i'm passing php variables into the javascript (like theme path, etc) Thanks in adv...
Well, you have wp\_localize\_script(), but that's only for passing data. Otherwise, you can do this: ``` function print_my_inline_script() { if ( wp_script_is( 'some-script-handle', 'done' ) ) { ?> <script type="text/javascript"> // js code goes here </script> <?php } } add_action( 'wp_footer', 'print_my_inline_s...
24,865
<p>I'm using the following snippet to add a menu item:</p> <pre><code>&lt;?php add_menu_page( 'Foo Server', 'Foo Server', 'manage_options', 'foo-server', array('Class', 'method') ); ?&gt; </code></pre> <p>Fine, it's displayed. But clicking on it returns:</p> <pre><code>You do not have sufficient ...
[ { "answer_id": 24873, "author": "Jeremy Jared", "author_id": 5339, "author_profile": "https://wordpress.stackexchange.com/users/5339", "pm_score": 0, "selected": false, "text": "<p>Do your WordPress Database Tables use wp_ as a prefix? I've read several articles that using a different pr...
2011/08/03
[ "https://wordpress.stackexchange.com/questions/24865", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7600/" ]
I'm using the following snippet to add a menu item: ``` <?php add_menu_page( 'Foo Server', 'Foo Server', 'manage_options', 'foo-server', array('Class', 'method') ); ?> ``` Fine, it's displayed. But clicking on it returns: ``` You do not have sufficient permissions to access this page. ``` I re...
Hook into `'admin_menu'` to register menu pages. And next time [prepare your question](https://wordpress.stackexchange.com/questions/how-to-ask) better.
24,885
<p>I have a tricky situation.... I'd like to check for a cookie. If it doesn't exist then then redirect to an internal wordpress page, and set a cookie. And then carry on browsing the site. But i get stuck in a loop if the url doesn't exist. This is what i have so far...any help would be great.</p> <pre><code>functio...
[ { "answer_id": 24904, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>why not use the <code>init</code> action hook:</p>\n\n<pre><code>function has_my_cookie()\n{\n if (!is_admi...
2011/08/04
[ "https://wordpress.stackexchange.com/questions/24885", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3081/" ]
I have a tricky situation.... I'd like to check for a cookie. If it doesn't exist then then redirect to an internal wordpress page, and set a cookie. And then carry on browsing the site. But i get stuck in a loop if the url doesn't exist. This is what i have so far...any help would be great. ``` function cookiebasedre...
why not use the `init` action hook: ``` function has_my_cookie() { if (!is_admin()){ //Check to see if our cookie is set if not redirect to your desired page and set the cookie if ( !isset($_COOKIE["sevisitor"])) { //setcookie setcookie('sevisitor', 1, time()+1209600, "/", "...
24,891
<p>Is there a way to show a 404 page if the current logged in user does not have the right clearance to view the page? I am looking for a PHP method, something like</p> <pre><code>if( !current_user_can('administrator') ) { show_404(); exit(); } </code></pre> <p>I have thought about using a redirect, but I would like ...
[ { "answer_id": 24892, "author": "Anh Tran", "author_id": 2051, "author_profile": "https://wordpress.stackexchange.com/users/2051", "pm_score": 2, "selected": false, "text": "<p>Why don't you create a page that show error message and then redirect user to that page? Here is a simple way t...
2011/08/04
[ "https://wordpress.stackexchange.com/questions/24891", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1878/" ]
Is there a way to show a 404 page if the current logged in user does not have the right clearance to view the page? I am looking for a PHP method, something like ``` if( !current_user_can('administrator') ) { show_404(); exit(); } ``` I have thought about using a redirect, but I would like to keep the url the same.
I was able to display a 404 error by using the following code in my header. ``` <?php global $wp_query; $wp_query->set_404(); status_header( 404 ); get_template_part( 404 ); exit(); ?> ``` To break it down: `$wp_query->set_404()`: tells the wp\_query this is a 404, this changes the title `status_header...
24,902
<p>I'm using <a href="http://wordpress.org/extend/plugins/simple-local-avatars/" rel="nofollow">Simple Local Avatars</a> for uploading custom user avatars.</p> <p>How can I create a frontend page with the avatar upload function?</p> <p>Below please find the code from Simple Local Avatars plugin:</p> <pre><code> &...
[ { "answer_id": 24905, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": false, "text": "<p>add </p>\n\n<pre><code>do_action('show_user_profile');\ndo_action('edit_user_profile');\n</code></pre>\n\n<p>...
2011/08/04
[ "https://wordpress.stackexchange.com/questions/24902", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7616/" ]
I'm using [Simple Local Avatars](http://wordpress.org/extend/plugins/simple-local-avatars/) for uploading custom user avatars. How can I create a frontend page with the avatar upload function? Below please find the code from Simple Local Avatars plugin: ``` <?php /** * add field to user profiles */...
Sergey, use this in place where you are going to put form to edit avatar: ``` <?php $myAv = new simple_local_avatars(); $myAv->edit_user_profile($profileuser); ?> ```
24,908
<p>is it possible to sign in with <strong>user_email</strong> instead of <strong>user_login</strong>, please ?</p> <p>Thanks.</p>
[ { "answer_id": 24911, "author": "Scott", "author_id": 4610, "author_profile": "https://wordpress.stackexchange.com/users/4610", "pm_score": 2, "selected": false, "text": "<p>Search and you will find... <a href=\"http://wordpress.org/extend/plugins/wp-email-login/\" rel=\"nofollow\">WP Em...
2011/08/04
[ "https://wordpress.stackexchange.com/questions/24908", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2000/" ]
is it possible to sign in with **user\_email** instead of **user\_login**, please ? Thanks.
Here's how we do it: ``` $user = get_user_by('email', $email); if (wp_check_password($password, $user->user_pass, $user->ID)) { // Login successfull, redirect if needed wp_set_auth_cookie($user->ID); } ``` Assuming of course that you got the $email and the $password variables from a POST request or something...
24,924
<p>I need to change the template on several hundred pages on my site. Does anyone know if there is a command to do it programmatically? See the following code snippet; I'd like to replace my comment inside the loop with a function that will change the template of the current page:</p> <pre><code>query = new WP_Query($...
[ { "answer_id": 24927, "author": "Sisir", "author_id": 3094, "author_profile": "https://wordpress.stackexchange.com/users/3094", "pm_score": 0, "selected": false, "text": "<p>What kinds of formatting are you referring to? If you want to change the formatting that can be changed by css. Yo...
2011/08/04
[ "https://wordpress.stackexchange.com/questions/24924", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7629/" ]
I need to change the template on several hundred pages on my site. Does anyone know if there is a command to do it programmatically? See the following code snippet; I'd like to replace my comment inside the loop with a function that will change the template of the current page: ``` query = new WP_Query($args); while (...
I take it that you mean saving the pages with a new post-template to the DB? see if there's anything in the post object that refers to the page-template, if so craft a query that updates that. Update: ======= > > Taken from the [wp\_insert\_post](https://codex.wordpress.org/Function_Reference/wp_insert_post) documen...
24,929
<p>having problems with filtering a posts attachments by tag... It worked fine until i added the tag__in arg (and other variations of it).</p> <pre><code>$vidArgs = array( 'tag__in' =&gt;5, 'post_type' =&gt; 'attachment', 'post_parent'...
[ { "answer_id": 24927, "author": "Sisir", "author_id": 3094, "author_profile": "https://wordpress.stackexchange.com/users/3094", "pm_score": 0, "selected": false, "text": "<p>What kinds of formatting are you referring to? If you want to change the formatting that can be changed by css. Yo...
2011/08/04
[ "https://wordpress.stackexchange.com/questions/24929", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3978/" ]
having problems with filtering a posts attachments by tag... It worked fine until i added the tag\_\_in arg (and other variations of it). ``` $vidArgs = array( 'tag__in' =>5, 'post_type' => 'attachment', 'post_parent' => $post->ID, ...
I take it that you mean saving the pages with a new post-template to the DB? see if there's anything in the post object that refers to the page-template, if so craft a query that updates that. Update: ======= > > Taken from the [wp\_insert\_post](https://codex.wordpress.org/Function_Reference/wp_insert_post) documen...
24,935
<p>If I run this code then I no longer get the toolbar but I still get a word count and visual/html tabs and when I save the post my content gets wrapped in &lt;\p> tags.</p> <pre><code>jQuery(document).ready(function() { jQuery('#content').removeClass('theEditor').addClass('mceNoEditor'); tinyMCE.init({ ...
[ { "answer_id": 24927, "author": "Sisir", "author_id": 3094, "author_profile": "https://wordpress.stackexchange.com/users/3094", "pm_score": 0, "selected": false, "text": "<p>What kinds of formatting are you referring to? If you want to change the formatting that can be changed by css. Yo...
2011/08/04
[ "https://wordpress.stackexchange.com/questions/24935", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7635/" ]
If I run this code then I no longer get the toolbar but I still get a word count and visual/html tabs and when I save the post my content gets wrapped in <\p> tags. ``` jQuery(document).ready(function() { jQuery('#content').removeClass('theEditor').addClass('mceNoEditor'); tinyMCE.init({ mode: "none", ...
I take it that you mean saving the pages with a new post-template to the DB? see if there's anything in the post object that refers to the page-template, if so craft a query that updates that. Update: ======= > > Taken from the [wp\_insert\_post](https://codex.wordpress.org/Function_Reference/wp_insert_post) documen...
24,939
<p>Since the Ipad doesn't work nicely with issuu I'm trying to set up a system where if users would acces one of my blog post from an ipad device they get redirected to the a pdf file which is on my server.</p> <p>For this I'm guessing I would have to include some kind of HTML code at the beginning of each post. Howev...
[ { "answer_id": 24949, "author": "Not Available", "author_id": 2074, "author_profile": "https://wordpress.stackexchange.com/users/2074", "pm_score": 1, "selected": false, "text": "<p>A quick Google shows up with <a href=\"http://scottrockers.com/blog/resources/simple-code-tricks/how-to-de...
2011/08/04
[ "https://wordpress.stackexchange.com/questions/24939", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7638/" ]
Since the Ipad doesn't work nicely with issuu I'm trying to set up a system where if users would acces one of my blog post from an ipad device they get redirected to the a pdf file which is on my server. For this I'm guessing I would have to include some kind of HTML code at the beginning of each post. However I'm not...
A quick Google shows up with [this](http://scottrockers.com/blog/resources/simple-code-tricks/how-to-detect-ipad-and-redirect-to-ipad-version-website) There's 2 ways you can do this: 1. Detect the user agent with JavaScript and redirect 2. Detect the user agent server-side and redirect With JavaScript you'd modify t...
24,974
<p>For some reason All in One Seo is not putting the text that I put in the Home Description field</p> <p>if you google, dvdripfreemoviedownloads.com, the first result, which is my homepage should have something else under the Home Description? Anyone know how I can fix this will All in One SEO</p> <p>If anything I'd...
[ { "answer_id": 25317, "author": "Matt", "author_id": 6843, "author_profile": "https://wordpress.stackexchange.com/users/6843", "pm_score": 1, "selected": false, "text": "<p>Is this all you need? You're header is already using this function for the meta-desc, but maybe you're homepage is...
2011/08/04
[ "https://wordpress.stackexchange.com/questions/24974", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6133/" ]
For some reason All in One Seo is not putting the text that I put in the Home Description field if you google, dvdripfreemoviedownloads.com, the first result, which is my homepage should have something else under the Home Description? Anyone know how I can fix this will All in One SEO If anything I'd like to imput th...
Is this all you need? You're header is already using this function for the meta-desc, but maybe you're homepage is different than your blog main archive. ``` <?php if (is_front_page()) { ?> <meta name="description" content="I'll take swords for 200." /> <?php } ?> ``` Use `is_home()` for the blog main archive.
24,987
<p>Is there any equivalent to functions like <code>plugins_url()</code> and <code>content_url()</code> that give you either the relative paths or the file path.</p> <p>For instance, instead of </p> <blockquote> <p><a href="http://localhost:8888/wordpress-3.2/wp-content" rel="nofollow">http://localhost:8888/wordpres...
[ { "answer_id": 24992, "author": "scribu", "author_id": 205, "author_profile": "https://wordpress.stackexchange.com/users/205", "pm_score": 2, "selected": true, "text": "<p>There aren't any for plugins, but you can (and should) use WP_CONTENT_DIR, instead of ABSPATH.</p>\n\n<p>For themes ...
2011/08/04
[ "https://wordpress.stackexchange.com/questions/24987", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4850/" ]
Is there any equivalent to functions like `plugins_url()` and `content_url()` that give you either the relative paths or the file path. For instance, instead of > > <http://localhost:8888/wordpress-3.2/wp-content> > > > I want: > > /Users/username/Sites/wordpress-3.2/wp-content > > > I know that I can bui...
There aren't any for plugins, but you can (and should) use WP\_CONTENT\_DIR, instead of ABSPATH. For themes you have locate\_template().
25,006
<p>I'm trying to enable the WordPress content editor as a droppable using jQuery UI drag and drop. However, I can't get the drag to drop, or the drop event to fire.</p> <p>Is there something I'm missing?</p> <pre><code>&lt;ul id="keywords"&gt; &lt;li&gt;drag one&lt;/li&gt; &lt;li&gt;drag two&lt;/li&gt; &l...
[ { "answer_id": 24992, "author": "scribu", "author_id": 205, "author_profile": "https://wordpress.stackexchange.com/users/205", "pm_score": 2, "selected": true, "text": "<p>There aren't any for plugins, but you can (and should) use WP_CONTENT_DIR, instead of ABSPATH.</p>\n\n<p>For themes ...
2011/08/04
[ "https://wordpress.stackexchange.com/questions/25006", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
I'm trying to enable the WordPress content editor as a droppable using jQuery UI drag and drop. However, I can't get the drag to drop, or the drop event to fire. Is there something I'm missing? ``` <ul id="keywords"> <li>drag one</li> <li>drag two</li> <li>drag three</li> </ul> jQuery("#keywords").find("...
There aren't any for plugins, but you can (and should) use WP\_CONTENT\_DIR, instead of ABSPATH. For themes you have locate\_template().
25,014
<p>i'm hosting several sites. they all have the same base theme that i need to install. I want to develop this theme and have them updated on all the sites simultaneously. </p> <p>I have the following folder structure</p> <pre><code>/theme/ \ mytheme /domain/ \ foo.com \ foobar.com \ foosite.com </code><...
[ { "answer_id": 25016, "author": "GavinR", "author_id": 2001, "author_profile": "https://wordpress.stackexchange.com/users/2001", "pm_score": 3, "selected": true, "text": "<p>That will work fine - just make sure they all have read and write access to that shared folder. The symlink comman...
2011/08/04
[ "https://wordpress.stackexchange.com/questions/25014", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5149/" ]
i'm hosting several sites. they all have the same base theme that i need to install. I want to develop this theme and have them updated on all the sites simultaneously. I have the following folder structure ``` /theme/ \ mytheme /domain/ \ foo.com \ foobar.com \ foosite.com ``` Would there be any issu...
That will work fine - just make sure they all have read and write access to that shared folder. The symlink command should be: ``` ln -s ``` StackOverflow question: [Can two different WordPress blogs on the same server use a common theme folder?](https://stackoverflow.com/questions/997007/can-two-different-wordpress...
25,015
<p>We have tons of rewrite rules saved in our wp_options table and I'd like to permanently remove any entries that we're not using on our site (such as comment feeds, page attachments, etc.).</p> <p>What's the best way to clear these rules and prevent them from being saved to the database the next time flush_rules() i...
[ { "answer_id": 67529, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>Rather than modifying stored rules it would be more reliable to modify rules before they are stored.</p>\n\n<ul>\n<l...
2011/08/04
[ "https://wordpress.stackexchange.com/questions/25015", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7650/" ]
We have tons of rewrite rules saved in our wp\_options table and I'd like to permanently remove any entries that we're not using on our site (such as comment feeds, page attachments, etc.). What's the best way to clear these rules and prevent them from being saved to the database the next time flush\_rules() is called...
Rather than modifying stored rules it would be more reliable to modify rules before they are stored. * [`flush_rewrite_rules()`](http://queryposts.com/function/flush_rewrite_rules/) calls * `WP_Rewrite->flush_rules()` * `WP_Rewrite->wp_rewrite_rules()` * `WP_Rewrite->rewrite_rules()` Inside last there are fitting hoo...
25,020
<p>I'm trying to make a table of users by role type. What is the best-practices method of getting the user id? My goal is to print each users first &amp; last names, username and email.</p> <p>What I have now:</p> <pre><code>$get_admins = array( 'blog_id' =&gt; $GLOBALS['blog_id'], 'role' =&gt; 'administrator...
[ { "answer_id": 25023, "author": "scribu", "author_id": 205, "author_profile": "https://wordpress.stackexchange.com/users/205", "pm_score": 3, "selected": true, "text": "<p>Your code doesn't work because you're using <code>$bloguser</code> instead of <code>$user</code>.</p>\n\n<p>And ther...
2011/08/04
[ "https://wordpress.stackexchange.com/questions/25020", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1057/" ]
I'm trying to make a table of users by role type. What is the best-practices method of getting the user id? My goal is to print each users first & last names, username and email. What I have now: ``` $get_admins = array( 'blog_id' => $GLOBALS['blog_id'], 'role' => 'administrator', ); $blogusers = get_users($...
Your code doesn't work because you're using `$bloguser` instead of `$user`. And there's no point in calling get\_userdata() since get\_users() already returns user objects: ``` foreach ($blogusers as $user) { echo '<tr>'; echo '<td>'. $user->first_name .'</td>'; echo '<td>'. $user->last_name .'</t...
25,030
<p>Here I want to have upon activation of my wordpress plugins activation</p> <p>Before Activation</p> <pre><code>Activate | Edit | Delete </code></pre> <p>After Activation</p> <pre><code>Settings | Edit | Delete </code></pre> <p>How can this be done in code to add this Menu </p>
[ { "answer_id": 54075, "author": "brasofilo", "author_id": 12615, "author_profile": "https://wordpress.stackexchange.com/users/12615", "pm_score": 2, "selected": false, "text": "<p>Code extracted from my plugin, adapt as necessary.</p>\n\n<pre><code>add_filter( 'plugin_action_links', 'wps...
2011/08/05
[ "https://wordpress.stackexchange.com/questions/25030", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/420/" ]
Here I want to have upon activation of my wordpress plugins activation Before Activation ``` Activate | Edit | Delete ``` After Activation ``` Settings | Edit | Delete ``` How can this be done in code to add this Menu
Code extracted from my plugin, adapt as necessary. ``` add_filter( 'plugin_action_links', 'wpse_25030_settings_plugin_link', 10, 2 ); function wpse_25030_settings_plugin_link( $links, $file ) { if ( $file == plugin_basename(dirname(__FILE__) . '/many-tips-together.php') ) { /* * Insert the ...
25,031
<p>On my website <a href="http://filmblurb.org" rel="nofollow">http://filmblurb.org</a>, all the posts and everything on my home page are missing. Can you anybody tell me how to fix this?</p> <p>Thanks! (If it helps, I'm using Wordpress 3.2.1.)</p>
[ { "answer_id": 54075, "author": "brasofilo", "author_id": 12615, "author_profile": "https://wordpress.stackexchange.com/users/12615", "pm_score": 2, "selected": false, "text": "<p>Code extracted from my plugin, adapt as necessary.</p>\n\n<pre><code>add_filter( 'plugin_action_links', 'wps...
2011/08/05
[ "https://wordpress.stackexchange.com/questions/25031", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/7655/" ]
On my website <http://filmblurb.org>, all the posts and everything on my home page are missing. Can you anybody tell me how to fix this? Thanks! (If it helps, I'm using Wordpress 3.2.1.)
Code extracted from my plugin, adapt as necessary. ``` add_filter( 'plugin_action_links', 'wpse_25030_settings_plugin_link', 10, 2 ); function wpse_25030_settings_plugin_link( $links, $file ) { if ( $file == plugin_basename(dirname(__FILE__) . '/many-tips-together.php') ) { /* * Insert the ...
25,043
<p>I want to allow commas in tag names? For example, <code>"hello, world"</code> or <code>"portland, or"</code> but Wordpress keeps separating them. I can do it from the categories page:</p> <p><a href="http://img839.imageshack.us/img839/6869/picturepp.png" rel="noreferrer">image http://img839.imageshack.us/img839/686...
[ { "answer_id": 25117, "author": "Tara", "author_id": 5021, "author_profile": "https://wordpress.stackexchange.com/users/5021", "pm_score": 0, "selected": false, "text": "<p>you mau use a filter.</p>\n\n<p>For example, if you want to Add a comma after each tag in a tag cloud, you can put ...
2011/08/05
[ "https://wordpress.stackexchange.com/questions/25043", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4400/" ]
I want to allow commas in tag names? For example, `"hello, world"` or `"portland, or"` but Wordpress keeps separating them. I can do it from the categories page: [image http://img839.imageshack.us/img839/6869/picturepp.png](http://img839.imageshack.us/img839/6869/picturepp.png) And it shows up fine. But anything adde...
No core hacking needed -- thanks to: HOOKS. Hooks allow to fix the issue with a nice combination of * a filter replacing "--" by ", " before output * and an "if" block to make sure the output is not also filtered for the admin interface :) * and finally, saving all your tags with comma in the format "Fox--Peter" ins...