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
14,851
<p>In PHP 5.2, filter_var() sanitizes text. In WP, esc_html() sanitizes text. The former works with a high-bit character in the text string, e.g. &#224; , but the latter doesn't. esc_html seems to be totally eating a string containing a high-bit character. Here's the example, written as a simple WP plugin:</p> <pr...
[ { "answer_id": 14852, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 2, "selected": false, "text": "<p>Perhaps because the entity is a non-UTF8 character?</p>\n\n<p>Here's what <code>esc_html()</code> does:</p>...
2011/04/15
[ "https://wordpress.stackexchange.com/questions/14851", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3202/" ]
In PHP 5.2, filter\_var() sanitizes text. In WP, esc\_html() sanitizes text. The former works with a high-bit character in the text string, e.g. à , but the latter doesn't. esc\_html seems to be totally eating a string containing a high-bit character. Here's the example, written as a simple WP plugin: ``` <?php /* Plu...
Perhaps because the entity is a non-UTF8 character? Here's what `esc_html()` does: ``` function esc_html( $text ) { $safe_text = wp_check_invalid_utf8( $text ); $safe_text = _wp_specialchars( $safe_text, ENT_QUOTES ); return apply_filters( 'esc_html', $safe_text, $text ); } ``` If not that, then i...
14,854
<p>I really hope I've got a simple issue in front of me here, as it's sort of driving me up a wall. </p> <p>Short story: submitting a simple form on the front end of the site results in a <code>302 Found</code> redirect, totally stripping the <code>$_POST</code> data in the process.</p> <p>Scenario:</p> <ul> <li>Cre...
[ { "answer_id": 14852, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 2, "selected": false, "text": "<p>Perhaps because the entity is a non-UTF8 character?</p>\n\n<p>Here's what <code>esc_html()</code> does:</p>...
2011/04/15
[ "https://wordpress.stackexchange.com/questions/14854", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4207/" ]
I really hope I've got a simple issue in front of me here, as it's sort of driving me up a wall. Short story: submitting a simple form on the front end of the site results in a `302 Found` redirect, totally stripping the `$_POST` data in the process. Scenario: * Create a page in the admin called **Edit** * Create a...
Perhaps because the entity is a non-UTF8 character? Here's what `esc_html()` does: ``` function esc_html( $text ) { $safe_text = wp_check_invalid_utf8( $text ); $safe_text = _wp_specialchars( $safe_text, ENT_QUOTES ); return apply_filters( 'esc_html', $safe_text, $text ); } ``` If not that, then i...
14,862
<p>Refer to: <a href="http://blog.studentlife.uiowa.edu/svp/categories/" rel="nofollow">http://blog.studentlife.uiowa.edu/svp/categories/</a></p> <p>I just used a blank category template. What can I add to/change the code to make it so that it doesn't put in the category page like it's a post? I only want it to list t...
[ { "answer_id": 14869, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 0, "selected": false, "text": "<p>That \"Posted On\" bit is part of the <code>/inc/meta.php</code> template file, that is being included in <...
2011/04/15
[ "https://wordpress.stackexchange.com/questions/14862", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4274/" ]
Refer to: <http://blog.studentlife.uiowa.edu/svp/categories/> I just used a blank category template. What can I add to/change the code to make it so that it doesn't put in the category page like it's a post? I only want it to list the categories than cut to the footer/sidebar.
Open the archive.php file of the Blank theme and delete this code from the top. ``` <?php /* If this is a category archive */ if (is_category()) { ?> <h2>Archive for the &#8216;<?php single_cat_title(); ?>&#8217; Category</h2> <?php /* If this is a tag archive */ } elseif( is_tag() ) {...
14,863
<p>I have just upgraded my wordpress installation from 3.1 to 3.1.1 and my custom structure permalinks are now broken, </p> <p>The permalinks were set to follow this procedure, </p> <blockquote> <p>/%category%/%postname%</p> </blockquote> <p>however now they are just falling back to </p> <blockquote> <p>?page_...
[ { "answer_id": 14864, "author": "Rikesh", "author_id": 7341, "author_profile": "https://wordpress.stackexchange.com/users/7341", "pm_score": 0, "selected": false, "text": "<p>I think your .htaccess is no more getting updated from admin.</p>\n\n<blockquote>\n <p>So try to update url re-w...
2011/04/15
[ "https://wordpress.stackexchange.com/questions/14863", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I have just upgraded my wordpress installation from 3.1 to 3.1.1 and my custom structure permalinks are now broken, The permalinks were set to follow this procedure, > > /%category%/%postname% > > > however now they are just falling back to > > ?page\_id=30 > > > How can I fix this what has changed in 3...
Here are some steps for you a) Access you site through ftp and remove .htaccess file (possibly backup it) b) Go to admin of your site (wordpress admin) and open permalink settings form c) set the first option to custom and put the value in text box ``` /%category%/%postname% ``` d) save changes and check you fr...
14,881
<p>I have a site that has a few custom post types. When a customer searches it shows a combination of all the different posts. I'd like to segment the two on the same page resulting in something that looks like the example below. Any help would be appreciated.</p> <blockquote> <p><strong>Showing results for: really coo...
[ { "answer_id": 14888, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 4, "selected": true, "text": "<p>You can group posts by type using <code>posts_groupby</code> filter hook: </p>\n\n<pre><code>add_filter('posts...
2011/04/15
[ "https://wordpress.stackexchange.com/questions/14881", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3296/" ]
I have a site that has a few custom post types. When a customer searches it shows a combination of all the different posts. I'd like to segment the two on the same page resulting in something that looks like the example below. Any help would be appreciated. > > **Showing results for: really cool search** > > **Vid...
You can group posts by type using `posts_groupby` filter hook: ``` add_filter('posts_groupby', 'group_by_post_type' ); function group_by_post_type( $groupby ) { global $wpdb; if( !is_search() ) { return $groupby; } $mygroupby = "{$wpdb->posts}.post_type"; if( !strlen(trim($groupby))) { // groupby wa...
14,882
<p>I badly need to create an .XML file inside my theme every time user comes to my site.</p> <p>But I can't.</p> <p>This code in header:</p> <pre><code> &lt;?php $ourFileName = "testFile.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); ?&gt; </...
[ { "answer_id": 14888, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 4, "selected": true, "text": "<p>You can group posts by type using <code>posts_groupby</code> filter hook: </p>\n\n<pre><code>add_filter('posts...
2011/04/15
[ "https://wordpress.stackexchange.com/questions/14882", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1869/" ]
I badly need to create an .XML file inside my theme every time user comes to my site. But I can't. This code in header: ``` <?php $ourFileName = "testFile.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); ?> ``` Just does nothing. It doesn't ...
You can group posts by type using `posts_groupby` filter hook: ``` add_filter('posts_groupby', 'group_by_post_type' ); function group_by_post_type( $groupby ) { global $wpdb; if( !is_search() ) { return $groupby; } $mygroupby = "{$wpdb->posts}.post_type"; if( !strlen(trim($groupby))) { // groupby wa...
14,893
<p>I am using the <a href="http://wordpress.site5.net/boldy/doc/" rel="nofollow noreferrer">Boldy theme</a> from Site5 on a <a href="http://www.dekho.com.au" rel="nofollow noreferrer">v3.1.2 site</a>.</p> <p>The way this theme works, is that there is a portfolio, (which I am using as a <a href="http://www.dekho.com.au...
[ { "answer_id": 14894, "author": "Wyck", "author_id": 1509, "author_profile": "https://wordpress.stackexchange.com/users/1509", "pm_score": 2, "selected": false, "text": "<p>It's difficult to tell since you supplied no code but removing a category from your blog loop is typically very eas...
2011/04/16
[ "https://wordpress.stackexchange.com/questions/14893", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4280/" ]
I am using the [Boldy theme](http://wordpress.site5.net/boldy/doc/) from Site5 on a [v3.1.2 site](http://www.dekho.com.au). The way this theme works, is that there is a portfolio, (which I am using as a [case studies gallery](http://www.dekho.com.au/category/case-studies/)) that pulls in posts from a specific category...
You want the category 98 to be excluded only on the blog page, right? They should be accessible on the category page directly (your downloads page), correct? Can you try this? Let me know if its not what you want, we can modify it to suit your needs. Right not it only excludes the category on where you show your blog ...
14,924
<p>Theres a way to convert links like:</p> <p><a href="http://www.localhost.lh/?attachment_id=41" rel="nofollow">http://www.localhost.lh/?attachment_id=41</a></p> <p>into:</p> <p><a href="http://www.localhost.lh/attachment/id" rel="nofollow">http://www.localhost.lh/attachment/id</a></p> <p>or:</p> <p><a href="http...
[ { "answer_id": 14926, "author": "Ray Mitchell", "author_id": 2709, "author_profile": "https://wordpress.stackexchange.com/users/2709", "pm_score": 0, "selected": false, "text": "<p>José Pablo</p>\n\n<p>In addition to changing the <a href=\"http://codex.wordpress.org/Using_Permalinks\" re...
2011/04/16
[ "https://wordpress.stackexchange.com/questions/14924", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2011/" ]
Theres a way to convert links like: <http://www.localhost.lh/?attachment_id=41> into: <http://www.localhost.lh/attachment/id> or: <http://www.localhost.lh/author/attachment/id>
here a simple WordPress rewrite rule to get the job done: ``` add_action('generate_rewrite_rules', 'attachment_rewrite_rule_14924'); function attachment_rewrite_rule_14924($wp_rewrite){ $new_rules = array(); $new_rules['attachment/(\d*)$'] = 'index.php?attachment_id=$matches[1]'; $wp_rewrite->rules = $new_rules...
14,933
<p>I wanted to override the wordpress default search with my custom search, however when i put the following code in the plugin file it doesn't appear replace the default searchbox(no error, nothing) and when i put the code in functions.php it works fine and replaces the default searchbox.</p> <p>Can anyone tell me wh...
[ { "answer_id": 14938, "author": "t31os", "author_id": 31073, "author_profile": "https://wordpress.stackexchange.com/users/31073", "pm_score": 0, "selected": false, "text": "<p>If the code you've posted is literally all the code you're placing into the file, that'll be why.</p>\n\n<p>Firs...
2011/04/17
[ "https://wordpress.stackexchange.com/questions/14933", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4728/" ]
I wanted to override the wordpress default search with my custom search, however when i put the following code in the plugin file it doesn't appear replace the default searchbox(no error, nothing) and when i put the code in functions.php it works fine and replaces the default searchbox. Can anyone tell me why is it no...
I cleaned up your code, and put all the header information for installing it. Your plugin works fine, I tested it! ``` /* Author: whoever Plugin Name: Some Name Plugin URI: Text Domain: some-domain Version: 1.0 */ function DynamiteSearch($form) { $form = "<form method = 'get' id = 'searchform' action = ' ".site...
14,934
<p>I'd like to make a client area in WordPress from my freelance design business. I'm capable of making it myself but I was wondering if there are any good tutorials and plugins that other people are already using. A Basecamp style project management system would be the ideal.</p>
[ { "answer_id": 33927, "author": "Tom J Nowell", "author_id": 736, "author_profile": "https://wordpress.stackexchange.com/users/736", "pm_score": 1, "selected": false, "text": "<p>You can use custom page templates with <a href=\"http://codex.wordpress.org/Function_Reference/is_user_logged...
2011/04/17
[ "https://wordpress.stackexchange.com/questions/14934", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1925/" ]
I'd like to make a client area in WordPress from my freelance design business. I'm capable of making it myself but I was wondering if there are any good tutorials and plugins that other people are already using. A Basecamp style project management system would be the ideal.
First, for invoicing/billing use the WP Invoice plugin: <http://wordpress.org/extend/plugins/wp-invoice/> The "members" plugin may also be useful: <http://wordpress.org/extend/plugins/members/> For a custom redirect, to send them to custom pages rather than just the admin panel use: <http://wordpress.org/extend/plugi...
14,964
<p>What action or filter do I have to check or compare against $pagenow?</p> <p>In the admin area, I need to let non admin and editor users only to access:</p> <pre><code>index.php (dashboard) upload.php (attachments management) media.php (attachments management) media-new.php (attachments management) </code></pre> ...
[ { "answer_id": 14969, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>that depends on if you want to redirect users away the you should use <code>init</code> hook since no output o...
2011/04/18
[ "https://wordpress.stackexchange.com/questions/14964", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2011/" ]
What action or filter do I have to check or compare against $pagenow? In the admin area, I need to let non admin and editor users only to access: ``` index.php (dashboard) upload.php (attachments management) media.php (attachments management) media-new.php (attachments management) ``` Thanks in advance.
that depends on if you want to redirect users away the you should use `init` hook since no output or headers are sent before that hook. or if you want to display a nice "You Don't have the right permissions to access this page" message then you can use the `wp_head` action hook: ``` //display meassage add_action('admi...
14,974
<p>I added a custom button to the TinyMCE editor, and I want to open WP's Thickbox when I click on it. </p> <p>How can I make it so that the <code>tb_show()</code> function loads the content I want with ajax?</p> <pre><code>// the ajax add_action('wp_ajax_getTheContent', 'getTheContent'); function getTheContent(){ ...
[ { "answer_id": 15004, "author": "t31os", "author_id": 31073, "author_profile": "https://wordpress.stackexchange.com/users/31073", "pm_score": 4, "selected": true, "text": "<p>The second parameter for <code>tb_show</code> is the URL, so you'll want to use something like..</p>\n\n<pre><cod...
2011/04/18
[ "https://wordpress.stackexchange.com/questions/14974", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1986/" ]
I added a custom button to the TinyMCE editor, and I want to open WP's Thickbox when I click on it. How can I make it so that the `tb_show()` function loads the content I want with ajax? ``` // the ajax add_action('wp_ajax_getTheContent', 'getTheContent'); function getTheContent(){ echo 'weqwtegeqgr'; // <- this s...
The second parameter for `tb_show` is the URL, so you'll want to use something like.. ``` <?php $ajax_url = add_query_arg( array( 'action' => 'getTheContent', 'query_var1' => 'value1', 'query_var2' => 'value2' ), admin_url( 'admin-ajax.php' ) ); ?> tb_show(tag, '<?php echo ...
14,988
<p>I am having a problem where my markup is rendered incorrectly (more space because of <code>&lt;br /&gt;</code>) as WordPress adds <code>&lt;br /&gt;</code> everywhere theres a line break</p> <p>eg. </p> <pre><code>[x] [y]Hello world[/y] [y]A test[/y] [/x] </code></pre> <p>In the handler for <code>x</code> the...
[ { "answer_id": 16055, "author": "bueltge", "author_id": 170, "author_profile": "https://wordpress.stackexchange.com/users/170", "pm_score": 2, "selected": true, "text": "<p>before you register your shortcode, add the filter to the content for unautop:</p>\n\n<pre><code>add_filter( 'the_c...
2011/04/18
[ "https://wordpress.stackexchange.com/questions/14988", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3788/" ]
I am having a problem where my markup is rendered incorrectly (more space because of `<br />`) as WordPress adds `<br />` everywhere theres a line break eg. ``` [x] [y]Hello world[/y] [y]A test[/y] [/x] ``` In the handler for `x` the `$content` looks like ``` <br /> [y]Hello world[/y] <br /> [y]A test[/y] <br...
before you register your shortcode, add the filter to the content for unautop: ``` add_filter( 'the_content', 'shortcode_unautop' ); ``` Do this also for the areas, maybe excerpt or widget, when your shortcode add to this areas.
14,995
<p>What i'm trying to achieve is bringing a loop from one WP site into another WP Site. </p> <p>I used this method to get the loop into an external php file (which all works fine, the results show)</p> <pre><code>&lt;?php define('WP_USE_THEMES', false); require('path_on_server/wp-blog-header.php'); query_posts('showp...
[ { "answer_id": 14994, "author": "Scott", "author_id": 4610, "author_profile": "https://wordpress.stackexchange.com/users/4610", "pm_score": 0, "selected": false, "text": "<p>Make sure you have added the comment block to your <code>page-portfolio.php</code> to tell its a template.</p>\n\n...
2011/04/18
[ "https://wordpress.stackexchange.com/questions/14995", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1778/" ]
What i'm trying to achieve is bringing a loop from one WP site into another WP Site. I used this method to get the loop into an external php file (which all works fine, the results show) ``` <?php define('WP_USE_THEMES', false); require('path_on_server/wp-blog-header.php'); query_posts('showposts=5'); ?> <?php if (...
An archive of a custom post type is displayed using `archive-[posttype].php` or `archive.php` if the first does not exist (see [the Template Hierarchy](http://codex.wordpress.org/Template_Hierarchy) for the full details). `page-[posttype].php` is only used if you create a "dummy" page to show a custom post type archive...
14,999
<p>I am trying to reload the fresh posts using jQuery. As far as I know, I can't reload the contents of a div inside the page so I reload a file into that div.</p> <p>The problem is that my loaded file gives me a <strong>Fatal error: Call to undefined function wp_query()</strong></p> <p>How can I implement functions ...
[ { "answer_id": 14994, "author": "Scott", "author_id": 4610, "author_profile": "https://wordpress.stackexchange.com/users/4610", "pm_score": 0, "selected": false, "text": "<p>Make sure you have added the comment block to your <code>page-portfolio.php</code> to tell its a template.</p>\n\n...
2011/04/18
[ "https://wordpress.stackexchange.com/questions/14999", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4448/" ]
I am trying to reload the fresh posts using jQuery. As far as I know, I can't reload the contents of a div inside the page so I reload a file into that div. The problem is that my loaded file gives me a **Fatal error: Call to undefined function wp\_query()** How can I implement functions to a newly created file insid...
An archive of a custom post type is displayed using `archive-[posttype].php` or `archive.php` if the first does not exist (see [the Template Hierarchy](http://codex.wordpress.org/Template_Hierarchy) for the full details). `page-[posttype].php` is only used if you create a "dummy" page to show a custom post type archive...
15,009
<p>I'm using <a href="http://wordpress.org/extend/plugins/nurelm-get-posts/" rel="nofollow">Get Posts</a> plugin to list posts with post type "project". I want to filter the list by two custom fields: year (ex. 2006) and state (ex. Completed). I added <code>meta_query</code> to the plugin's <code>get_post</code> args a...
[ { "answer_id": 15010, "author": "t31os", "author_id": 31073, "author_profile": "https://wordpress.stackexchange.com/users/31073", "pm_score": 1, "selected": false, "text": "<p>I don't think the plugin been updated to support the new query args, or specifically in this case, the <code>met...
2011/04/18
[ "https://wordpress.stackexchange.com/questions/15009", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2816/" ]
I'm using [Get Posts](http://wordpress.org/extend/plugins/nurelm-get-posts/) plugin to list posts with post type "project". I want to filter the list by two custom fields: year (ex. 2006) and state (ex. Completed). I added `meta_query` to the plugin's `get_post` args and tried the shortcode: ``` [get_posts post_type="...
Besides the plugin not being updated, this will not work because the meta\_query arg is evaluated as a string: ``` array(3) { ["post_type"] => string(7) "project" ["meta_query"] => string(96) "array(array('key' => 'state', 'value' => 'Completed'),array('key' => 'year','value' => '2006'))" ["suppress_filters"] =...
15,013
<p>I'm creating a media upload section in my metabox. One of the things I want to be able to do is to rename the filename of the media that is uploaded to the same as the post title. so for example, say now I uploaded a picture called, pic001.jpg to the post: "Test Post", in the process of the upload, I want to automat...
[ { "answer_id": 15020, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 0, "selected": false, "text": "<p>You need to either paste this code in your theme's functions.php file or create a plugin and paste it there.<...
2011/04/18
[ "https://wordpress.stackexchange.com/questions/15013", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4340/" ]
I'm creating a media upload section in my metabox. One of the things I want to be able to do is to rename the filename of the media that is uploaded to the same as the post title. so for example, say now I uploaded a picture called, pic001.jpg to the post: "Test Post", in the process of the upload, I want to automatica...
apologies for my stupidity - The question can be answered here - and I swapped post\_id for title and it works. <http://wordpress.org/support/topic/using-wps-thickbox-in-a-plugin>
15,021
<p>I would like to set a post to Draft automatically based on a custom field date.</p> <p>Note: <strong><a href="http://magicfields.org/" rel="nofollow">I am using the plugin Magic Fields.</a></strong></p> <p>Based on the following code I want to use a custom field 'expiration' to give the date.</p> <pre><code>funct...
[ { "answer_id": 15026, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 1, "selected": false, "text": "<p>For cron jobs, take a look at the <a href=\"http://codex.wordpress.org/Transients_API\" rel=\"nofollow\">Transients...
2011/04/18
[ "https://wordpress.stackexchange.com/questions/15021", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4755/" ]
I would like to set a post to Draft automatically based on a custom field date. Note: **[I am using the plugin Magic Fields.](http://magicfields.org/)** Based on the following code I want to use a custom field 'expiration' to give the date. ``` function sfn_show_expire() { global $wpdb; $server_time = date...
For cron jobs, take a look at the [Transients API](http://codex.wordpress.org/Transients_API). The rest could maybe be acchieved with something *like* the following. I have never ever used the transient API before and code's not tested. ``` function set_post_to_draft() { global $post; if ( get_post_meta( $p...
15,024
<p>I have different widget areas. One is a horizontal area that may contain eg. 4 widgets next to each other. My Question is how would i add a different eg. <code>$param['widget_title']</code> to widget number <code>$n</code> (via a filter)?</p> <p>I already tried using <code>wp_registered_widgets();</code> function a...
[ { "answer_id": 15026, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 1, "selected": false, "text": "<p>For cron jobs, take a look at the <a href=\"http://codex.wordpress.org/Transients_API\" rel=\"nofollow\">Transients...
2011/04/18
[ "https://wordpress.stackexchange.com/questions/15024", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/385/" ]
I have different widget areas. One is a horizontal area that may contain eg. 4 widgets next to each other. My Question is how would i add a different eg. `$param['widget_title']` to widget number `$n` (via a filter)? I already tried using `wp_registered_widgets();` function and te different globals, but with no result...
For cron jobs, take a look at the [Transients API](http://codex.wordpress.org/Transients_API). The rest could maybe be acchieved with something *like* the following. I have never ever used the transient API before and code's not tested. ``` function set_post_to_draft() { global $post; if ( get_post_meta( $p...
15,041
<p>I am trying to write a function that will allow me to specify a post ID and a blog ID, and then have it return the permalink and title of the blog post.</p> <p>I need this to be efficient because the function will be used in a foreach loop that could cause the function to run upwards of 50 times.</p> <p>Any ideas?...
[ { "answer_id": 42719, "author": "Sterling Hamilton", "author_id": 10075, "author_profile": "https://wordpress.stackexchange.com/users/10075", "pm_score": 1, "selected": false, "text": "<p>That sounds pretty simple.</p>\n\n<p>Use: <a href=\"http://codex.wordpress.org/Function_Reference/sw...
2011/04/18
[ "https://wordpress.stackexchange.com/questions/15041", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2418/" ]
I am trying to write a function that will allow me to specify a post ID and a blog ID, and then have it return the permalink and title of the blog post. I need this to be efficient because the function will be used in a foreach loop that could cause the function to run upwards of 50 times. Any ideas?
That sounds pretty simple. Use: <http://codex.wordpress.org/Function_Reference/switch_to_blog> To go back use: ``` restore_current_blog(); ``` This allows you to switch from site to site. Then: <http://codex.wordpress.org/Function_Reference/get_permalink> My assumptions are that you have both the Blog ID and the...
15,044
<p>Hey Guys, I'm trying to build a right aligned, wrapping capable wp_nav_menu powered menu.</p> <p>Is there a way to have it rendered backwards, so that float: right; would work and not mess up the order?</p> <p>I was hoping for something like this:</p> <pre><code>&lt;?php wp_nav_menu( array('sort_order' =&gt; 'DES...
[ { "answer_id": 15048, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 0, "selected": false, "text": "<p>You could write a custom walker for your <code>wp_nav_menu()</code> call. Short of that, I don't think ther...
2011/04/18
[ "https://wordpress.stackexchange.com/questions/15044", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4562/" ]
Hey Guys, I'm trying to build a right aligned, wrapping capable wp\_nav\_menu powered menu. Is there a way to have it rendered backwards, so that float: right; would work and not mess up the order? I was hoping for something like this: ``` <?php wp_nav_menu( array('sort_order' => 'DESC' )); ?> ``` Thanks!
I just found this handy little function that ads the ability to reverse the menu output order. it might come in handy: ``` /** * Enables a 'reverse' option for wp_nav_menu to reverse the order of menu * items. Usage: * * wp_nav_menu(array('reverse' => TRUE, ...)); */ function my_reverse_nav_menu($menu, $args) { if (is...
15,046
<p>I'm trying to create a plugin that alters the Add New Post page so the Visibility field says "Private" by default:</p> <pre><code>Status: Draft Visibility: **Private** Publish immediately [Publish] </code></pre> <p>...as opposed to what WordPress normally assumes:</p> <pre><code>Status: Draft Visibility: **Publi...
[ { "answer_id": 15059, "author": "cr0z3r", "author_id": 4513, "author_profile": "https://wordpress.stackexchange.com/users/4513", "pm_score": -1, "selected": true, "text": "<p>since you're developing a plug-in, I assume you don't want to touch any files outside of wp-content/plugins or .....
2011/04/18
[ "https://wordpress.stackexchange.com/questions/15046", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2399/" ]
I'm trying to create a plugin that alters the Add New Post page so the Visibility field says "Private" by default: ``` Status: Draft Visibility: **Private** Publish immediately [Publish] ``` ...as opposed to what WordPress normally assumes: ``` Status: Draft Visibility: **Public** Publish immediately [Publish] `...
since you're developing a plug-in, I assume you don't want to touch any files outside of wp-content/plugins or ../themes for that matter. However, if that's not the case, follow along: Go to wp-admin/includes/meta-boxes.php and find: ``` $visibility = 'public'; $visibility_trans = __('Public'); ``` Now change it...
15,053
<p>My site requires the use of https for all img src HTML. </p> <p>This is the WordPress function I'm using to display images:</p> <pre><code>&lt;img src="'.get_bloginfo("template_url").'/images/thumb-default.gif" /&gt; </code></pre> <p>This outputs an http img src - how can I convert that to https? </p>
[ { "answer_id": 15057, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<p>Had you checked this when requesting page via <code>http</code> or <code>https</code> link? What does <a href=\"http...
2011/04/18
[ "https://wordpress.stackexchange.com/questions/15053", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3711/" ]
My site requires the use of https for all img src HTML. This is the WordPress function I'm using to display images: ``` <img src="'.get_bloginfo("template_url").'/images/thumb-default.gif" /> ``` This outputs an http img src - how can I convert that to https?
WordPress checks the return value of `is_ssl()` before creating URLs using `get_bloginfo()`. If the function returns true, it creates https URLs. If it returns false, it creates http URLs. From the WordPress source ... ``` function is_ssl() { if ( isset($_SERVER['HTTPS']) ) { if ( 'on' == strtolower($_SER...
15,066
<p>I've isolated the source of a fatal error that's been occurring when a brand new site is previewed just after installing and activating the plugin I'm working on.</p> <p>The problem appears to be that the "category_children" item in the options table is not being created.</p> <p>Interestingly, it appears that two ...
[ { "answer_id": 15136, "author": "scribu", "author_id": 205, "author_profile": "https://wordpress.stackexchange.com/users/205", "pm_score": 3, "selected": true, "text": "<p>This is a known (and nasty) bug in the taxonomy hierarchy caching code:</p>\n\n<p><a href=\"http://core.trac.wordpre...
2011/04/18
[ "https://wordpress.stackexchange.com/questions/15066", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
I've isolated the source of a fatal error that's been occurring when a brand new site is previewed just after installing and activating the plugin I'm working on. The problem appears to be that the "category\_children" item in the options table is not being created. Interestingly, it appears that two actions trigger ...
This is a known (and nasty) bug in the taxonomy hierarchy caching code: <http://core.trac.wordpress.org/ticket/14485> Basically, you have to force a refresh by deleting the option.
15,078
<p>I've got page with metabox called "something". It can have two values "value" and "value2".</p> <p>I'm using a shortcode at this page and want it to display something's value. The problem is I don't know how to access global variable in a shortcode?</p> <p>Example, I have this in page.php:</p> <pre><code>if($some...
[ { "answer_id": 15080, "author": "Drew Gourley", "author_id": 4282, "author_profile": "https://wordpress.stackexchange.com/users/4282", "pm_score": 1, "selected": false, "text": "<p>Unless you're firing those echos from within a function through page.php, functions wont get anything from ...
2011/04/18
[ "https://wordpress.stackexchange.com/questions/15078", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1869/" ]
I've got page with metabox called "something". It can have two values "value" and "value2". I'm using a shortcode at this page and want it to display something's value. The problem is I don't know how to access global variable in a shortcode? Example, I have this in page.php: ``` if($something == "value") { ...
Meta data is save in postmeta table and to get them you can use `get_post_meta($post_id,'meta_key_name',true);` so in your shortcode function globilaize $post object and get you value like that ``` if($something == "value") { global $post; $one = get_post_meta($post->ID,'value_name'true); $two = ge...
15,085
<p>How would I bulk change posting date? I want to change about 20 post publish dates at a time in one click</p>
[ { "answer_id": 15080, "author": "Drew Gourley", "author_id": 4282, "author_profile": "https://wordpress.stackexchange.com/users/4282", "pm_score": 1, "selected": false, "text": "<p>Unless you're firing those echos from within a function through page.php, functions wont get anything from ...
2011/04/18
[ "https://wordpress.stackexchange.com/questions/15085", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4088/" ]
How would I bulk change posting date? I want to change about 20 post publish dates at a time in one click
Meta data is save in postmeta table and to get them you can use `get_post_meta($post_id,'meta_key_name',true);` so in your shortcode function globilaize $post object and get you value like that ``` if($something == "value") { global $post; $one = get_post_meta($post->ID,'value_name'true); $two = ge...
15,108
<p>I created some posts using a custom post type, then I decided to delete this custom post type but of course the old posts remained orphan inside the database.</p> <p>How can I remove these orphan posts and all related attachment (post meta, etc.) safely from DB?</p>
[ { "answer_id": 15110, "author": "Scott", "author_id": 4610, "author_profile": "https://wordpress.stackexchange.com/users/4610", "pm_score": 0, "selected": false, "text": "<p>You need to use a few SQL queries, you can run them in something like PHPMyADMIN</p>\n\n<pre><code>DELETE FROM wp_...
2011/04/19
[ "https://wordpress.stackexchange.com/questions/15108", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/36/" ]
I created some posts using a custom post type, then I decided to delete this custom post type but of course the old posts remained orphan inside the database. How can I remove these orphan posts and all related attachment (post meta, etc.) safely from DB?
``` DELETE a,b,c FROM wp_posts a LEFT JOIN wp_term_relationships b ON (a.ID=b.object_id) LEFT JOIN wp_postmeta c ON (a.ID=c.post_id) WHERE a.post_type='customposttype' ```
15,140
<p>Does anyone have a favorite widget for the sidebar that would show the last three posts with: </p> <p>Title Some of the content... read more</p>
[ { "answer_id": 15494, "author": "Grimosos", "author_id": 4854, "author_profile": "https://wordpress.stackexchange.com/users/4854", "pm_score": 1, "selected": false, "text": "<p>You can create a widget (<a href=\"http://codex.wordpress.org/Widgets_API#Developing_Widgets\" rel=\"nofollow\"...
2011/04/19
[ "https://wordpress.stackexchange.com/questions/15140", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4418/" ]
Does anyone have a favorite widget for the sidebar that would show the last three posts with: Title Some of the content... read more
You can create a widget ([Create a Widget](http://codex.wordpress.org/Widgets_API#Developing_Widgets)) like this: ``` <?php /* Plugin Name: WDG Plugin URI: Description: Plugin Version: 0.1 Author URI: */ add_action( 'widgets_init', 'my_wdg' ); function my_wdg() { register_widget( 'Wdg' ); } class Wdg extends WP_...
15,143
<p>My plugin code is below. In the myPlugin_cleanup() function, I'm creating some categories and assigning term id 1 as the parent. </p> <p>Due to the <a href="https://wordpress.stackexchange.com/questions/15066/missing-category-children-option-when-dynamically-creating-categories-via-a-plu"><strong>known bug with cre...
[ { "answer_id": 15160, "author": "Scott B", "author_id": 366, "author_profile": "https://wordpress.stackexchange.com/users/366", "pm_score": 3, "selected": true, "text": "<p>After creating about 40 test WP installs today on localhost, here's what I can report:</p>\n\n<p>It appears that th...
2011/04/19
[ "https://wordpress.stackexchange.com/questions/15143", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
My plugin code is below. In the myPlugin\_cleanup() function, I'm creating some categories and assigning term id 1 as the parent. Due to the [**known bug with creating categories via script**](https://wordpress.stackexchange.com/questions/15066/missing-category-children-option-when-dynamically-creating-categories-via...
After creating about 40 test WP installs today on localhost, here's what I can report: It appears that the correct function call to rebuild the category\_children options is: ``` _get_term_hierarchy('category') ``` Previously, I was trying to call: ``` clean_term_cache('','category') ``` And I was calling it jus...
15,145
<p>I have a site where pages will often move from draft to published and then to legacy. I would like to create another status type similar to draft or published titled "legacy". Wherein the page exists but is indicated as no longer active on the site. </p> <p>Is anyone aware of a Plugin or way to hack this feature?</...
[ { "answer_id": 15160, "author": "Scott B", "author_id": 366, "author_profile": "https://wordpress.stackexchange.com/users/366", "pm_score": 3, "selected": true, "text": "<p>After creating about 40 test WP installs today on localhost, here's what I can report:</p>\n\n<p>It appears that th...
2011/04/19
[ "https://wordpress.stackexchange.com/questions/15145", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3296/" ]
I have a site where pages will often move from draft to published and then to legacy. I would like to create another status type similar to draft or published titled "legacy". Wherein the page exists but is indicated as no longer active on the site. Is anyone aware of a Plugin or way to hack this feature?
After creating about 40 test WP installs today on localhost, here's what I can report: It appears that the correct function call to rebuild the category\_children options is: ``` _get_term_hierarchy('category') ``` Previously, I was trying to call: ``` clean_term_cache('','category') ``` And I was calling it jus...
15,163
<p>I have a gallery attached to a page. On that page, I'm running the following query:</p> <pre><code>$events_gallery = new WP_Query( // Start a new query for our videos array( 'post_parent' =&gt; $post-&gt;ID, // Get data from the current post 'post_type' =&gt; 'attachment', // Only bring back attachments ...
[ { "answer_id": 15165, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 0, "selected": false, "text": "<p>Looking at the query it generates, it does appear to be a bug of sorts. 'status' => 'inherit' is interpreted as the...
2011/04/19
[ "https://wordpress.stackexchange.com/questions/15163", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1766/" ]
I have a gallery attached to a page. On that page, I'm running the following query: ``` $events_gallery = new WP_Query( // Start a new query for our videos array( 'post_parent' => $post->ID, // Get data from the current post 'post_type' => 'attachment', // Only bring back attachments 'post_mime_type' => 'i...
These are the query parameters i use...works for me when i loop through the results ``` array( 'post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type'=> 'attachment', 'post_mime_type' => 'image/jpeg,image/gif,image/jpg,image/png' ); ``` For more detail, please see offici...
15,172
<p>Is there a native function to check if a theme a template file. For instance, if a theme is not using the 'home.php' file, then execute some code...</p>
[ { "answer_id": 15178, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 3, "selected": false, "text": "<p>Any reason <code>locate_template()</code> (<a href=\"http://codex.wordpress.org/Function_Reference/locate_t...
2011/04/20
[ "https://wordpress.stackexchange.com/questions/15172", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3081/" ]
Is there a native function to check if a theme a template file. For instance, if a theme is not using the 'home.php' file, then execute some code...
So I would add to the Answer the following: ``` function foo_function() { $located = locate_template( 'home.php' ); if ( !empty( $located ) ) { // 'home.php' found in Theme, do something } } add_action('init', 'foo_function'); // remember to change both of the parameters above, first one for wh...
15,176
<p>I am including a particular PHP file as a style sheet using</p> <pre><code>&lt;link href="&lt;? echo THEME_CSS;?&gt;/styles.php" media="screen" rel="stylesheet" type="text/css"&gt; </code></pre> <p>Recently I reached the point where I needed to use TEMPLATEPATH and various built-in WordPress functions. Alas I am g...
[ { "answer_id": 15177, "author": "Drew Gourley", "author_id": 4282, "author_profile": "https://wordpress.stackexchange.com/users/4282", "pm_score": 1, "selected": false, "text": "<p>You may consider using some alternative functions to return the path you are looking for instead, for examp...
2011/04/20
[ "https://wordpress.stackexchange.com/questions/15176", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4776/" ]
I am including a particular PHP file as a style sheet using ``` <link href="<? echo THEME_CSS;?>/styles.php" media="screen" rel="stylesheet" type="text/css"> ``` Recently I reached the point where I needed to use TEMPLATEPATH and various built-in WordPress functions. Alas I am getting > > "Warning: require\_once(...
If you're linking to a file, it's opened as a new file. So unless you explicitly include wp\_load.php or something within that styles file, WordPress is not available. Loading WP all over again in one page load seems like complete overkill to me. Why don't you just include your style file as an inline stylesheet, if y...
15,179
<p>I'm getting ready to submit a theme to the .Org repo and wanted to make sure that everything is in ordnung. One of the biggest holes left in my design is the comments template.</p> <p>I've taken a look at comments.php in a few themes, Twenty Ten chief among them and have come away more confused than when I started....
[ { "answer_id": 15180, "author": "GavinR", "author_id": 2001, "author_profile": "https://wordpress.stackexchange.com/users/2001", "pm_score": 0, "selected": false, "text": "<p>Use <a href=\"http://wordpress.org/extend/plugins/disqus-comment-system/\" rel=\"nofollow\">Disqus</a></p>\n" }...
2011/04/20
[ "https://wordpress.stackexchange.com/questions/15179", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/61/" ]
I'm getting ready to submit a theme to the .Org repo and wanted to make sure that everything is in ordnung. One of the biggest holes left in my design is the comments template. I've taken a look at comments.php in a few themes, Twenty Ten chief among them and have come away more confused than when I started. It seems ...
You really don’t need much. A headline with id=comments --------------------------- ``` <h2 id="comments"><?php comments_number(); ?></h2> ``` This will be the target for [`comments_link()`](http://codex.wordpress.org/Function_Reference/comments_link) in the article loop. Links for paginated comments. ------------...
15,188
<p>Is there a ready plugin or solution for implementing Featured Image function to Categories and Links? </p> <p>At Pages and Posts I use the feature image as a background image, using the full size original image, and I'd like to achieve the same, meaning I'd like to have featured full size image for categories.</p> ...
[ { "answer_id": 15180, "author": "GavinR", "author_id": 2001, "author_profile": "https://wordpress.stackexchange.com/users/2001", "pm_score": 0, "selected": false, "text": "<p>Use <a href=\"http://wordpress.org/extend/plugins/disqus-comment-system/\" rel=\"nofollow\">Disqus</a></p>\n" }...
2011/04/20
[ "https://wordpress.stackexchange.com/questions/15188", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4209/" ]
Is there a ready plugin or solution for implementing Featured Image function to Categories and Links? At Pages and Posts I use the feature image as a background image, using the full size original image, and I'd like to achieve the same, meaning I'd like to have featured full size image for categories. With Links, I...
You really don’t need much. A headline with id=comments --------------------------- ``` <h2 id="comments"><?php comments_number(); ?></h2> ``` This will be the target for [`comments_link()`](http://codex.wordpress.org/Function_Reference/comments_link) in the article loop. Links for paginated comments. ------------...
15,193
<p>I'm having trouble reading RSS feeds created by WP3 on the same domain. </p> <p>When I do a print_r($rss); at the part of my plugin where it does the RSS parsing, I get the following output:</p> <pre><code>WP_Error Object ( [errors] =&gt; Array ( [simplepie-error] =&gt; Array ( [0] =&gt; WP HTTP Error: couldn't co...
[ { "answer_id": 15907, "author": "aendra", "author_id": 1682, "author_profile": "https://wordpress.stackexchange.com/users/1682", "pm_score": 3, "selected": true, "text": "<p>Anyone with a similar issue:</p>\n\n<p>First off, try the following after connecting to your webhost via SSH:</p>\...
2011/04/20
[ "https://wordpress.stackexchange.com/questions/15193", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1682/" ]
I'm having trouble reading RSS feeds created by WP3 on the same domain. When I do a print\_r($rss); at the part of my plugin where it does the RSS parsing, I get the following output: ``` WP_Error Object ( [errors] => Array ( [simplepie-error] => Array ( [0] => WP HTTP Error: couldn't connect to host ) ) [error_data...
Anyone with a similar issue: First off, try the following after connecting to your webhost via SSH: `ping <yourwebsite>` If you get a "cannot connect to host" issue, there's a firewall or NAT problem blocking traffic for RSS. Contact your server admin.
15,207
<p>Question is simple. Can i get the title and main url of the site from where the posts are loading? Actually i want to linked to the main site. </p> <p>The url can be found by wordpress function esc_url(); function but what about site title?</p> <p>The page is here: </p> <p><a href="http://citystir.com/author/desi...
[ { "answer_id": 15214, "author": "anu", "author_id": 490, "author_profile": "https://wordpress.stackexchange.com/users/490", "pm_score": 2, "selected": true, "text": "<pre><code>$feed = fetch_feed($feedurl);\n$channel = $feed-&gt;channel;\n$blog_title = $channel[\"title\"];\n</code></pre>...
2011/04/20
[ "https://wordpress.stackexchange.com/questions/15207", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3094/" ]
Question is simple. Can i get the title and main url of the site from where the posts are loading? Actually i want to linked to the main site. The url can be found by wordpress function esc\_url(); function but what about site title? The page is here: <http://citystir.com/author/designdons/> Thanks!
``` $feed = fetch_feed($feedurl); $channel = $feed->channel; $blog_title = $channel["title"]; ``` Note - I haven't tested this, am relying on my (faulty) memory.
15,209
<p>I have migrated my blog from blogspot to WordPress. Then I have noticed many of the posts contain duplicate custom fields. Like blogger_author, blogger_permalink, blogger_blog are duplicated upto 5 times. How can I remove the duplicate Custom Fields?</p>
[ { "answer_id": 15809, "author": "windyjonas", "author_id": 221, "author_profile": "https://wordpress.stackexchange.com/users/221", "pm_score": 4, "selected": true, "text": "<p>You can delete directly from the database, using an SQL statement like:</p>\n\n<pre><code>delete from wp_postmet...
2011/04/20
[ "https://wordpress.stackexchange.com/questions/15209", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4789/" ]
I have migrated my blog from blogspot to WordPress. Then I have noticed many of the posts contain duplicate custom fields. Like blogger\_author, blogger\_permalink, blogger\_blog are duplicated upto 5 times. How can I remove the duplicate Custom Fields?
You can delete directly from the database, using an SQL statement like: ``` delete from wp_postmeta where meta_id in ( select * from ( select meta_id from wp_postmeta a where a.meta_key = 'blogger_blog' and meta_id not in ( ...
15,218
<p>I like to hardcode everything on my WordPress websites, without using any plugins. Is there any way to generate or update my sitemap everytime I publish/update a post on one of my Multisite blogs, without using plugins?</p>
[ { "answer_id": 36856, "author": "w3uiguru", "author_id": 8982, "author_profile": "https://wordpress.stackexchange.com/users/8982", "pm_score": 1, "selected": false, "text": "<p>I don't know whether this works on multisite, but it is working perfect in a single WordPress installation for ...
2011/04/20
[ "https://wordpress.stackexchange.com/questions/15218", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3195/" ]
I like to hardcode everything on my WordPress websites, without using any plugins. Is there any way to generate or update my sitemap everytime I publish/update a post on one of my Multisite blogs, without using plugins?
The following code works right off the bat. Your sitemap will show up on: <https://your-website-name.com/sitemap.xml> Every time you create or update a page, post or custom post type it will show. Make sure to add the name of your custom post type: ``` add_action( 'publish_post', 'ow_create_sitemap' ); add_action( '...
15,234
<p>I have this query that shows the categories that a user had posted in. For example if I have 3 cats, name NEWS, MEDIA, PUBLICATIONS and the author had only posted in the first two, it will show</p> <p>NEWS</p> <p>MEDIA</p> <p>Is there any better code than this or an improvement because my db is really huge and it...
[ { "answer_id": 15267, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<p>I am no huge expert on SQL side, but this seems like resource-intensive operation however you approach it.</p>\n\n<p...
2011/04/20
[ "https://wordpress.stackexchange.com/questions/15234", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4448/" ]
I have this query that shows the categories that a user had posted in. For example if I have 3 cats, name NEWS, MEDIA, PUBLICATIONS and the author had only posted in the first two, it will show NEWS MEDIA Is there any better code than this or an improvement because my db is really huge and it gives me throttling? Th...
Your SQL isn't limiting the term matching to categories only. You're also getting back tags and any other taxonomy. So the data coming back may be more than expected. Taxonomy is a key in the term\_taxonomy table, so it should be fast to eliminate the ones you don't need. ``` SELECT DISTINCT(terms.term_id) as ID, t...
15,236
<p>I'm having hard time trying to use teasers post in my wordpress theme (based on 960gs), as you can see here <a href="http://img17.imageshack.us/img17/794/schermata20110420a15045.png" rel="nofollow">http://img17.imageshack.us/img17/794/schermata20110420a15045.png</a> what I got till now is one "featured" post and thr...
[ { "answer_id": 15238, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 0, "selected": false, "text": "<p>add a counter variable before the loop, $counter = 1;, before the end of the loop, increment the counter, $counter+...
2011/04/20
[ "https://wordpress.stackexchange.com/questions/15236", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I'm having hard time trying to use teasers post in my wordpress theme (based on 960gs), as you can see here <http://img17.imageshack.us/img17/794/schermata20110420a15045.png> what I got till now is one "featured" post and three teasers post with thumbnails that will probably be six (so it'll have seven posts displaied ...
Even better way is to check the [current post position in query](http://codex.wordpress.org/Function_Reference/WP_Query#Properties): ``` global $wp_query; while (have_posts()) : the_post(); $my_class = ''; if ( $wp_query->current_post == 0 ) $my_class = ' first'; if ( $wp_query->current_post == $wp_query-...
15,237
<p>So the reason why I am don't want to include <code>get_header()</code> or <code>get_footer()</code> tags is because this page will be loaded as an iframe using the thickbox modal plugin and its content will be a form and I don't want the aforementioned tags to render all the menus and banner images and menus as well...
[ { "answer_id": 15271, "author": "Chad Von Lind", "author_id": 4680, "author_profile": "https://wordpress.stackexchange.com/users/4680", "pm_score": 0, "selected": false, "text": "<p>Have you considered using a Conditional Tag?</p>\n\n<p>For example:</p>\n\n<pre><code>&lt;?php if(is_page(...
2011/04/20
[ "https://wordpress.stackexchange.com/questions/15237", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2123/" ]
So the reason why I am don't want to include `get_header()` or `get_footer()` tags is because this page will be loaded as an iframe using the thickbox modal plugin and its content will be a form and I don't want the aforementioned tags to render all the menus and banner images and menus as well as the footer content be...
Completely skipping `wp_head` and `wp_footer` doesn't seem like a good idea, many core components and plugins depend on these hooks. Instead, you could create a *light* header and footer, and load them via an extra argument to [`get_header()`](http://codex.wordpress.org/Function_Reference/get_header) and [`get_footer()...
15,244
<p>I have been playing around with media queries quite a bit lately and I love the concept. It is so easy to display images or change div floats depending upon what the users screen max-width is.</p> <p>I'm trying to find a way of displaying a custom sidebar on my template Only if the users screen size is large enough...
[ { "answer_id": 15250, "author": "Wyck", "author_id": 1509, "author_profile": "https://wordpress.stackexchange.com/users/1509", "pm_score": 1, "selected": false, "text": "<p>This is no way around this that I know of, it is one of the problems of media query's and CSS. I often see whole si...
2011/04/20
[ "https://wordpress.stackexchange.com/questions/15244", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/370/" ]
I have been playing around with media queries quite a bit lately and I love the concept. It is so easy to display images or change div floats depending upon what the users screen max-width is. I'm trying to find a way of displaying a custom sidebar on my template Only if the users screen size is large enough to permit...
On my website I load the recent comments per AJAX for window sizes above 480px: ``` if ( 480 < jQuery(window).width() ) { jQuery(document).ready( function() { jQuery.get('http://toscho.de/?rc', function(data) { jQuery(data).insertBefo...
15,264
<p>It is possible to restrict the upload process to choose only one file. Now a person can select various files from pc, Im trying to find a way to restrict this feature just to one file.</p> <p>Thanks in advance.</p>
[ { "answer_id": 15268, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 2, "selected": true, "text": "<p>WordPress contains 2 media up-loaders. The Flash uploader allows the selection of multiple files while the browser...
2011/04/20
[ "https://wordpress.stackexchange.com/questions/15264", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2011/" ]
It is possible to restrict the upload process to choose only one file. Now a person can select various files from pc, Im trying to find a way to restrict this feature just to one file. Thanks in advance.
WordPress contains 2 media up-loaders. The Flash uploader allows the selection of multiple files while the browser uploader only allows 1 file at a time. To disable the Flash uploader add the following filter to functions.php ``` add_filter('flash_uploader', create_function('$flash', 'return false;')); ``` ### EDIT...
15,277
<p>I'm using -<a href="http://www.farinspace.com/how-to-create-custom-wordpress-meta-box/" rel="nofollow">this tutorial</a>- to add simple meta boxes to a custom post type. But the textarea meta boxes are spitting out content all as one big paragraph, with no <code>&lt;p&gt;</code> formatting applied.</p> <p>What code...
[ { "answer_id": 15281, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 3, "selected": true, "text": "<p>Add a function that grabs your meta data, applies wpautop and echoes it out, or otherwise run it through when you ou...
2011/04/20
[ "https://wordpress.stackexchange.com/questions/15277", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4680/" ]
I'm using -[this tutorial](http://www.farinspace.com/how-to-create-custom-wordpress-meta-box/)- to add simple meta boxes to a custom post type. But the textarea meta boxes are spitting out content all as one big paragraph, with no `<p>` formatting applied. What code would add the -[wpautop filter](http://codex.wordpre...
Add a function that grabs your meta data, applies wpautop and echoes it out, or otherwise run it through when you output it in your template. ``` $my_meta = get_post_meta($post->ID,'_my_meta',TRUE); echo $my_meta['name']; echo wpautop( $my_meta['description'], 1 ); ```
15,286
<p>Im using the following code to get an array of children taxonomies and write them out with links in an unordered list.</p> <pre><code> &lt;?php $termID = 10; $taxonomyName = "products"; $termchildren = get_term_children( $termID, $taxonomyName ); echo '&lt;ul&gt;'; foreach ($termchildren as $child) { $term ...
[ { "answer_id": 15287, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": false, "text": "<p>To get the Current term you can use <code>get_query_var( 'term' );</code> and to get the current taxonomy you...
2011/04/21
[ "https://wordpress.stackexchange.com/questions/15286", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4804/" ]
Im using the following code to get an array of children taxonomies and write them out with links in an unordered list. ``` <?php $termID = 10; $taxonomyName = "products"; $termchildren = get_term_children( $termID, $taxonomyName ); echo '<ul>'; foreach ($termchildren as $child) { $term = get_term_by( 'id', $c...
Here is a function I use to list subterms: ``` /** * Lists all subentries of a taxonomy. * * @return void */ function ttt_get_subterms( $args = array () ) { if ( ! isset ( get_queried_object()->taxonomy ) ) { return; } $options = array ( 'child_of' => get_queried_object_i...
15,295
<p>I have some 100 unpublished posts. I want to publish 1 random post every time a cron is run.</p> <p>Is there a way or plugin to achieve this...</p>
[ { "answer_id": 15287, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": false, "text": "<p>To get the Current term you can use <code>get_query_var( 'term' );</code> and to get the current taxonomy you...
2011/04/21
[ "https://wordpress.stackexchange.com/questions/15295", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I have some 100 unpublished posts. I want to publish 1 random post every time a cron is run. Is there a way or plugin to achieve this...
Here is a function I use to list subterms: ``` /** * Lists all subentries of a taxonomy. * * @return void */ function ttt_get_subterms( $args = array () ) { if ( ! isset ( get_queried_object()->taxonomy ) ) { return; } $options = array ( 'child_of' => get_queried_object_i...
15,304
<p>After a new user registration, WP sends out an email with the login / password, and a link to the login page.</p> <p>Is there a way to change this defaut email template? I'd also like to change the subject and sender.</p> <p>Edit : For anyone interested, <a href="http://wordpress.org/extend/plugins/welcome-email-e...
[ { "answer_id": 15316, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 7, "selected": true, "text": "<p>The new user email is sent using the <code>wp_new_user_notification()</code> function. This function is plugga...
2011/04/21
[ "https://wordpress.stackexchange.com/questions/15304", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1381/" ]
After a new user registration, WP sends out an email with the login / password, and a link to the login page. Is there a way to change this defaut email template? I'd also like to change the subject and sender. Edit : For anyone interested, [here](http://wordpress.org/extend/plugins/welcome-email-editor/) is a plugin...
The new user email is sent using the `wp_new_user_notification()` function. This function is pluggable, which means that you can overwrite it: ``` // Redefine user notification function if ( !function_exists('wp_new_user_notification') ) { function wp_new_user_notification( $user_id, $plaintext_pass = '' ) { ...
15,310
<p>I'm using the mingle plugin and the mingle-forum plugin.</p> <p>I want to show a certain part on my site only if those two plugins are active. How can I solve this?</p> <pre><code>&lt;?php if ( is_plugin_active('mingle-forum') ) { ?&gt; &lt;div id="login"&gt;&lt;?php include (TEMPLATEPATH . '/i...
[ { "answer_id": 15314, "author": "anu", "author_id": 490, "author_profile": "https://wordpress.stackexchange.com/users/490", "pm_score": 4, "selected": true, "text": "<p>This function exists in <code>wp-admin/includes/plugin.php</code> so I'm assuming it doesn't get included by the theme....
2011/04/21
[ "https://wordpress.stackexchange.com/questions/15310", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3529/" ]
I'm using the mingle plugin and the mingle-forum plugin. I want to show a certain part on my site only if those two plugins are active. How can I solve this? ``` <?php if ( is_plugin_active('mingle-forum') ) { ?> <div id="login"><?php include (TEMPLATEPATH . '/inc/userlogin.php' ); ?></div> ...
This function exists in `wp-admin/includes/plugin.php` so I'm assuming it doesn't get included by the theme. You can either `require` it, or just create your own version of it - see here: <http://wordpress.org/support/topic/is_plugin_active> UPDATED: Please check [`is_plugin_active`](https://developer.wordpress.org/...
15,321
<p>I have a custom post type that I'm just using just to keep data in but I sometimes share it with others, and I don't want any confusion when the "view" link appears in the admin column. </p> <p>Is there a way of removing that? </p> <p><a href="http://img.skitch.com/20110421-des28mtj4br3aeyfxnypnkghsy.jpg" rel="nor...
[ { "answer_id": 15325, "author": "Cristian", "author_id": 2264, "author_profile": "https://wordpress.stackexchange.com/users/2264", "pm_score": 6, "selected": true, "text": "<pre><code>add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );\n\nfunction remove_row_actions( $actions ...
2011/04/21
[ "https://wordpress.stackexchange.com/questions/15321", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4640/" ]
I have a custom post type that I'm just using just to keep data in but I sometimes share it with others, and I don't want any confusion when the "view" link appears in the admin column. Is there a way of removing that? [http://img.skitch.com/20110421-des28mtj4br3aeyfxnypnkghsy.jpg http://img.skitch.com/20110421-des...
``` add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 ); function remove_row_actions( $actions ) { if( get_post_type() === 'my_cpt' ) unset( $actions['view'] ); return $actions; } ``` Should see you through :) The $actions array consists of the following: ``` $actions['edit'] $actions['...
15,332
<p>I am trying to get scripts via <code>wp_enqueue_script();</code>. I have tried this in header but WordPress is not importing any script.</p> <p>I am using like this <code>wp_enqueue_script('jquery');</code></p> <p><a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script" rel="nofollow">http://codex...
[ { "answer_id": 15334, "author": "Mild Fuzz", "author_id": 784, "author_profile": "https://wordpress.stackexchange.com/users/784", "pm_score": 2, "selected": false, "text": "<p>If you have copy/pasted your code, then you have a typo.</p>\n\n<pre><code> wp_enqueue_script('jquery');\n</code...
2011/04/21
[ "https://wordpress.stackexchange.com/questions/15332", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3094/" ]
I am trying to get scripts via `wp_enqueue_script();`. I have tried this in header but WordPress is not importing any script. I am using like this `wp_enqueue_script('jquery');` <http://codex.wordpress.org/Function_Reference/wp_enqueue_script> Is any other step needed for importing script via WordPress?
In simple case you need to enqueue script before header scripts are printed, which happens in `wp_head` hook. Basic approach would be this in `functions.php` of your theme: ``` add_action('wp_enqueue_scripts', 'my_enqueue_scripts'); function my_enqueue_scripts() { wp_enqueue_script('jquery'); } ```
15,351
<p>I'm using the code below to create custom menu items on the fly. Its working great, except all menus are created as "Custom". In the code below, setting the menu-item-type to 'page' appears to have no effect.</p> <pre><code> foreach($thePages as $page){ wp_update_nav_menu_item($menu-&gt;term_id, ...
[ { "answer_id": 15368, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 2, "selected": true, "text": "<p>There's a filter:</p>\n\n<pre><code>function wpse15368_update_menu_item_type( $args )\n{\n return $args['menu-ite...
2011/04/21
[ "https://wordpress.stackexchange.com/questions/15351", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
I'm using the code below to create custom menu items on the fly. Its working great, except all menus are created as "Custom". In the code below, setting the menu-item-type to 'page' appears to have no effect. ``` foreach($thePages as $page){ wp_update_nav_menu_item($menu->term_id, 0, array( ...
There's a filter: ``` function wpse15368_update_menu_item_type( $args ) { return $args['menu-item-type'] = 'page'; } add_action( 'wp_update_nav_menu_item', 'wpse15368_update_menu_item_type' ); ```
15,357
<p>Is it possible to edit the "Post updated. View post" link and remove the "View post" entirely? Also change the "Post" to the name of a cpt?</p> <p>Thanks guys!</p> <p>Update: </p> <p>Here is the code I used and it worked like a charm. I hope this helps others!</p> <p>In my example I use "Contact" as my cpt:</p> ...
[ { "answer_id": 15360, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 2, "selected": false, "text": "<p>You can filter the update messages: <code>add_filter('post_updated_messages', 'your_message_function');</code></p>\...
2011/04/21
[ "https://wordpress.stackexchange.com/questions/15357", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4640/" ]
Is it possible to edit the "Post updated. View post" link and remove the "View post" entirely? Also change the "Post" to the name of a cpt? Thanks guys! Update: Here is the code I used and it worked like a charm. I hope this helps others! In my example I use "Contact" as my cpt: ![enter image description here](ht...
You can filter the update messages: `add_filter('post_updated_messages', 'your_message_function');` look in /wp-admin/edit-form-advanced.php to see the where the default messages are set.
15,361
<p>I am aware of nonces to check for intentions but can't make any sense if I can use them to restrict for database reads somehow? I mean, I am fetching records from the database using AJAX but I don't want anyone to have that data by some other means (POST requests to that <code>admin-ajax.php</code> page).</p> <p>Fo...
[ { "answer_id": 15371, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 0, "selected": false, "text": "<p>presumably one is logged in when making this request? you can hash some data and create a unique per-user nonce on ...
2011/04/21
[ "https://wordpress.stackexchange.com/questions/15361", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1521/" ]
I am aware of nonces to check for intentions but can't make any sense if I can use them to restrict for database reads somehow? I mean, I am fetching records from the database using AJAX but I don't want anyone to have that data by some other means (POST requests to that `admin-ajax.php` page). For example, in my AJAX...
There are a few things you can do to make more secure: First the Ajax call it self should be made with a WordPress nonce like you said: ``` <script type="text/javascript" > jQuery(document).ready(function($) { var data = { action: 'ACTION_NAME', Whatever_data: 1234, _aj...
15,364
<p>I added descriptions to my menus using this post, <a href="https://wordpress.stackexchange.com/questions/14037/menu-items-description">Menu items description? Custom Walker for wp_nav_menu()</a>. However I need to be able to use html tags and WordPress is stripping them out. Can anyone help?</p>
[ { "answer_id": 15438, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 3, "selected": true, "text": "<p>You can remove the filter by adding this to your functions.php file:</p>\n\n<pre><code>remove_filter('nav_menu_desc...
2011/04/21
[ "https://wordpress.stackexchange.com/questions/15364", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4648/" ]
I added descriptions to my menus using this post, [Menu items description? Custom Walker for wp\_nav\_menu()](https://wordpress.stackexchange.com/questions/14037/menu-items-description). However I need to be able to use html tags and WordPress is stripping them out. Can anyone help?
You can remove the filter by adding this to your functions.php file: ``` remove_filter('nav_menu_description', 'strip_tags'); ```
15,376
<p>I'd love to be able to hide meta boxes using screen options, instead of removing them or restricting them to user roles, the goal is to just "uncheck" the meta box for the user.</p> <p>I see how this would be tricky since any code that would make a DB change for a user wouldn't be allowed to run every time they hit...
[ { "answer_id": 19972, "author": "drebabels", "author_id": 5395, "author_profile": "https://wordpress.stackexchange.com/users/5395", "pm_score": 6, "selected": true, "text": "<p>You are referring to the metaboxes on the admin post screen right?</p>\n\n<p>For that you don't need a plugin, ...
2011/04/22
[ "https://wordpress.stackexchange.com/questions/15376", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3293/" ]
I'd love to be able to hide meta boxes using screen options, instead of removing them or restricting them to user roles, the goal is to just "uncheck" the meta box for the user. I see how this would be tricky since any code that would make a DB change for a user wouldn't be allowed to run every time they hit the page ...
You are referring to the metaboxes on the admin post screen right? For that you don't need a plugin, just drop the following into your functions.php file. ``` // add_action('user_register', 'set_user_metaboxes'); add_action('admin_init', 'set_user_metaboxes'); function set_user_metaboxes($user_id=NULL) { // Thes...
15,385
<p>fellow coders! I an having a hard time JOIN(ing) tables.</p> <p>I have a a lot of users on my site and many of them have the same last names. I am trying to get their emails by their last name. WP stores emails in the users table and user names in the usermeta and I have been trying to use JOIN to get what I want, ...
[ { "answer_id": 15388, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 3, "selected": true, "text": "<p>Hi <strong>@Holidaymaine</strong>:</p>\n\n<p>Not sure where you are doing wrong, but try the following instead w...
2011/04/22
[ "https://wordpress.stackexchange.com/questions/15385", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4777/" ]
fellow coders! I an having a hard time JOIN(ing) tables. I have a a lot of users on my site and many of them have the same last names. I am trying to get their emails by their last name. WP stores emails in the users table and user names in the usermeta and I have been trying to use JOIN to get what I want, but I don'...
Hi **@Holidaymaine**: Not sure where you are doing wrong, but try the following instead which is a self contained `test.php` file you can drop into the root of your website and load in your browser with `http://yoursite.com/test.php` *(assuming you replace `yoursite.com` with your site's domain! Also, note how I addin...
15,393
<p>I know this is very avant-garde, but bear with me. I've read that one is able to query a page by the page/post name or slug. I'm trying to do this because I need information from a page with a similar title/slug and will not have the ability to get the page id (unless there's a way to convert a title to an ID).</p> ...
[ { "answer_id": 15395, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>change <code>get_template_part( 'loop' );</code> to <code>get_template_part( 'loop','page' );</code> or manually in...
2011/04/22
[ "https://wordpress.stackexchange.com/questions/15393", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3296/" ]
I know this is very avant-garde, but bear with me. I've read that one is able to query a page by the page/post name or slug. I'm trying to do this because I need information from a page with a similar title/slug and will not have the ability to get the page id (unless there's a way to convert a title to an ID). I've t...
Hi **@Zach Shallbetter:** If I understand your question, then you are looking to solve your problem using theming functions when you really need to use more of WordPress' API. The following code can be copied to a `test.php` file and run using `http://yoursite.com/test.php` for you to see how it works *(assuming you r...
15,394
<p>Hey guys, I've added a TinyMCE to some textareas that are displayed in a custom meta box. All of the formatting works perfectly fine, except that the editor will not save <code>&lt;p&gt;</code> or <code>&lt;br/&gt;</code> tags. It doesn't preserve the line breaks.</p> <p>The TinyMCE is setup like this:</p> <pre><c...
[ { "answer_id": 15666, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 3, "selected": false, "text": "<p>Here's (a pared-down version of) what I use to custom-configure TinyMCE:</p>\n\n<pre><code>// http://tinymc...
2011/04/22
[ "https://wordpress.stackexchange.com/questions/15394", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2418/" ]
Hey guys, I've added a TinyMCE to some textareas that are displayed in a custom meta box. All of the formatting works perfectly fine, except that the editor will not save `<p>` or `<br/>` tags. It doesn't preserve the line breaks. The TinyMCE is setup like this: ``` wp_tiny_mce(true, array('editor_selector' => $field...
I recently got this working. You should search and replace `metaname` with your meta box name. The key to maintaining formatting was using `wpautop();` when saving the data. ``` add_action( 'add_meta_boxes', 'add_metaname_box'); add_action( 'save_post', 'metaname_save'); function add_metaname_box() { add_meta_b...
15,399
<p>I tried to install a premium theme called Superb. I'm new to WordPress and I'm having a bit of a problem. I think that it has to do with permission settings, but I'm not sure. This is my situation:</p> <p>I'm on a Mac running MAMP Pro. I've setup WP on my local machine. When I open my site in a browser, I see the d...
[ { "answer_id": 15407, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 2, "selected": false, "text": "<p>First, since you're using a premium Theme, you should first consult the Theme developer's support offerings...
2011/04/22
[ "https://wordpress.stackexchange.com/questions/15399", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4509/" ]
I tried to install a premium theme called Superb. I'm new to WordPress and I'm having a bit of a problem. I think that it has to do with permission settings, but I'm not sure. This is my situation: I'm on a Mac running MAMP Pro. I've setup WP on my local machine. When I open my site in a browser, I see the default Wor...
Laxmidi: You wouldn't FTP to your local installation of WordPress, which is under some directory that you have assigned with MAMP. Wherever that directory lives, you must unpack your theme.zip folder on your desktop, then move the theme into /wordpress/wp-content/themes Once you add move your downloaded theme direct...
15,423
<p>Post save functions are conflicting with each other when adding them to the save_post action hook.</p> <p>2 different custom post types with 2 different (one for each post type) custom meta boxes. </p> <p>I'm only including the code for 1 of the meta boxes. The other one is very similar and each one works fine se...
[ { "answer_id": 15427, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 3, "selected": true, "text": "<p>After doing some more research I found that:</p>\n<ul>\n<li>Instead of hooking the <code>add_meta_box</code> functi...
2011/04/23
[ "https://wordpress.stackexchange.com/questions/15423", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/251/" ]
Post save functions are conflicting with each other when adding them to the save\_post action hook. 2 different custom post types with 2 different (one for each post type) custom meta boxes. I'm only including the code for 1 of the meta boxes. The other one is very similar and each one works fine separately but not ...
After doing some more research I found that: * Instead of hooking the `add_meta_box` function into `admin_menu` it should be hooked into `add_meta_boxes` * Instead of the foreach loop use the `update_post_meta` function on the save function * Instead of using the `wp_nonce_field` the data can be sanitized using `esc_a...
15,424
<p>Is it possible to create the following:</p> <ul> <li>A new page dynamically daily, containing the last three posts</li> <li>Archive this page, so that tomorrow's page is a new page, with the three newest posts</li> </ul> <p>Basically I'd like to use WordPress for our news releases, we publish three each day. The d...
[ { "answer_id": 15425, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 1, "selected": false, "text": "<p>WordPress will generate daily archives automatically. You can use <code>wp_get_archives( );</code> and pass <code>a...
2011/04/23
[ "https://wordpress.stackexchange.com/questions/15424", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3711/" ]
Is it possible to create the following: * A new page dynamically daily, containing the last three posts * Archive this page, so that tomorrow's page is a new page, with the three newest posts Basically I'd like to use WordPress for our news releases, we publish three each day. The day's page should contain all three ...
You can create *date.php* (you can copy the content for this from *archive.php* or *index.php*) in your theme folder which will handle all the "day" pages... ``` <?php get_header(); ?> <div id="container"> <div id="content" role="main"> <?php $day = get_query_var('day'); $monthnum = get_q...
15,440
<p>I am creating a wordpress site which will have different sections , which will essentially be pages which can be accessed through a top level menu. Now when I make a post, I dont necessarily want all the posts to appear on the front page but instead while making the post want to choose which page it should be shown ...
[ { "answer_id": 15451, "author": "Sisir", "author_id": 3094, "author_profile": "https://wordpress.stackexchange.com/users/3094", "pm_score": 0, "selected": false, "text": "<p>How many of those pages you have? There are lots of way you can do this.</p>\n\n<ol>\n<li>Normally you can do it v...
2011/04/23
[ "https://wordpress.stackexchange.com/questions/15440", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4843/" ]
I am creating a wordpress site which will have different sections , which will essentially be pages which can be accessed through a top level menu. Now when I make a post, I dont necessarily want all the posts to appear on the front page but instead while making the post want to choose which page it should be shown in....
I would solve this using the plugin [Advanced Custom Fields](http://wordpress.org/extend/plugins/advanced-custom-fields/). 1) create an ACF item with the following config ![enter image description here](https://i.stack.imgur.com/MQvlt.png) [view larger](http://cl.ly/3m0t1M2C3E3v090D0931) 2) it will show a metabox wh...
15,444
<p>I want to remove the admin bar from the top of the page and actually place it into a custom location within my theme.</p> <p>Question:</p> <ol> <li>How would I call wp_admin_bar() inside a custom div. </li> </ol> <p>I would also need to remove the built in css, so that I can apply my own.</p> <p>*I already have ...
[ { "answer_id": 15451, "author": "Sisir", "author_id": 3094, "author_profile": "https://wordpress.stackexchange.com/users/3094", "pm_score": 0, "selected": false, "text": "<p>How many of those pages you have? There are lots of way you can do this.</p>\n\n<ol>\n<li>Normally you can do it v...
2011/04/23
[ "https://wordpress.stackexchange.com/questions/15444", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/370/" ]
I want to remove the admin bar from the top of the page and actually place it into a custom location within my theme. Question: 1. How would I call wp\_admin\_bar() inside a custom div. I would also need to remove the built in css, so that I can apply my own. \*I already have a filter to do this part. Reasons: My...
I would solve this using the plugin [Advanced Custom Fields](http://wordpress.org/extend/plugins/advanced-custom-fields/). 1) create an ACF item with the following config ![enter image description here](https://i.stack.imgur.com/MQvlt.png) [view larger](http://cl.ly/3m0t1M2C3E3v090D0931) 2) it will show a metabox wh...
15,446
<p>I enabled the compression option on WP Super Cache (off by default!) on <a href="http://ripper234.com/" rel="nofollow">my blog</a>. After that, <a href="http://analyze.websiteoptimization.com/" rel="nofollow">Website Optimization</a> started identifying my pages as being compressed (before, it didn't).</p> <p>All s...
[ { "answer_id": 15450, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 2, "selected": true, "text": "<p>I'm getting a <code>Content-Encoding:gzip</code> header when I visit your site...</p>\n\n<pre><code>Cache-Control:ma...
2011/04/23
[ "https://wordpress.stackexchange.com/questions/15446", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/678/" ]
I enabled the compression option on WP Super Cache (off by default!) on [my blog](http://ripper234.com/). After that, [Website Optimization](http://analyze.websiteoptimization.com/) started identifying my pages as being compressed (before, it didn't). All seemed well with the world, but then I double checked with [Pag...
I'm getting a `Content-Encoding:gzip` header when I visit your site... ``` Cache-Control:max-age=300, must-revalidate Connection:Keep-Alive Content-Encoding:gzip Content-Type:text/html; charset=UTF-8 Date:Sat, 23 Apr 2011 15:27:48 GMT Keep-Alive:timeout=15, max=100 Server:Apache Transfer-Encoding:Identity Vary:Accept-...
15,455
<p>Is there any way that i can hard code the custom menu items when first theme installed? I am creating a theme which will automatically make some common pages when installed. So I need to know if I can also add them to Wordpress custom menu so client don't need to add them manually?</p> <p>In other words: how to ins...
[ { "answer_id": 15488, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 6, "selected": true, "text": "<p>The Problem with your code is that its not actually adding the links to the menu and only to the menu's output...
2011/04/23
[ "https://wordpress.stackexchange.com/questions/15455", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3094/" ]
Is there any way that i can hard code the custom menu items when first theme installed? I am creating a theme which will automatically make some common pages when installed. So I need to know if I can also add them to Wordpress custom menu so client don't need to add them manually? In other words: how to insert/create...
The Problem with your code is that its not actually adding the links to the menu and only to the menu's output, hence the use of a filter (add\_filter) so you are just filtering the output of the menu in fact even if you don't have a menu your link will be shown with the code you are using. But to create a link and add...
15,475
<p>I'm trying to schedule a pseudo cron job to send an email after a set amount of time utilizing a WordPress plugin. </p> <p>So far, I've been able to make this code run when I hard code the email address and message into the <code>email_about_coupon()</code> function. However, when I try to send the arguments to the...
[ { "answer_id": 17007, "author": "Thirlan", "author_id": 4119, "author_profile": "https://wordpress.stackexchange.com/users/4119", "pm_score": 4, "selected": false, "text": "<p>Thanks to Rarst this makes a hell of a lot more sense now. So I've updated this post to elaborate the difference...
2011/04/22
[ "https://wordpress.stackexchange.com/questions/15475", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4850/" ]
I'm trying to schedule a pseudo cron job to send an email after a set amount of time utilizing a WordPress plugin. So far, I've been able to make this code run when I hard code the email address and message into the `email_about_coupon()` function. However, when I try to send the arguments to the function, the email ...
I think you have mismatch in how you pass arguments and how you expect it to work. You pass array of arguments to schedule and expect your hooked function to receive identical array of arguments. This is not the case. Cron events are processed by [`do_action_ref_array()`](http://codex.wordpress.org/Function_Reference/...
15,477
<p>Aa you know, as of WP3.0 there are options for custom advanced queries, which is great. As of this, some query parameters of custom fields like meta_key, meta_value were deprecated for the new meta_query parameter (<a href="http://codex.wordpress.org/Function_Reference/WP_Query#Custom_Field_Parameters">see here</a>)...
[ { "answer_id": 15479, "author": "Evan Yeung", "author_id": 1878, "author_profile": "https://wordpress.stackexchange.com/users/1878", "pm_score": 4, "selected": false, "text": "<p>The WP Codex is actually confusing when addressing this problem.</p>\n\n<p>You do not actually need the meta_...
2011/04/23
[ "https://wordpress.stackexchange.com/questions/15477", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2063/" ]
Aa you know, as of WP3.0 there are options for custom advanced queries, which is great. As of this, some query parameters of custom fields like meta\_key, meta\_value were deprecated for the new meta\_query parameter ([see here](http://codex.wordpress.org/Function_Reference/WP_Query#Custom_Field_Parameters)) I try to ...
You can define the meta key for *orderby* parameter using the old method (I tested on WP 3.1.1)... ``` query_posts( array( 'post_type' => 'services', 'order' => 'ASC', 'meta_key' => 'some_key', 'orderby' => 'meta_value', //or 'meta_value_num' 'meta_query' => a...
15,483
<p>I'm using mac os x 10.6 with xampp.</p> <p><code>http://wp3.1/</code> is the url to where I have WordPress installed.</p> <p>The physical path is <code>/Users/myUserName/Sites/wp3.1/</code></p> <p>I do not install plugins or themes in the "natural" way. I have created a directory named "git" which is located in <...
[ { "answer_id": 15484, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 4, "selected": true, "text": "<p>Symbolic links are … <a href=\"https://wordpress.stackexchange.com/questions/15202/plugins-in-symlinked-directories\">r...
2011/04/24
[ "https://wordpress.stackexchange.com/questions/15483", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/11019/" ]
I'm using mac os x 10.6 with xampp. `http://wp3.1/` is the url to where I have WordPress installed. The physical path is `/Users/myUserName/Sites/wp3.1/` I do not install plugins or themes in the "natural" way. I have created a directory named "git" which is located in `/Users/myUserName/git/`. This is where all my ...
Symbolic links are … [risky](https://wordpress.stackexchange.com/questions/15202/plugins-in-symlinked-directories) in WordPress. It is easier to use a separate domain for plugins per wp-config.php: ``` define( 'WP_PLUGIN_DIR', '/local/path/to/plugin/directory' ); define( 'WP_PLUGIN_URL', 'http://plugins.dev'); ``` S...
15,534
<p>I can't seem to find such an option listed here:</p> <p><a href="http://codex.wordpress.org/XML-RPC_wp#wp.setOptions" rel="nofollow">http://codex.wordpress.org/XML-RPC_wp#wp.setOptions</a></p> <p>Does it exist?</p> <p>Thanks.</p>
[ { "answer_id": 15549, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 3, "selected": true, "text": "<p>No, that option does not currently exist through XML-RPC. However, you can always create your own method in a plugin ...
2011/04/25
[ "https://wordpress.stackexchange.com/questions/15534", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161/" ]
I can't seem to find such an option listed here: <http://codex.wordpress.org/XML-RPC_wp#wp.setOptions> Does it exist? Thanks.
No, that option does not currently exist through XML-RPC. However, you can always create your own method in a plugin and hook it up to XML-RPC. --- Update ------ There's an upcoming [Google Summer of Code](http://wordpress.org/gsoc/) project that will be extending the XML-RPC interface to allow direct manipulation o...
15,542
<p>i am new to multisite. It is a simple question. I know WordPress multisite can be setup for subdomains. Is it possible to use domains along with subdomains? I have searched google but have not had really good results. Perhaps I have used the wrong keywords.</p> <p><strong>so i can use a single wordpress installatio...
[ { "answer_id": 15549, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 3, "selected": true, "text": "<p>No, that option does not currently exist through XML-RPC. However, you can always create your own method in a plugin ...
2011/04/25
[ "https://wordpress.stackexchange.com/questions/15542", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3094/" ]
i am new to multisite. It is a simple question. I know WordPress multisite can be setup for subdomains. Is it possible to use domains along with subdomains? I have searched google but have not had really good results. Perhaps I have used the wrong keywords. **so i can use a single wordpress installation for:** domain...
No, that option does not currently exist through XML-RPC. However, you can always create your own method in a plugin and hook it up to XML-RPC. --- Update ------ There's an upcoming [Google Summer of Code](http://wordpress.org/gsoc/) project that will be extending the XML-RPC interface to allow direct manipulation o...
15,546
<p>I have a custom post type (CPT) called <code>event</code>. I have a meta box for the type with several fields. I would like to validate some fields before publishing an event. For example, if an event's date is not specified I would like to display an informative error message, save the event for future editing, but...
[ { "answer_id": 15582, "author": "somatic", "author_id": 838, "author_profile": "https://wordpress.stackexchange.com/users/838", "pm_score": 3, "selected": false, "text": "<p>There are two steps to the method: first, a function to save your custom metabox field data (hooked to save_post),...
2011/04/25
[ "https://wordpress.stackexchange.com/questions/15546", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1343/" ]
I have a custom post type (CPT) called `event`. I have a meta box for the type with several fields. I would like to validate some fields before publishing an event. For example, if an event's date is not specified I would like to display an informative error message, save the event for future editing, but prevent that ...
You can stop the post from saving all together with minor JQuery hacks and validate the fields before saving on the client side or server side with ajax: first we add our JavaScript to capture the submit/publish event and use it to submit our own ajax function before the actual submit: ``` add_action('wp_print_scrip...
15,567
<p>I have re-worded this to make more sense.</p> <p>Ok, I have a plugin that uses a remote service that check for updates, much like default WordPress plugins, in this case it just checks an XML file.</p> <p>I want to show a menu bubble like this <img src="https://i.stack.imgur.com/rZZiu.png" alt="enter image descrip...
[ { "answer_id": 15720, "author": "Jan Fabry", "author_id": 8, "author_profile": "https://wordpress.stackexchange.com/users/8", "pm_score": 4, "selected": true, "text": "<p>I would do this when you call <code>add_options_page()</code>, not later. It's always better to do this with the supp...
2011/04/25
[ "https://wordpress.stackexchange.com/questions/15567", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1509/" ]
I have re-worded this to make more sense. Ok, I have a plugin that uses a remote service that check for updates, much like default WordPress plugins, in this case it just checks an XML file. I want to show a menu bubble like this ![enter image description here](https://i.stack.imgur.com/rZZiu.png) when an update is a...
I would do this when you call `add_options_page()`, not later. It's always better to do this with the supported API instead of playing with the internal structures. The plugin updater periodically checks the plugin status and then saves the result in a *transient*. This means that [it only reads this cached status](ht...
15,570
<p>Okay guys, here's the scenario.</p> <p>I'm am trying to setup a function that will automatically duplicate a post (when published) over to another post type. So, a regular blog post is published, and when it is published, all of its information is copied over to a custom post type (for WP ECommerce), automatically ...
[ { "answer_id": 15889, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 1, "selected": false, "text": "<p>Forget about the previous answer, You say that it works fine with <code>publish_post</code> hook then you cre...
2011/04/25
[ "https://wordpress.stackexchange.com/questions/15570", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2418/" ]
Okay guys, here's the scenario. I'm am trying to setup a function that will automatically duplicate a post (when published) over to another post type. So, a regular blog post is published, and when it is published, all of its information is copied over to a custom post type (for WP ECommerce), automatically creating a...
I don't have a solution, but there's a [ticket #20541](https://core.trac.wordpress.org/ticket/20541) on Make WordPress Core. Apparently a call to `switch_to_blog()` would not repopulate `$wp_taxomies`, which these taxonomies rely on.
15,607
<p>I am a new user with WordPress, and I would like to use mathematical formulas. I have been reading the mathjax pages for hours, such as <a href="http://wordpress.org/extend/plugins/mathjax-latex/">this one</a> and quite a few others. This may be a bad question, but can someone please help me? All I want to do is ...
[ { "answer_id": 15612, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 2, "selected": false, "text": "<p>It can be very confusing to users when plugins ask users to upload files and insert lines of code. The plugin lin...
2011/04/26
[ "https://wordpress.stackexchange.com/questions/15607", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4891/" ]
I am a new user with WordPress, and I would like to use mathematical formulas. I have been reading the mathjax pages for hours, such as [this one](http://wordpress.org/extend/plugins/mathjax-latex/) and quite a few others. This may be a bad question, but can someone please help me? All I want to do is enable Latex, and...
If you have a blog that is hosted on WordPress.com, [you can't install extra plugins or modify the theme files yourself](http://en.support.wordpress.com/com-vs-org/) - this is only possible with a self-hosted version. However, [WordPress.com has enabled LaTeX support](http://en.support.wordpress.com/latex/) for everyo...
15,618
<p>I have a taxonomy wp_query and i would like to order the list by <strong>title and</strong> by <strong>meta</strong> value (numeric value)</p> <ul> <li>Have a meta value Interesting = 1 or 0 in the posts</li> <li>Not so interesting posts would be at the bottom of the query</li> </ul> <p><strong>GOAL - OUTPUT LIKE ...
[ { "answer_id": 15621, "author": "windyjonas", "author_id": 221, "author_profile": "https://wordpress.stackexchange.com/users/221", "pm_score": 1, "selected": false, "text": "<p>you can't mix ascending and descending order, but if you switch the zeroes and ones then this might work:</p>\n...
2011/04/26
[ "https://wordpress.stackexchange.com/questions/15618", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4190/" ]
I have a taxonomy wp\_query and i would like to order the list by **title and** by **meta** value (numeric value) * Have a meta value Interesting = 1 or 0 in the posts * Not so interesting posts would be at the bottom of the query **GOAL - OUTPUT LIKE THIS:** (is this possible with WP\_QUERY and WP3.1) **A** ( META ...
You can filter the `orderby` part of the query to get what you want (trying to pass it via the `orderby` parameter will not work, it will be filtered out). This simple example adds the `meta_value` sort order before the standard title sort order. ``` add_filter( 'posts_orderby', 'wpse15168_posts_orderby' ); $query = n...
15,628
<p>I have a client (same for my <a href="https://wordpress.stackexchange.com/questions/15512/wordpress-featured-post-slider">previous post about the slider</a>) who believes that the url structure needs to include a "google page id" to be compliant with google news. Therefore, they want the url structure set up like: <...
[ { "answer_id": 15630, "author": "anu", "author_id": 490, "author_profile": "https://wordpress.stackexchange.com/users/490", "pm_score": 3, "selected": true, "text": "<p>Go to the Permalink page (in Settings), and choose custom structure, and use something like this:</p>\n\n<pre><code>/%y...
2011/04/26
[ "https://wordpress.stackexchange.com/questions/15628", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/807/" ]
I have a client (same for my [previous post about the slider](https://wordpress.stackexchange.com/questions/15512/wordpress-featured-post-slider)) who believes that the url structure needs to include a "google page id" to be compliant with google news. Therefore, they want the url structure set up like: <http://www.sit...
Go to the Permalink page (in Settings), and choose custom structure, and use something like this: ``` /%year%/%monthnum%/%day%/%postname%/00%post_id% ```
15,632
<p>I'm trying to set-up pretty permalinks for my site. WordPress has a warning that my htaccess files is not writable. It provided some code to copy and put in the htaccess file.</p> <p>I'm on a Mac, my local machine running WordPress 3.1.1. </p> <p>I coped the code WP provided and pasted it into a new new TextEdit f...
[ { "answer_id": 15634, "author": "Scott", "author_id": 4610, "author_profile": "https://wordpress.stackexchange.com/users/4610", "pm_score": 3, "selected": true, "text": "<p>Open up terminal. Found in Utilities.</p>\n\n<p>Type:</p>\n\n<pre><code>cd /path/to/htaccess/file/\nmv 1.htaccess ....
2011/04/26
[ "https://wordpress.stackexchange.com/questions/15632", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4509/" ]
I'm trying to set-up pretty permalinks for my site. WordPress has a warning that my htaccess files is not writable. It provided some code to copy and put in the htaccess file. I'm on a Mac, my local machine running WordPress 3.1.1. I coped the code WP provided and pasted it into a new new TextEdit file that I named ...
Open up terminal. Found in Utilities. Type: ``` cd /path/to/htaccess/file/ mv 1.htaccess .htaccess ``` For future edits of the htaccess file I'd recommend learning to use vi in the terminal. ``` cd /path/to/htaccess/file/ vi .htaccess ```
15,633
<p>I'm using <a href="http://codex.wordpress.org/Function_Reference/wp_login_form"><code>wp_login_form()</code></a> to display login form in a jQuery dialog window.</p> <p>If user enters wrong password, the user is taken to the backend. I don't want that. Is there a way to notify user that he entered wrong password an...
[ { "answer_id": 15652, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 4, "selected": true, "text": "<p><code>wp_login_form()</code> creates a form with an action attribute of <code>site_url/wp-login.php</code>, wh...
2011/04/26
[ "https://wordpress.stackexchange.com/questions/15633", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1447/" ]
I'm using [`wp_login_form()`](http://codex.wordpress.org/Function_Reference/wp_login_form) to display login form in a jQuery dialog window. If user enters wrong password, the user is taken to the backend. I don't want that. Is there a way to notify user that he entered wrong password and still remain on the same page?...
`wp_login_form()` creates a form with an action attribute of `site_url/wp-login.php`, which means that when you click the submit button the form is posted to `site_url/wp-login.php` which ignores redirect\_to on errors (like wrong password) so in your case either go back to using a plugin or recreate the whole login pr...
15,639
<p>I'm got an issue here that's stumping me. I'm trying to create a custom RSS feed using <code>add_feed()</code>. The feed seems to have been created successfully, but I'm quite stuck on some bug in the feed template I'm writing.</p> <p>For some reason, in my code, <code>the_post()</code> seems to return nothing in...
[ { "answer_id": 15689, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<blockquote>\n <p>in my code, <code>the_post()</code> seems to return nothing inside the loop</p>\n</blockquote>\n\n<p...
2011/04/26
[ "https://wordpress.stackexchange.com/questions/15639", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4758/" ]
I'm got an issue here that's stumping me. I'm trying to create a custom RSS feed using `add_feed()`. The feed seems to have been created successfully, but I'm quite stuck on some bug in the feed template I'm writing. For some reason, in my code, `the_post()` seems to return nothing inside the loop. (I've verified this...
OK. So I think I figured this one out myself. I'll document it here for the sake of those who may fall into the same trap. I've been using a template file to structure my feed. In my `functions.php` file, this is what the relevant portions of code looked like before: ``` add_feed('weekly_deals', 'weekly_deals_create_...
15,650
<p>I'm trying to add BuddyPress nav menu support to my theme and, unfortunately, BP's template tags still aren't fully up to snuff. (Basically, if you're not making an explicit child theme for the BP Default theme, you've got to reinvent several wheels.)</p> <p>So what I'd like to do is</p> <ol> <li>Detect when BP is...
[ { "answer_id": 15664, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 0, "selected": false, "text": "<p>Your call to <code>wp_nav_menu()</code> needs to include a custom callback function, such as a call to <cod...
2011/04/26
[ "https://wordpress.stackexchange.com/questions/15650", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/61/" ]
I'm trying to add BuddyPress nav menu support to my theme and, unfortunately, BP's template tags still aren't fully up to snuff. (Basically, if you're not making an explicit child theme for the BP Default theme, you've got to reinvent several wheels.) So what I'd like to do is 1. Detect when BP is active (I know how ...
So basically you are asking how to create a custom menu by code and assign it to a menu location: ``` //give your menu a name $name = 'theme default menu'; //create the menu $menu_id = wp_create_nav_menu($name); //then get the menu object by its name $menu = get_term_by( 'name', $name, 'nav_menu' ); //then add the...
15,651
<p>I'm using Mac OS X's built in Apache + PHP with MySQL. Everything works perfectly, except for my pretty %postname% permalinks — they just won't work. I have obviously enabled mod_rewrite and set the AllowOverride setting to All on my httpd.conf file. In case there's anything I can do (I really don't want to run MAMP...
[ { "answer_id": 15654, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 0, "selected": false, "text": "<p>there are two conf files for the built in apache, one for your username, which may be setting allowoverride to none...
2011/04/26
[ "https://wordpress.stackexchange.com/questions/15651", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3195/" ]
I'm using Mac OS X's built in Apache + PHP with MySQL. Everything works perfectly, except for my pretty %postname% permalinks — they just won't work. I have obviously enabled mod\_rewrite and set the AllowOverride setting to All on my httpd.conf file. In case there's anything I can do (I really don't want to run MAMP),...
Your /etc/users/{username}.conf should look like this: ``` <Directory "/Users/username/Sites/"> Options Indexes MultiViews FollowSymLinks AllowOverride All AuthConfig Order allow,deny Allow from all </Directory> ``` You also have to change the name Apache runs under to be able to save the .htaccess r...
15,657
<p>I am currently in version 3.1 of WordPress and I have a problem with planning my post. In fact, whenever I plan a post, it is written: &quot;Scheduled missed. Could you help me please.</p>
[ { "answer_id": 15662, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 4, "selected": true, "text": "<p>Due to your server configuration, you may need to use the alternate cron method, which uses redirect rather ...
2011/04/26
[ "https://wordpress.stackexchange.com/questions/15657", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4923/" ]
I am currently in version 3.1 of WordPress and I have a problem with planning my post. In fact, whenever I plan a post, it is written: "Scheduled missed. Could you help me please.
Due to your server configuration, you may need to use the alternate cron method, which uses redirect rather than http loopback. Try adding the following to your `wp-config.php` file: ``` // Alternate cron method define( 'ALTERNATE_WP_CRON', true ); ```
15,688
<p>I am using WP3 and want to starting adding users (many users to a single blog) but when I give a new user an account, they can see all the posts in the admin including scheduled, drafts, pending review etc. I either need the users to ONLY view their own posts or only view their own published posts (but not scheduled...
[ { "answer_id": 15733, "author": "Ján Bočínec", "author_id": 2515, "author_profile": "https://wordpress.stackexchange.com/users/2515", "pm_score": 3, "selected": false, "text": "<p>Put this into your <em>functions.php</em> file in your theme folder...</p>\n\n<pre><code>function query_set_...
2011/04/26
[ "https://wordpress.stackexchange.com/questions/15688", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4908/" ]
I am using WP3 and want to starting adding users (many users to a single blog) but when I give a new user an account, they can see all the posts in the admin including scheduled, drafts, pending review etc. I either need the users to ONLY view their own posts or only view their own published posts (but not scheduled, d...
Put this into your *functions.php* file in your theme folder... ``` function query_set_only_author( $wp_query ) { global $current_user; if ( is_admin() && !current_user_can('manage_options') ) { $wp_query->set( 'author', $current_user->ID ); } } add_action('pre_get_posts', 'query_set_only_author' )...
15,700
<p>*<strong>Editor Note</strong> (Original title: The url from an image via custom field) changed to be more descriptive.</p> <p>Hi all, Am not even sure if this can be done but...after ive been searching for the last 6 hours none stop I have to ask :/</p> <p>I have a image slider I use which I have to add the image ...
[ { "answer_id": 15701, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 0, "selected": false, "text": "<p>add a filter to the_content that checks if it's a feed and adds the image.</p>\n\n<pre><code>add_filter('the_conten...
2011/04/26
[ "https://wordpress.stackexchange.com/questions/15700", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4915/" ]
\***Editor Note** (Original title: The url from an image via custom field) changed to be more descriptive. Hi all, Am not even sure if this can be done but...after ive been searching for the last 6 hours none stop I have to ask :/ I have a image slider I use which I have to add the image url(not the thumb url) all th...
This is a hard one but I think this will work. Someone please correct me if I'm wrong. This uses the external Simple Pie library built into WordPress to fetch the feed, get the image url and create a new post for each item and save the image url as a custom field. To activate the process we have to hook into wp\_cron...
15,708
<p>I've enabled my theme with the ability to display the "Featured Image" for the post. However, I'm trying now to determine (1) How to assign a hyperlink to the image and (2) How to call the_post_thumbnail() so that it wraps the hyperlink around the image.</p> <p>I can't find where this is supported in the current re...
[ { "answer_id": 15709, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 2, "selected": true, "text": "<p>I assume you want this to be output inside of <code>the_content()</code>?</p>\n\n<p>You would probably have ...
2011/04/27
[ "https://wordpress.stackexchange.com/questions/15708", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
I've enabled my theme with the ability to display the "Featured Image" for the post. However, I'm trying now to determine (1) How to assign a hyperlink to the image and (2) How to call the\_post\_thumbnail() so that it wraps the hyperlink around the image. I can't find where this is supported in the current release of...
I assume you want this to be output inside of `the_content()`? You would probably have to define a shortcode that will output `the_post_thumbnail()`. You could either define the shortcode to accept a URL as an argument, or else wrap the shortcode with HTML anchor tags. EDIT: Assuming you're already outputting `the_p...
15,712
<p>I've been trying to wade my way through learning the ins and outs of taxonomies and how to integrate them into themes and I've run into a pretty basic issue that I can't seem to figure out.</p> <p>I started working on this in a BuddyPress install using More Taxonomies. After not being able to get the custom templa...
[ { "answer_id": 15967, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 2, "selected": false, "text": "<p>Try this one:</p>\n\n<pre><code>/**\n* flush_rewrite_rules()\n* Flush the rewrite rules, which forces the regenerat...
2011/04/27
[ "https://wordpress.stackexchange.com/questions/15712", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3247/" ]
I've been trying to wade my way through learning the ins and outs of taxonomies and how to integrate them into themes and I've run into a pretty basic issue that I can't seem to figure out. I started working on this in a BuddyPress install using More Taxonomies. After not being able to get the custom template to load ...
I found this code; ``` function ftc_flush_rewrites() { global $wp_rewrite; $wp_rewrite->flush_rules(); } function ftc_add_rewrites() { global $wp_rewrite; $ftc_new_non_wp_rules = array( 'find/(this)' => '/addit.php?here=$1', ); $wp_rewrite->non_wp_rules = $ftc_new_non_wp_rules + $wp_rewrite->non_wp_rules; } add_act...
15,713
<p>I have a WordPress project that I'm using as a CMS. <strike>I also have a database with some products in it that I'd like to display on the site (gallery or portfolio maybe?)</strike> I have a custom post type for Products that I want to be editable in the wordpress admin (along with the rest of the content). </p>...
[ { "answer_id": 15967, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 2, "selected": false, "text": "<p>Try this one:</p>\n\n<pre><code>/**\n* flush_rewrite_rules()\n* Flush the rewrite rules, which forces the regenerat...
2011/04/27
[ "https://wordpress.stackexchange.com/questions/15713", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1414/" ]
I have a WordPress project that I'm using as a CMS. I also have a database with some products in it that I'd like to display on the site (gallery or portfolio maybe?) I have a custom post type for Products that I want to be editable in the wordpress admin (along with the rest of the content). I know I have to do a cu...
I found this code; ``` function ftc_flush_rewrites() { global $wp_rewrite; $wp_rewrite->flush_rules(); } function ftc_add_rewrites() { global $wp_rewrite; $ftc_new_non_wp_rules = array( 'find/(this)' => '/addit.php?here=$1', ); $wp_rewrite->non_wp_rules = $ftc_new_non_wp_rules + $wp_rewrite->non_wp_rules; } add_act...
15,750
<p>I consistently get spam attempts on various and sundry media attachments on my primary WP blog. By default, media has open comments (for instance, <a href="http://literalbarrage.org/blog/archives/2009/03/18/daddywill-date-march-2009/dsc08760/" rel="nofollow noreferrer">http://literalbarrage.org/blog/archives/2009/03...
[ { "answer_id": 15751, "author": "John P Bloch", "author_id": 11, "author_profile": "https://wordpress.stackexchange.com/users/11", "pm_score": 3, "selected": true, "text": "<p>This ought to do it:</p>\n\n<pre><code>function wpse15750_comment_check( $id ){\n if( get_post_type( $id ) ==...
2011/04/27
[ "https://wordpress.stackexchange.com/questions/15750", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/61/" ]
I consistently get spam attempts on various and sundry media attachments on my primary WP blog. By default, media has open comments (for instance, <http://literalbarrage.org/blog/archives/2009/03/18/daddywill-date-march-2009/dsc08760/>), yet there is no native way to disable comments on media files. (e.g. <https://skit...
This ought to do it: ``` function wpse15750_comment_check( $id ){ if( get_post_type( $id ) == 'attachment' ) exit; } add_action( 'pre_comment_on_post', 'wpse15750_comment_check' ); ``` EDIT ---- Ignore the above. That will stop new comments, but to do what you want, this is much better: ``` function w...
15,758
<p>Can you add the visual editor to the description field for custom taxonomies? It would be nice to have this option available when you edit an entry for a taxonomy be it core or custom.</p>
[ { "answer_id": 15797, "author": "WhIteSidE", "author_id": 162, "author_profile": "https://wordpress.stackexchange.com/users/162", "pm_score": 0, "selected": false, "text": "<p>Not directly, no.</p>\n\n<p>You could, however, write a custom javascript which applies the appropriate classes ...
2011/04/27
[ "https://wordpress.stackexchange.com/questions/15758", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3736/" ]
Can you add the visual editor to the description field for custom taxonomies? It would be nice to have this option available when you edit an entry for a taxonomy be it core or custom.
Just wrote the function. It'll display the tinymce editor in every custom taxonomy description right now. Surely you can edit to show it for only some specific taxonomy. ``` /** * Display advanced TinyMCE editor in taxonomy page */ function wpse_7156_enqueue_category() { global $pagenow, $current_screen; if...
15,790
<p>I have a frontend form with a bunch of input. My requirements force me to use a custom shortcode to create the form. I have already tested a page with that shortcode.</p> <p>Here's my :</p> <pre><code>&lt;form name="myform" method="post" action="&lt;?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?&gt...
[ { "answer_id": 15789, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 0, "selected": false, "text": "<p>It looks like you're using the default permalink setup. You need to enable URL rewriting with mod_rewrite to get 'p...
2011/04/27
[ "https://wordpress.stackexchange.com/questions/15790", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/127/" ]
I have a frontend form with a bunch of input. My requirements force me to use a custom shortcode to create the form. I have already tested a page with that shortcode. Here's my : ``` <form name="myform" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>" enctype="multipart/form-dat...
Change this: `'rewrite' => array('slug' => 'nos-soins-et-services');` To this: `'rewrite' => array('slug' => 'nos-soins-et-services', 'with_front' => true);`
15,800
<p>I have a custom post type, called 'status' and I have disabled 'title' in the post type. Right now it's setting all posts to have the title "Auto Draft". I want to set up a way to set the title to be the post's date. I think I should be using 'wp_insert_post_data". Right now I am using the following code but it is n...
[ { "answer_id": 15804, "author": "Lea Cohen", "author_id": 373, "author_profile": "https://wordpress.stackexchange.com/users/373", "pm_score": 0, "selected": false, "text": "<p>There's a plugin that does that - <a href=\"http://www.sanisoft.com/blog/2009/06/30/datetitle-a-wordpress-plugin...
2011/04/28
[ "https://wordpress.stackexchange.com/questions/15800", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4949/" ]
I have a custom post type, called 'status' and I have disabled 'title' in the post type. Right now it's setting all posts to have the title "Auto Draft". I want to set up a way to set the title to be the post's date. I think I should be using 'wp\_insert\_post\_data". Right now I am using the following code but it is n...
Despite what the Codex says, $postarr doesn't always get passed in, so you should just use $data. $data isn't a meaningful variable name, though, so I prefer $cleanPost. I'd also try removing the priority on the filter, since it's not usually necessary. It's also a good idea to set the slug (`post_name`) in addition to...
15,820
<p>I have a bunch of widgets that I load from php files, like so: <br> I added a PHP CODE widget and inside wrote:</p> <pre><code>&lt;?php include '/wp-content/themes/myTheme/parts/block1.php'; ?&gt; </code></pre> <p>This worked well on my localhost, but for some reason it stopped working <br> when I uploaded that we...
[ { "answer_id": 15829, "author": "Manny Fleurmond", "author_id": 2234, "author_profile": "https://wordpress.stackexchange.com/users/2234", "pm_score": 1, "selected": false, "text": "<p>I've had similar problems. You may want to use the built in WordPress constants:</p>\n\n<pre><code>&lt;...
2011/04/28
[ "https://wordpress.stackexchange.com/questions/15820", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3642/" ]
I have a bunch of widgets that I load from php files, like so: I added a PHP CODE widget and inside wrote: ``` <?php include '/wp-content/themes/myTheme/parts/block1.php'; ?> ``` This worked well on my localhost, but for some reason it stopped working when I uploaded that website online (and switched the hom...
The correct way to load a PHP file in the theme directory is to use the locate\_template function. ``` <?php locate_template(array('parts/block1.php'),true,false); ?> ``` The true makes it automatically require it. The false makes it not require\_once it.
15,821
<p>I'm using three widgets, two of them are default WP widgets (Recent Posts and Archives) and the third one is a custom widget which acts like Recent Posts but for a specific custom Post Type.</p> <p>My question is how can I make the widget titles clickable links? It seems that WordPress does not accept HTML in the t...
[ { "answer_id": 15830, "author": "kevtrout", "author_id": 58, "author_profile": "https://wordpress.stackexchange.com/users/58", "pm_score": 1, "selected": false, "text": "<p>If the default widgets don't offer the functionality you are after, specifically allowing custom links on titles, y...
2011/04/28
[ "https://wordpress.stackexchange.com/questions/15821", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4962/" ]
I'm using three widgets, two of them are default WP widgets (Recent Posts and Archives) and the third one is a custom widget which acts like Recent Posts but for a specific custom Post Type. My question is how can I make the widget titles clickable links? It seems that WordPress does not accept HTML in the title field...
Making the title click-able =========================== WordPress won't let you pass HTML code in the title of the widget, but it does have the handy parameters `$before_title` and `$after_title` that you can use to manipulate things. In your widget, just add the first part of the link (`<a href="...">`) to the *end*...
15,839
<p>How can I sort by meta value? In meta value I have "price" (float).</p> <p>I make this query, but always get </p> <blockquote> <p>Sorry, no posts matched your criteria.</p> </blockquote> <pre><code>$posts = query_posts( $query_string . '&amp;orderby=meta_value_num&amp;meta_key=Notes&amp;meta_value_num=price&amp...
[ { "answer_id": 15847, "author": "John P Bloch", "author_id": 11, "author_profile": "https://wordpress.stackexchange.com/users/11", "pm_score": 3, "selected": false, "text": "<p>Your meta value is a serialized array.</p>\n\n<p>What you're asking it to get for you is all posts with a meta ...
2011/04/28
[ "https://wordpress.stackexchange.com/questions/15839", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
How can I sort by meta value? In meta value I have "price" (float). I make this query, but always get > > Sorry, no posts matched your criteria. > > > ``` $posts = query_posts( $query_string . '&orderby=meta_value_num&meta_key=Notes&meta_value_num=price&order=ASC'); ``` **Edit:** ``` meta_value value: "a:6:{...
Your meta value is a serialized array. What you're asking it to get for you is all posts with a meta with the key `'Notes'` and the value `'price'`. Your meta value is not `'price'`, though, it's ``` a:6:{s:5:"width";s:3:"580";s:6:"price";s:3:"99" ``` The first thing you need to do to order by price is to start us...
15,840
<p>I'm using the posts-type Posts to display portfolio items and it looks strange to have portfolio labeled as posts. Is there any way to rename Posts to Portfolio instead to better reflect it's usage.</p>
[ { "answer_id": 15843, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 3, "selected": false, "text": "<p>You need to create a Custom Post Type, \"Portfolio\".</p>\n\n<p>Posts are Posts. Why try to use them as som...
2011/04/28
[ "https://wordpress.stackexchange.com/questions/15840", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4965/" ]
I'm using the posts-type Posts to display portfolio items and it looks strange to have portfolio labeled as posts. Is there any way to rename Posts to Portfolio instead to better reflect it's usage.
I used the following script to rename the default post type: ``` function change_post_menu_label() { global $menu, $submenu; $menu[5][0] = 'Portfolio'; $submenu['edit.php'][5][0] = 'Portfolio'; $submenu['edit.php'][10][0] = 'New Portfolio'; $submenu['edit.php'][16][0] = 'Portfolio Tags'; echo ...
15,844
<p>using;</p> <pre><code>$args = array( 'menu' =&gt; 'mainmenu', 'container' =&gt; 'ul', 'menu_class' =&gt; 'span-10 clearfix', 'after'=&gt;'/'); wp_nav_menu($args); </code></pre> <p>which gives me; london/munich/artists/fairs &amp; events/publications/news/contact/</p> <p>but using the args (or similar) can i remov...
[ { "answer_id": 15849, "author": "John P Bloch", "author_id": 11, "author_profile": "https://wordpress.stackexchange.com/users/11", "pm_score": 0, "selected": false, "text": "<p>If you can move the <code>/</code> to before the links ( <code>'before' =&gt; '/'</code> instead of <code>'afte...
2011/04/28
[ "https://wordpress.stackexchange.com/questions/15844", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3978/" ]
using; ``` $args = array( 'menu' => 'mainmenu', 'container' => 'ul', 'menu_class' => 'span-10 clearfix', 'after'=>'/'); wp_nav_menu($args); ``` which gives me; london/munich/artists/fairs & events/publications/news/contact/ but using the args (or similar) can i remove the / from contact? any help welcome!
Here is a completely different approach to the problem. Since the slashes may be considered to be presentational, they should not go into the HTML. Users without CSS just get to see a regular list. You could then use CSS to restyle the list and add the slashes in between. ``` #nav li { display:inline; } #nav li:befor...
15,850
<p>I don't need this whole mess of classes like this...</p> <p><code>&lt;body class="page page-id-829 page-template page-template-page-template-portfolio-php portfolio"&gt;</code></p> <p>I'd like something like this...</p> <p><code>&lt;body class="portfolio"&gt;</code></p> <p>Is there a filter snippet somewhere tha...
[ { "answer_id": 15852, "author": "John P Bloch", "author_id": 11, "author_profile": "https://wordpress.stackexchange.com/users/11", "pm_score": 1, "selected": false, "text": "<p>This will give every page a body class of only 'portfolio'. The first argument is the array of generated body ...
2011/04/28
[ "https://wordpress.stackexchange.com/questions/15850", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1925/" ]
I don't need this whole mess of classes like this... `<body class="page page-id-829 page-template page-template-page-template-portfolio-php portfolio">` I'd like something like this... `<body class="portfolio">` Is there a filter snippet somewhere that has a list of all the classes and I can then just uncomment the...
You can configure the `$whitelist` array in this function to filter out all other unwanted classes. ``` add_filter( 'body_class', 'wpse15850_body_class', 10, 2 ); function wpse15850_body_class( $wp_classes, $extra_classes ) { // List of the only WP generated classes allowed $whitelist = array( 'portfolio', '...
15,855
<p>I'm creating a child theme off of wp-framework and in it's header it uses </p> <pre><code>&lt;?php echo IMAGES . '/favicon.ico'; ?&gt; </code></pre> <p>to recall the folder where images are kept.</p> <p>How do I define or create the location in order to recall it using echo IMAGES?</p> <p>and if I can save the i...
[ { "answer_id": 15857, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 1, "selected": false, "text": "<p>If you need to define/redefine a constant:</p>\n\n<pre><code>define( 'IMAGES', 'path/to/images/directory' )...
2011/04/28
[ "https://wordpress.stackexchange.com/questions/15855", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4871/" ]
I'm creating a child theme off of wp-framework and in it's header it uses ``` <?php echo IMAGES . '/favicon.ico'; ?> ``` to recall the folder where images are kept. How do I define or create the location in order to recall it using echo IMAGES? and if I can save the image folder location as IMAGES (If I recall it...
Many WordPress frameworks include helper functions and pre-defined folder locations. WP Framework is very well coded but requires some learning and inspecting the code to find the documentation. In the file core.php many constants are defined but I did not see IMAGES but THEME\_IMAGE is defined so it is likely that IM...
15,864
<p>hey guys, is it possible to format text in a custom field input box automatically with paragraphs?</p> <p>e.g. like the normal text-widget that has the option to say "auto-add paragraphs" when there is a linebreak.</p> <p>I just want my blogauthors to spare typing <br/> at the end of every line in a custom field!<...
[ { "answer_id": 15866, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 1, "selected": false, "text": "<p>Can you pass the user-input data through <code>wpautop()</code> (<a href=\"http://codex.wordpress.org/Funct...
2011/04/28
[ "https://wordpress.stackexchange.com/questions/15864", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3529/" ]
hey guys, is it possible to format text in a custom field input box automatically with paragraphs? e.g. like the normal text-widget that has the option to say "auto-add paragraphs" when there is a linebreak. I just want my blogauthors to spare typing at the end of every line in a custom field! is there a way to ...
Why don't you use `apply_filters( 'the_content', $var );` when outputting your custom field? You don't really want to **save** the extra paragraphs, otherwise you'll end up seeing them when editing the custom field. This is not what happens with WordPress. If you're not happy with what `the_content` does (it does a lo...