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
18,769
<p>I've set up my loop-attachment.php to show the gallery of thumbnails above the main, selected image using this code from the WordPress Codex:</p> <pre><code>&lt;?php $gallery_shortcode = '[gallery id="' . intval( $post-&gt;post_parent ) . '" size="mini-thumbnail" columns="10"]'; print apply_filters( 'the_co...
[ { "answer_id": 18776, "author": "xLRDxREVENGEx", "author_id": 4998, "author_profile": "https://wordpress.stackexchange.com/users/4998", "pm_score": 2, "selected": true, "text": "<p>you can always just set a css tag <code>display:none</code> to the caption element</p>\n" }, { "ans...
2011/05/31
[ "https://wordpress.stackexchange.com/questions/18769", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2256/" ]
I've set up my loop-attachment.php to show the gallery of thumbnails above the main, selected image using this code from the WordPress Codex: ``` <?php $gallery_shortcode = '[gallery id="' . intval( $post->post_parent ) . '" size="mini-thumbnail" columns="10"]'; print apply_filters( 'the_content', $gallery_sho...
you can always just set a css tag `display:none` to the caption element
18,770
<p>I want to use the query_posts() function to limit the posts to all but the most recent on one of my templates. This is because the most recent post is a featured item alone on it's own page where as the rest of the posts are to be on another page. It was easy enough to display the most recent one on one of my templa...
[ { "answer_id": 18771, "author": "John Hunt", "author_id": 4916, "author_profile": "https://wordpress.stackexchange.com/users/4916", "pm_score": 1, "selected": false, "text": "<p> 'Recipe of the Week', 'posts_per_page' => -1, 'offset' => 1)); ?></p>\n\n<p>I <em>think</em> this might do it...
2011/05/31
[ "https://wordpress.stackexchange.com/questions/18770", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4916/" ]
I want to use the query\_posts() function to limit the posts to all but the most recent on one of my templates. This is because the most recent post is a featured item alone on it's own page where as the rest of the posts are to be on another page. It was easy enough to display the most recent one on one of my template...
I had to use the WP\_Query class: ``` $the_query = new WP_Query(array( 'category_name' => 'Recipe of the Week', 'offset' => 1 ) ``` And then reference my new query object in the template like this: ``` <?php while ( $the_query-> have_posts() ) : $the_query->the_post(); ?> ```
18,787
<p>How do we get posts where the meta key does not exist in a post. I have created a meta_key video. and i want to be able to get some posts with WP_Query where custom field video does not exist or is blank.</p> <pre><code>$fsquery = new WP_Query( array ( 'posts_per_pa...
[ { "answer_id": 18835, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 1, "selected": false, "text": "<p>You can use <code>posts_where</code> filter hook and create a Subquery to exclude all posts with the meta_key...
2011/05/31
[ "https://wordpress.stackexchange.com/questions/18787", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5823/" ]
How do we get posts where the meta key does not exist in a post. I have created a meta\_key video. and i want to be able to get some posts with WP\_Query where custom field video does not exist or is blank. ``` $fsquery = new WP_Query( array ( 'posts_per_page' => 1, ...
There's actually a better solution that will (hopefully) be rolling out in WordPress 3.4 -- you can run the patch as a hotfix now if you'd like, but here's the TRAC link for the patch: <http://core.trac.wordpress.org/ticket/18158> With this, you can do ... ``` $my_query = new WP_Query( array( ...
18,799
<p>How could you display all the post in a loop with a (custom) meta_value containing a word/phrase? for exemple get al the post where meta contains 'test'.</p> <pre><code>query_posts('post_type=SOME&amp;category_name_2=SOME&amp;meta_value= 'Cotains the word 'test' ??? '); </code></pre> <p>so when the meta tags are ...
[ { "answer_id": 18953, "author": "Boldhand", "author_id": 5315, "author_profile": "https://wordpress.stackexchange.com/users/5315", "pm_score": 1, "selected": false, "text": "<p>by Using \"Custom select query\"</p>\n\n<pre><code>&lt;?php\n\n $querystr = \"\n SELECT wposts.* \n FROM ...
2011/05/31
[ "https://wordpress.stackexchange.com/questions/18799", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5826/" ]
How could you display all the post in a loop with a (custom) meta\_value containing a word/phrase? for exemple get al the post where meta contains 'test'. ``` query_posts('post_type=SOME&category_name_2=SOME&meta_value= 'Cotains the word 'test' ??? '); ``` so when the meta tags are 'test movie' or just 'test' you g...
No need for a custom query. Since 3.1, you can use a 'meta query'; ``` query_posts( array( 'meta_query' => array( array( 'key' => 'meta_key_name', 'value' => 'test', 'compare' => 'LIKE' ) ) ) ); ``` Check out [the codex on custom field parameters](http://c...
18,824
<p>I'm creating my own form based on <a href="https://wordpress.stackexchange.com/questions/15283/i-am-trying-to-create-a-simple-frontend-form-for-posting/15288#15288">this</a> and I'd like to have a tag selector which is similar to the one on StackExchange. I can roll my own but I was wondering if something similar al...
[ { "answer_id": 18826, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 2, "selected": false, "text": "<p>Look at the code for the tag box in <code>wp-admin/includes/meta-boxes.php</code> and the function <code>tagBox</code>...
2011/05/31
[ "https://wordpress.stackexchange.com/questions/18824", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4284/" ]
I'm creating my own form based on [this](https://wordpress.stackexchange.com/questions/15283/i-am-trying-to-create-a-simple-frontend-form-for-posting/15288#15288) and I'd like to have a tag selector which is similar to the one on StackExchange. I can roll my own but I was wondering if something similar already exists. ...
you can do that using [**JQuery autocomplete plugin**](http://docs.jquery.com/Plugins/autocomplete#Example) and once you have included all of the needed JS files just add this code after your new post form ``` $terms = get_terms("post_tag"); $tags = ''; $count = count($terms); if ( $count > 0 ){ foreach ( $ter...
18,825
<p>On the Facebook Developer page they say the comments counts can be displayed using</p> <pre><code>&lt;fb:comments-count href=http://example.com/&gt;&lt;/fb:comments-count&gt; awesome comments </code></pre> <p>I added this to my loop then:</p> <pre><code>&lt;fb:comments-count href=&lt;?php the_permalink();?&gt;&gt...
[ { "answer_id": 18834, "author": "chrisjlee", "author_id": 5149, "author_profile": "https://wordpress.stackexchange.com/users/5149", "pm_score": 1, "selected": false, "text": "<p>You need to include their <a href=\"https://github.com/facebook/php-sdk\" rel=\"nofollow\">Facebook SDK</a> in...
2011/05/31
[ "https://wordpress.stackexchange.com/questions/18825", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2618/" ]
On the Facebook Developer page they say the comments counts can be displayed using ``` <fb:comments-count href=http://example.com/></fb:comments-count> awesome comments ``` I added this to my loop then: ``` <fb:comments-count href=<?php the_permalink();?>></fb:comments-count> ``` to display the comments count per...
You need to include their [Facebook SDK](https://github.com/facebook/php-sdk) in order to utilize fbml. FBML is also [deprecated](http://developers.facebook.com/docs/reference/fbml/) for use of xFBML. In this case, i would just recommend picking a wordpress / facebook plugin for what you need to do. As what you're ...
18,838
<p>I am trying to write a function for my functions.php file. I has to do the following;</p> <ul> <li>loop through search results and check the template</li> <li>if the template is 'landing.php' add it to ad array</li> <li>use the id's collected in the array to exclude these pages from the search results.</li> </ul> ...
[ { "answer_id": 18834, "author": "chrisjlee", "author_id": 5149, "author_profile": "https://wordpress.stackexchange.com/users/5149", "pm_score": 1, "selected": false, "text": "<p>You need to include their <a href=\"https://github.com/facebook/php-sdk\" rel=\"nofollow\">Facebook SDK</a> in...
2011/05/31
[ "https://wordpress.stackexchange.com/questions/18838", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5827/" ]
I am trying to write a function for my functions.php file. I has to do the following; * loop through search results and check the template * if the template is 'landing.php' add it to ad array * use the id's collected in the array to exclude these pages from the search results. I found some code on the Wordpress Code...
You need to include their [Facebook SDK](https://github.com/facebook/php-sdk) in order to utilize fbml. FBML is also [deprecated](http://developers.facebook.com/docs/reference/fbml/) for use of xFBML. In this case, i would just recommend picking a wordpress / facebook plugin for what you need to do. As what you're ...
18,845
<p>I need to send an email from a page when a form is submitted.</p> <p>I thought I'd use jQuery post but I'm not really sure where to start. Would I use <code>wp_mail()</code>? And if so how could it be called?</p> <p>Sorry if that seems vague. Just trying to send an email to the client before a form posts its data ...
[ { "answer_id": 18895, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 3, "selected": true, "text": "<p>Basically, you can use JavaScript to post to a WordPress function, then the WordPress function can invoke <code>wp_mai...
2011/05/31
[ "https://wordpress.stackexchange.com/questions/18845", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3978/" ]
I need to send an email from a page when a form is submitted. I thought I'd use jQuery post but I'm not really sure where to start. Would I use `wp_mail()`? And if so how could it be called? Sorry if that seems vague. Just trying to send an email to the client before a form posts its data to another site; ``` $('#do...
Basically, you can use JavaScript to post to a WordPress function, then the WordPress function can invoke `wp_mail()` to send the message. A great place to start would be the useful [AJAX in Plugins](http://codex.wordpress.org/AJAX_in_Plugins) article on the Codex. It walks you through all the steps required to add yo...
18,853
<p>im using <a href="http://codex.wordpress.org/Function_Reference/paginate_links" rel="nofollow"><strong>paginate_links function</strong></a> to create pagination on my custom post type archives, no matter what i do im hitting 404 errors when going to view page 2 (ie clicking to go on one page in the pagination trail)...
[ { "answer_id": 18931, "author": "MartinJJ", "author_id": 3710, "author_profile": "https://wordpress.stackexchange.com/users/3710", "pm_score": 3, "selected": true, "text": "<p>If anyone else as the same issue my full workaround is:<br>\n 1) in wp-admin >> settings >> reading set blog pos...
2011/05/31
[ "https://wordpress.stackexchange.com/questions/18853", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3710/" ]
im using [**paginate\_links function**](http://codex.wordpress.org/Function_Reference/paginate_links) to create pagination on my custom post type archives, no matter what i do im hitting 404 errors when going to view page 2 (ie clicking to go on one page in the pagination trail). I've checked and researched and dont s...
If anyone else as the same issue my full workaround is: 1) in wp-admin >> settings >> reading set blog posts to show as 1. 2) then override this in loop-blog.php to posts\_per\_page => 10. 3) in your custom post type loop.php files set posts\_per\_page => 5. Remember these are the settings that i require,...
18,854
<p>I have a theme that I'm developing from an HTML template I have. I'm also designing an options page along with a plethora of plugins built-into the theme itself. I've chosen a tabbed interface and I'm trying to learn how to use WordPress' Settings API.</p> <p>I'm using a class structure for the theme's functions. T...
[ { "answer_id": 18857, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 3, "selected": true, "text": "<p>The <code>do_settings_section()</code> function call needs to correspond to the <code>$optiongroup</code> ar...
2011/05/31
[ "https://wordpress.stackexchange.com/questions/18854", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2322/" ]
I have a theme that I'm developing from an HTML template I have. I'm also designing an options page along with a plethora of plugins built-into the theme itself. I've chosen a tabbed interface and I'm trying to learn how to use WordPress' Settings API. I'm using a class structure for the theme's functions. The followi...
The `do_settings_section()` function call needs to correspond to the `$optiongroup` argument you pass to `register_setting()`. To see how all of the myriad functions fit together, see [page 10 of my tutorial](http://www.chipbennett.net/2011/02/17/incorporating-the-settings-api-in-wordpress-themes/4/). It does get fair...
18,855
<p>i would like to call a php page from an Ajax method : the alert works fine, the code as well has been tested outside of wordpress, but here it seems that the php page is never called.</p> <p>I found some articles, among them : <a href="https://wordpress.stackexchange.com/questions/3610/how-to-manage-ajax-calls-and-...
[ { "answer_id": 18876, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>Calling PHP file directly is more generic way to implement Ajax and should not be used in WordPress.</p>\n\n<p>See <...
2011/05/31
[ "https://wordpress.stackexchange.com/questions/18855", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5644/" ]
i would like to call a php page from an Ajax method : the alert works fine, the code as well has been tested outside of wordpress, but here it seems that the php page is never called. I found some articles, among them : [How to manage ajax calls and JSON in wordpress](https://wordpress.stackexchange.com/questions/3610...
To use the WordPress ajax url you can pass the var using wp\_localize\_script: ``` wp_enqueue_script( 'functions', get_bloginfo( 'stylesheet_directory' ) . '/js/functions.js', array( 'jquery' ), false); wp_localize_script( 'functions', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) ); ``` In your ...
18,856
<p>OK, I got a custom post type with thumbnail enabled which adds the "featured images" panel to that post-type just fine, but in my template when I do </p> <pre><code>if ( has_post_thumbnail() ) { the_post_thumbnail(); } else { echo 'none'; } </code></pre> <p>it just shows 'none' on each one even though I ha...
[ { "answer_id": 18858, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 3, "selected": true, "text": "<p>In your Custom Post Type, do you <code>setup_postdata( $post )</code> in your custom Loop? If not, <code>has...
2011/05/31
[ "https://wordpress.stackexchange.com/questions/18856", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4114/" ]
OK, I got a custom post type with thumbnail enabled which adds the "featured images" panel to that post-type just fine, but in my template when I do ``` if ( has_post_thumbnail() ) { the_post_thumbnail(); } else { echo 'none'; } ``` it just shows 'none' on each one even though I have a featured image set......
In your Custom Post Type, do you `setup_postdata( $post )` in your custom Loop? If not, `has_post_thumbnail()` might not be defined/available? EDIT: Try adding: ``` setup_postdata( $post ); ``` Right before: ``` $loop->the_post(); ``` And then see if `has_post_thumbnail()` returns `true`? Or, try passing the `...
18,864
<p>I have this CSS setup for my blog posts meta information. But there are certain categories where I would like to use another image in the same spot and not display the meta information. I'm not quite sure how to do it.</p> <pre><code>.entry-meta { background: url("images/dish_blogtitle.png") no-repeat scroll center...
[ { "answer_id": 18869, "author": "xLRDxREVENGEx", "author_id": 4998, "author_profile": "https://wordpress.stackexchange.com/users/4998", "pm_score": 0, "selected": false, "text": "<p>You are doing it write but you should think about looking into WordPress template hierarchy structure. Che...
2011/05/31
[ "https://wordpress.stackexchange.com/questions/18864", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4273/" ]
I have this CSS setup for my blog posts meta information. But there are certain categories where I would like to use another image in the same spot and not display the meta information. I'm not quite sure how to do it. ``` .entry-meta { background: url("images/dish_blogtitle.png") no-repeat scroll center center transp...
**Have you checked the classes on your `<body>` element?** It depends on the theme but WordPress has a function [body\_class()](http://codex.wordpress.org/Function_Reference/body_class) that dynamically adds a bunch of useful classes in there. It may look like this: ``` <body class="archive category category-news cat...
18,865
<p>I'm trying to write a php script that I can run out of cron to create new Wordpress pages.</p> <p>Unfortunately, I can't find any documentation on how to do this. I'm using the WP scripts rather than directly manipulating the SQL...but still no joy. The below runs with no errors...but also produces no pages. I a...
[ { "answer_id": 18866, "author": "Louis Stephens", "author_id": 807, "author_profile": "https://wordpress.stackexchange.com/users/807", "pm_score": 0, "selected": false, "text": "<p>Maybe I am off, but what are you needing this cron script for? I know you can set a publish date for pages/...
2011/05/31
[ "https://wordpress.stackexchange.com/questions/18865", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I'm trying to write a php script that I can run out of cron to create new Wordpress pages. Unfortunately, I can't find any documentation on how to do this. I'm using the WP scripts rather than directly manipulating the SQL...but still no joy. The below runs with no errors...but also produces no pages. I am sad. Anyon...
You should be including this file: ``` include( "/some/path/wordpress/wp-config.php" ); ``` That'll get you to where you can use the wp\_insert\_post() function. If this is a multi-site blog, make sure to use the switch\_to\_blog() function first.
18,878
<p>How can I instruct NextGen Gallery to use different thumbnail sizes for different galleries. I have different gallery templates for use in different parts of the site, and the sizes of the thumbnails are not the same. At the moment I have to stay generating the thumbnails through the gallery management page, it woul...
[ { "answer_id": 52879, "author": "Michael Ecklund", "author_id": 9579, "author_profile": "https://wordpress.stackexchange.com/users/9579", "pm_score": 3, "selected": true, "text": "<h2>Templates</h2>\n\n<p>The most important feature improvement in Version 1.00 is the template engine. Cust...
2011/05/31
[ "https://wordpress.stackexchange.com/questions/18878", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5844/" ]
How can I instruct NextGen Gallery to use different thumbnail sizes for different galleries. I have different gallery templates for use in different parts of the site, and the sizes of the thumbnails are not the same. At the moment I have to stay generating the thumbnails through the gallery management page, it would b...
Templates --------- The most important feature improvement in Version 1.00 is the template engine. Custom templates are PHP files that can be stored in the folder nggallery, inside your theme directory. NextGEN gallery look up always first into this folder if there are the vaild template file. For example, if you are ...
18,901
<p><a href="http://pippinspages.com/tutorials/publish-action-hook-for-custom-post-types/" rel="nofollow">Pippin</a> and <a href="http://www.catswhocode.com/blog/wordpress-how-to-insert-data-programmatically" rel="nofollow">Jean-Baptiste Jung</a> have very good tutorials on how to programmatically create content when a...
[ { "answer_id": 18905, "author": "Michal Mau", "author_id": 2110, "author_profile": "https://wordpress.stackexchange.com/users/2110", "pm_score": 2, "selected": false, "text": "<p>These two might be your friends:</p>\n\n<pre><code>add_action('edit_post','your_action');\n\nadd_action('pre_...
2011/06/01
[ "https://wordpress.stackexchange.com/questions/18901", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1057/" ]
[Pippin](http://pippinspages.com/tutorials/publish-action-hook-for-custom-post-types/) and [Jean-Baptiste Jung](http://www.catswhocode.com/blog/wordpress-how-to-insert-data-programmatically) have very good tutorials on how to programmatically create content when a new post is published using these four actions hooks......
you can use `pre_post_update` action hook like so: ``` add_action('pre_post_update','post_updating_callback'); function post_updating_callback($post_id){ global $post; // verify if this is an auto save routine. // If it is our form has not been submitted, so we dont want to do anything if ( defined( '...
18,911
<p>How can I exclude the child term posts from showing up in the parent term posts output?? Right now it's duplicating in both parent and child term outputs.</p> <pre><code> //Function to display posts grouped by taxonomies function display_posts_per_taxonomies($parent_term, $post_type = 'beat_posts', $taxonomy =...
[ { "answer_id": 18905, "author": "Michal Mau", "author_id": 2110, "author_profile": "https://wordpress.stackexchange.com/users/2110", "pm_score": 2, "selected": false, "text": "<p>These two might be your friends:</p>\n\n<pre><code>add_action('edit_post','your_action');\n\nadd_action('pre_...
2011/06/01
[ "https://wordpress.stackexchange.com/questions/18911", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5698/" ]
How can I exclude the child term posts from showing up in the parent term posts output?? Right now it's duplicating in both parent and child term outputs. ``` //Function to display posts grouped by taxonomies function display_posts_per_taxonomies($parent_term, $post_type = 'beat_posts', $taxonomy = 'beats'){ ...
you can use `pre_post_update` action hook like so: ``` add_action('pre_post_update','post_updating_callback'); function post_updating_callback($post_id){ global $post; // verify if this is an auto save routine. // If it is our form has not been submitted, so we dont want to do anything if ( defined( '...
18,913
<p>I'm not sure whats wrong with this line. Have I place this incorrectly? How do I get it to recognize the $yourcat->slug;</p> <pre><code> $cat = get_query_var('cat'); $yourcat = get_category ($cat); $uri = $_SERVER['REQUEST_URI']; if (($uri == '/category/$yourcat-&gt;slug;') { </code></pre>
[ { "answer_id": 18905, "author": "Michal Mau", "author_id": 2110, "author_profile": "https://wordpress.stackexchange.com/users/2110", "pm_score": 2, "selected": false, "text": "<p>These two might be your friends:</p>\n\n<pre><code>add_action('edit_post','your_action');\n\nadd_action('pre_...
2011/06/01
[ "https://wordpress.stackexchange.com/questions/18913", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5853/" ]
I'm not sure whats wrong with this line. Have I place this incorrectly? How do I get it to recognize the $yourcat->slug; ``` $cat = get_query_var('cat'); $yourcat = get_category ($cat); $uri = $_SERVER['REQUEST_URI']; if (($uri == '/category/$yourcat->slug;') { ```
you can use `pre_post_update` action hook like so: ``` add_action('pre_post_update','post_updating_callback'); function post_updating_callback($post_id){ global $post; // verify if this is an auto save routine. // If it is our form has not been submitted, so we dont want to do anything if ( defined( '...
18,940
<p>Any Short code Availble for <strong><a href="http://wordpress.org/extend/plugins/get-post-list-with-thumbnails/" rel="nofollow">Get Post List With Thumbnail</a></strong> Plugin? or else how to Create Short code for this Particular plugin? Thank u in Advance.</p>
[ { "answer_id": 18948, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": true, "text": "<p>here is a quick crack at making it a shortcode paste this code in your theme's functions.php file:</p>\n\n<pre...
2011/06/01
[ "https://wordpress.stackexchange.com/questions/18940", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5669/" ]
Any Short code Availble for **[Get Post List With Thumbnail](http://wordpress.org/extend/plugins/get-post-list-with-thumbnails/)** Plugin? or else how to Create Short code for this Particular plugin? Thank u in Advance.
here is a quick crack at making it a shortcode paste this code in your theme's functions.php file: ``` add_shortcode('gplt','getPostListThumbs_shortcode'); function getPostListThumbs_shortcode($atts, $content = null){ extract(shortcode_atts(array( 'orient' => 'v', 'imgo' => false, 'ttgo' =...
18,942
<p>I have a simple custom widget that asks for its width (that is used later in the front end). The width field is a select dropdown, so a user have predefined options.</p> <p>I will have many instances of my widget, each will have its own width setup.</p> <p>Now, in my widget code I have the following code:</p> <pr...
[ { "answer_id": 18945, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 4, "selected": false, "text": "<p>you can use <code>dynamic_sidebar_params</code> filter hook to find your widget and add your classes to it:</...
2011/06/01
[ "https://wordpress.stackexchange.com/questions/18942", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1343/" ]
I have a simple custom widget that asks for its width (that is used later in the front end). The width field is a select dropdown, so a user have predefined options. I will have many instances of my widget, each will have its own width setup. Now, in my widget code I have the following code: ``` echo $before_widget;...
Aha, so the `$before_widget` variable is a string representing div element: `<div class="widget my" id="my-widget-1">` . So I checked the `$before_widget` for the "class" sub-string and added my `$widget_width` value to it. The code is from my custom widget file: ``` function widget( $args, $instance ) { extract( $...
18,950
<p>I'd like to create a front page video feature that embeds a vimeo video of the users choosing. I'd like the user to only have to input the video code. For instance, for <a href="http://vimeo.com/24474320" rel="nofollow">http://vimeo.com/24474320</a> - I'd like them only to have to input "24474320".</p> <p>Should ...
[ { "answer_id": 18962, "author": "Dougal Campbell", "author_id": 65, "author_profile": "https://wordpress.stackexchange.com/users/65", "pm_score": 3, "selected": true, "text": "<p>With oEmbed support in both WordPress and on Vimeo's end, why not just use the <code>[embed]</code> shortcode...
2011/06/01
[ "https://wordpress.stackexchange.com/questions/18950", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5861/" ]
I'd like to create a front page video feature that embeds a vimeo video of the users choosing. I'd like the user to only have to input the video code. For instance, for <http://vimeo.com/24474320> - I'd like them only to have to input "24474320". Should I use custom post types for this? If so, how do I set this up so ...
With oEmbed support in both WordPress and on Vimeo's end, why not just use the `[embed]` shortcode? ``` [embed]http://vimeo.com/24474320[/embed] ``` This is easy to explain, and users are generally pretty comfortable with just copy-and-pasting a URL directly, rather than having to extract just the ID out of it. You...
18,968
<p>We have the <a href="https://wordpress.stackexchange.com/questions/1567/best-collection-of-code-for-your-functions-php-file">Best Collection of Code for your functions.php file</a> thread, so I thought that it might be useful to create a thread for our .htaccess files.</p> <p><strong>AND PLEASE REMEMBER TO ADD ANY O...
[ { "answer_id": 18996, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 3, "selected": false, "text": "<h2>Redirects and pretty permalinks without mod_rewrite</h2>\n\n<pre><code># - script kiddies\n\nRedirect permanent /admi...
2011/06/01
[ "https://wordpress.stackexchange.com/questions/18968", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/10/" ]
We have the [Best Collection of Code for your functions.php file](https://wordpress.stackexchange.com/questions/1567/best-collection-of-code-for-your-functions-php-file) thread, so I thought that it might be useful to create a thread for our .htaccess files. **AND PLEASE REMEMBER TO ADD ANY OF YOUR OWN SNIPPETS TO THI...
These are 3 snippet for better performance, regarding Yahoo! rules: **Disable Etags:** ``` Header unset ETag FileETag None ``` **Add expire headers:** ``` <FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$"> Header set Expires "Tue, 16 Jun 2020 20:00:00 GMT" </FilesMatch> ``` Or ``` ExpiresActive On ExpiresByTyp...
18,973
<p>I have a script that's called from my functions.php file (via an ajax .get) that needs to have access to WP's get_option() method in order to retrieve some values it needs to process.</p> <p>However, although the file works great in the majority of sites where it resides, on just a few installations, I'm having pro...
[ { "answer_id": 18974, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 3, "selected": true, "text": "<p>You shouldn't need to make direct calls to your theme files - use the AJAX API, and make all requests to <co...
2011/06/01
[ "https://wordpress.stackexchange.com/questions/18973", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
I have a script that's called from my functions.php file (via an ajax .get) that needs to have access to WP's get\_option() method in order to retrieve some values it needs to process. However, although the file works great in the majority of sites where it resides, on just a few installations, I'm having problems wit...
You shouldn't need to make direct calls to your theme files - use the AJAX API, and make all requests to `admin-ajax.php` (that way, WordPress'll be loaded for you, and you won't need to assume the file hierarchy in order to load it manually). ``` $.get( '<?php echo admin_url( 'admin-ajax.php' ) ?>', { ...
18,983
<p>I'm looking for a way to display a plain-text list of tags to use as classes on my post elements, I've been trying </p> <pre><code>$tags = get_tags(); $tag_list = ""; foreach($tags as $tag){ $tag_list .= $tag-&gt;name . " "; } echo "&lt;li class=\"$tag_list\"&gt;"; </code></pre> <p>in the loop but it seems to ...
[ { "answer_id": 18985, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 1, "selected": false, "text": "<p>Use <a href=\"http://codex.wordpress.org/Function_Reference/wp_get_post_tags\" rel=\"nofollow\"><strong>wp_ge...
2011/06/01
[ "https://wordpress.stackexchange.com/questions/18983", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4114/" ]
I'm looking for a way to display a plain-text list of tags to use as classes on my post elements, I've been trying ``` $tags = get_tags(); $tag_list = ""; foreach($tags as $tag){ $tag_list .= $tag->name . " "; } echo "<li class=\"$tag_list\">"; ``` in the loop but it seems to output all the tags instead of just...
You can play with arguments to only fetch what you need and get rid of loop: ``` $classes = implode(' ', wp_get_post_tags( get_the_ID(), array('fields' => 'names') ) ); ```
19,000
<p>I'm getting the following warning in my WP admin custom posts listings page (<code>wp-admin/edit.php?post_type=video</code>)</p> <pre> Warning: Illegal offset type in isset or empty in wp-includes/post.php on line 817 </pre> <p>I'm running WordPress v3.1.3 (latest). Line 817 is <a href="http://core.trac.wordpress....
[ { "answer_id": 19217, "author": "Temo", "author_id": 5925, "author_profile": "https://wordpress.stackexchange.com/users/5925", "pm_score": 1, "selected": false, "text": "<p>I had the same Error. It occured because I requested a post-type that didn't existed.</p>\n\n<pre><code>add_filter(...
2011/06/01
[ "https://wordpress.stackexchange.com/questions/19000", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4642/" ]
I'm getting the following warning in my WP admin custom posts listings page (`wp-admin/edit.php?post_type=video`) ``` Warning: Illegal offset type in isset or empty in wp-includes/post.php on line 817 ``` I'm running WordPress v3.1.3 (latest). Line 817 is [in the function `get_post_type_object()`](http://core.trac....
I had the same Error. It occured because I requested a post-type that didn't existed. ``` add_filter( 'pre_get_posts', 'my_get_posts' ); //events don't exists function my_get_posts( $query ) { $query->set( 'post_type', array( 'post', 'page', 'events' ) ); return $query; } ```
19,029
<p>I'm attempting to remove the title attribute for post thumbnails (on certain posts), and I assume the get_image_tag filter is the way to do this. However, what I've got so far isn't working. What do I need to change to make this work? My code:</p> <pre><code>add_filter('get_image_tag', 'image_no_title'); function i...
[ { "answer_id": 19034, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>Filter always affect first argument, rest are there for additional info and not even passed by default.</p>\n\n<pre>...
2011/06/02
[ "https://wordpress.stackexchange.com/questions/19029", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/49/" ]
I'm attempting to remove the title attribute for post thumbnails (on certain posts), and I assume the get\_image\_tag filter is the way to do this. However, what I've got so far isn't working. What do I need to change to make this work? My code: ``` add_filter('get_image_tag', 'image_no_title'); function image_no_titl...
Thanks to Rarst pointing out that I was in the wrong place, I did some more digging and ended up with this: ``` add_filter('wp_get_attachment_image_attributes', 'wpse_19029_no_image_title'); function wpse_19029_no_image_title ($attr) { unset($attr['title']); return $attr; } ```
19,040
<p>Is there a way to have Wordpress email me whenever a Page or Post is Published?</p>
[ { "answer_id": 19041, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>Sure, you will need to use appropriate <a href=\"http://codex.wordpress.org/Post_Status_Transitions\" rel=\"nofollow...
2011/06/02
[ "https://wordpress.stackexchange.com/questions/19040", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2001/" ]
Is there a way to have Wordpress email me whenever a Page or Post is Published?
There's a [few plugins that handle email notifications](http://www.google.co.uk/search?q=wordpress%20email%20notification), but they all seem to act like a subscription service for (all) WordPress users. To notify just *you* when a post or page is published: ``` /** * Send an email notification to the administrator ...
19,064
<p>I have been following <a href="http://goldenapplesdesign.com/2010/07/03/front-end-file-uploads-in-wordpress/" rel="nofollow"><strong>goldenapples front end file uploads</strong></a> tutorial, however i do have that working for my frontend posting page, but what i am wanting to accomplish now is to add an image from ...
[ { "answer_id": 19076, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": false, "text": "<p>the problem is in this line :</p>\n\n<pre><code>$attach_id = media_handle_upload( $file_handler, $user_id );\...
2011/06/02
[ "https://wordpress.stackexchange.com/questions/19064", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3710/" ]
I have been following [**goldenapples front end file uploads**](http://goldenapplesdesign.com/2010/07/03/front-end-file-uploads-in-wordpress/) tutorial, however i do have that working for my frontend posting page, but what i am wanting to accomplish now is to add an image from edit profile page (again this is a fronten...
Actually got around it by making a plugin that can either shortcode a hook into a user edit page from frontend or by using a seperate shortcode in a sidebar. Below is the crux of it, just need to do some bits and bobs with the error reporting. ``` require(ABSPATH . WPINC . '/pluggable.php'); define('WP-AUTHOR-LOGO_V...
19,068
<p>Here's the code I'm using to try and query a single taxonomy for one term, but exclude returned posts for that term that also belong to another.</p> <p>In English, this is what I want: query 'resource-type' for 'testimonies', but not 'testimonies' that are also 'audio'.</p> <p>Tips to tweak this code to get it to ...
[ { "answer_id": 19077, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": true, "text": "<p>I guess its because you are trying two conditions on one taxonomy, you can allways create a custom sql query, ...
2011/06/02
[ "https://wordpress.stackexchange.com/questions/19068", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3293/" ]
Here's the code I'm using to try and query a single taxonomy for one term, but exclude returned posts for that term that also belong to another. In English, this is what I want: query 'resource-type' for 'testimonies', but not 'testimonies' that are also 'audio'. Tips to tweak this code to get it to work? ``` <?php ...
I guess its because you are trying two conditions on one taxonomy, you can allways create a custom sql query, something like this: ``` $querystr = " SELECT * FROM $wpdb->posts LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_re...
19,071
<p>I disabled the posts revision feature according to this <a href="http://codex.wordpress.org/Editing_wp-config.php#Disable_Post_Revisions" rel="nofollow">codex</a> by placing this code in the wp-config.php:</p> <p><code>define('WP_POST_REVISIONS', false );</code></p> <p>But revions are still being saved by the WP. ...
[ { "answer_id": 19077, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": true, "text": "<p>I guess its because you are trying two conditions on one taxonomy, you can allways create a custom sql query, ...
2011/06/02
[ "https://wordpress.stackexchange.com/questions/19071", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5021/" ]
I disabled the posts revision feature according to this [codex](http://codex.wordpress.org/Editing_wp-config.php#Disable_Post_Revisions) by placing this code in the wp-config.php: `define('WP_POST_REVISIONS', false );` But revions are still being saved by the WP. Why? I am using wp3.1.3 and Twenty Ten theme. I have ...
I guess its because you are trying two conditions on one taxonomy, you can allways create a custom sql query, something like this: ``` $querystr = " SELECT * FROM $wpdb->posts LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_re...
19,084
<p>There's a lot of documentation on how to style 'autor' or 'admin' comments in WP, but most of it seems wildly outdated. </p> <p>I have a client for whom I am developing a Q&amp;A site. I always figure it's best to use whatever tools Wordpress has already provided me with. That's why I decided to set up a form which...
[ { "answer_id": 19177, "author": "Lynne", "author_id": 2479, "author_profile": "https://wordpress.stackexchange.com/users/2479", "pm_score": 0, "selected": false, "text": "<p>I did figure this out. Though there may be a cleaner way to do it. I don't know.. Here is my new functions.php fil...
2011/06/03
[ "https://wordpress.stackexchange.com/questions/19084", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2479/" ]
There's a lot of documentation on how to style 'autor' or 'admin' comments in WP, but most of it seems wildly outdated. I have a client for whom I am developing a Q&A site. I always figure it's best to use whatever tools Wordpress has already provided me with. That's why I decided to set up a form which pushes all "q...
Why not use: ``` if ( user_can( $comment->user_id, 'administrator' ) ) { // current comment is from an administrator; // do something } ``` As for putting the admin comments at the top of the comment list, you would have to modify the comment query itself.
19,094
<p>i add this code in <code>index.php</code>. <code>&lt;div class="Div1"&gt;&lt;/div&gt;</code>. then write some css(absolution position) to the <code>Div1</code>. so when i login in my wordpress. the admin nav will push down some spaces to the site body. so the conetent shows unnormal. now, i want to add a <code>class...
[ { "answer_id": 19104, "author": "Geert", "author_id": 4936, "author_profile": "https://wordpress.stackexchange.com/users/4936", "pm_score": 2, "selected": false, "text": "<p>If you are using the <a href=\"http://codex.wordpress.org/Function_Reference/body_class\" rel=\"nofollow\"><code>b...
2011/06/03
[ "https://wordpress.stackexchange.com/questions/19094", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1962/" ]
i add this code in `index.php`. `<div class="Div1"></div>`. then write some css(absolution position) to the `Div1`. so when i login in my wordpress. the admin nav will push down some spaces to the site body. so the conetent shows unnormal. now, i want to add a `class` to `<div class="Div1">` when logins. is there a way...
If you are using the [`body_class()`](http://codex.wordpress.org/Function_Reference/body_class) function, a class `admin-bar` will be added automatically when the admin bar is active. For example: ``` <body class="home blog logged-in admin-bar"> ``` You can then use that class in your CSS to specify specific rules: ...
19,130
<p>I'm using this bit of code to generate a menu:</p> <pre><code> &lt;div id="menu"&gt; &lt;?php $args = array( 'depth' =&gt; 1, 'show_date' =&gt; '', 'date_format' =&gt; get_option('date_format'), 'child_of' =&gt; 0, 'exclude' =&gt; '426, 508', 'include' =&g...
[ { "answer_id": 19107, "author": "user782315", "author_id": 5897, "author_profile": "https://wordpress.stackexchange.com/users/5897", "pm_score": -1, "selected": false, "text": "<p>I Got Half Part of the code.Yes...Here it is...This Code Show's The Recent Post from Each Category but Not W...
2011/06/03
[ "https://wordpress.stackexchange.com/questions/19130", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4588/" ]
I'm using this bit of code to generate a menu: ``` <div id="menu"> <?php $args = array( 'depth' => 1, 'show_date' => '', 'date_format' => get_option('date_format'), 'child_of' => 0, 'exclude' => '426, 508', 'include' => '', 'title_li' => __(''), ...
I'm the developer of the [List Category Posts](http://wordpress.org/extend/plugins/list-category-posts/) WordPress plugin. The plugin uses a short code to get posts from a category and you can include thumbnails too. Give it a try and hopefully you'll find it useful.
19,156
<p>I am attempting to automate, as much as possible, the Settings API function calls for each setting in a Plugin. Looping through the options array, and outputting <code>add_settings_section()</code> and <code>add_settings_field()</code> is simple enough:</p> <p><code>add_settings_section()</code>:</p> <pre><code>$o...
[ { "answer_id": 19160, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 5, "selected": true, "text": "<p>if you look at the <a href=\"http://core.trac.wordpress.org/browser/tags/3.1.3/wp-admin/includes/template.php#...
2011/06/03
[ "https://wordpress.stackexchange.com/questions/19156", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3966/" ]
I am attempting to automate, as much as possible, the Settings API function calls for each setting in a Plugin. Looping through the options array, and outputting `add_settings_section()` and `add_settings_field()` is simple enough: `add_settings_section()`: ``` $oenology_hooks_tabs = oenology_hooks_get_settings_page_...
if you look at the [do\_settings\_sections](http://core.trac.wordpress.org/browser/tags/3.1.3/wp-admin/includes/template.php#L1164) function more specifically the line 1164 where the callback function is being executed : ``` call_user_func($section['callback'], $section); ``` you can see that the $section array is b...
19,161
<p>I am designing a theme where the home page (i.e. <code>is_home()</code>) should only display the latest blog post. I want to do something like <code>$wp_query-&gt;update_option('posts_per_page', 1)</code> every time I am on the home page. All other pages that display posts (like archives) should just follow the user...
[ { "answer_id": 19163, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 1, "selected": false, "text": "<p><code>posts_per_page</code> should be set once the at settings reading panel, and acts as a general option un...
2011/06/03
[ "https://wordpress.stackexchange.com/questions/19161", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5909/" ]
I am designing a theme where the home page (i.e. `is_home()`) should only display the latest blog post. I want to do something like `$wp_query->update_option('posts_per_page', 1)` every time I am on the home page. All other pages that display posts (like archives) should just follow the user defined option. This seems...
Alternate approach (if you want/need to keep this in functions.php and go via hooks instead of modifying template) would be something like this: ``` add_action( 'pre_get_posts', 'pre_get_posts_home' ); function pre_get_posts_home( $query ) { global $wp_query; if( $wp_query == $query && $query->is_home ) ...
19,162
<p>I want to know if there is a way that 2 different custom fields that have basicly the same value function to be combined.</p> <p>1) meta_name: my_link and meta_value: a link 2) meta_name: other_link and meta_value: other link</p> <p>It should work like this: The general call in my template is</p> <pre><code>&lt;?...
[ { "answer_id": 19164, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 1, "selected": false, "text": "<p>you can use the same meta_key for multiple values, for example:</p>\n\n<p><strong>meta_key</strong> - 'links'...
2011/06/03
[ "https://wordpress.stackexchange.com/questions/19162", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5910/" ]
I want to know if there is a way that 2 different custom fields that have basicly the same value function to be combined. 1) meta\_name: my\_link and meta\_value: a link 2) meta\_name: other\_link and meta\_value: other link It should work like this: The general call in my template is ``` <?php if ( get_post_meta($p...
you can use the same meta\_key for multiple values, for example: **meta\_key** - 'links' **meta\_value** - 'link1' **meta\_key** - 'links' **meta\_value** - 'link2' then you can get the meta as an array of links: ``` $links = get_post_meta($post->ID, 'links'); if ($links){ foreach ($links as $link){ ech...
19,169
<p>I have a client who has the categories listed in the right-hand sidebar. He came to me today requesting a different "navigation" in the header for each category. </p> <p>So basically, if you click on Category 1, the navigation changes to a set of pages (that he has set) and so on. </p> <p>Is this even possible? I...
[ { "answer_id": 19174, "author": "Michelle", "author_id": 16, "author_profile": "https://wordpress.stackexchange.com/users/16", "pm_score": 2, "selected": true, "text": "<p>You could set this in your theme using conditionals. Create a separate menu for each category using the WordPress me...
2011/06/03
[ "https://wordpress.stackexchange.com/questions/19169", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/807/" ]
I have a client who has the categories listed in the right-hand sidebar. He came to me today requesting a different "navigation" in the header for each category. So basically, if you click on Category 1, the navigation changes to a set of pages (that he has set) and so on. Is this even possible? I already have the ...
You could set this in your theme using conditionals. Create a separate menu for each category using the WordPress menu feature (Appearances > Menus). Then in your theme, where you want the menu to display, determine which menu to display using the is\_category('category-slug') and/or in\_category('category-slug') condi...
19,180
<p>In a previous question I asked how to add a column to the Posts page in the Administration section, and got a working answer. But now I need to know how to delete an existing column (e.g. the Date column) so that my customized Date column replaces it.</p>
[ { "answer_id": 19182, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 6, "selected": true, "text": "<pre><code>function my_manage_columns( $columns ) {\n unset($columns['date']);\n return $columns;\n}\n\nfunction my_c...
2011/06/03
[ "https://wordpress.stackexchange.com/questions/19180", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5913/" ]
In a previous question I asked how to add a column to the Posts page in the Administration section, and got a working answer. But now I need to know how to delete an existing column (e.g. the Date column) so that my customized Date column replaces it.
``` function my_manage_columns( $columns ) { unset($columns['date']); return $columns; } function my_column_init() { add_filter( 'manage_posts_columns' , 'my_manage_columns' ); } add_action( 'admin_init' , 'my_column_init' ); ```
19,181
<p>Interesting challenge. I was given a piece of code earlier, which I have modified as follows for the Posts page.</p> <pre><code>/* add time stamp */ add_filter('manage_posts_columns', 'posts_columns', 5); function posts_columns($defaults){ $defaults['your_date_col'] = __('Date'); $defaults['week_number'] = ...
[ { "answer_id": 19194, "author": "Matheus Eduardo", "author_id": 3575, "author_profile": "https://wordpress.stackexchange.com/users/3575", "pm_score": 0, "selected": false, "text": "<p>There is a explanation at top in <a href=\"http://codex.wordpress.org/Function_Reference/the_date\" rel=...
2011/06/03
[ "https://wordpress.stackexchange.com/questions/19181", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5913/" ]
Interesting challenge. I was given a piece of code earlier, which I have modified as follows for the Posts page. ``` /* add time stamp */ add_filter('manage_posts_columns', 'posts_columns', 5); function posts_columns($defaults){ $defaults['your_date_col'] = __('Date'); $defaults['week_number'] = __('Wk#'); ...
1) `the_date()` **echoes** the date value, so this statement isn't correct: ``` echo the_date('d M'); ``` It should be: ``` the_date('d M'); ``` 2) If you have some posts posted on the same date, `the_date()` will **show only the date value for the 1st post**. There will be no result for remained posts. To get d...
19,184
<p>What I'd like to do is have the entire row be a different color - for example, a light blue for draft posts. That way I can visually see at a glance what's a draft, what's scheduled, and what's published on a given time period (I am working on a system for scheduling posts out weeks in advance).</p> <p>It would see...
[ { "answer_id": 19188, "author": "xLRDxREVENGEx", "author_id": 4998, "author_profile": "https://wordpress.stackexchange.com/users/4998", "pm_score": 1, "selected": false, "text": "<p>Yes you can add this to your functions.php file on your current theme</p>\n\n<pre><code>&lt;?\nadd_action(...
2011/06/03
[ "https://wordpress.stackexchange.com/questions/19184", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5913/" ]
What I'd like to do is have the entire row be a different color - for example, a light blue for draft posts. That way I can visually see at a glance what's a draft, what's scheduled, and what's published on a given time period (I am working on a system for scheduling posts out weeks in advance). It would seem the logi...
you mean something like this? ![enter image description here](https://i.stack.imgur.com/6W8rE.png) then here you go: ``` add_action('admin_footer','style_posts_list'); function style_posts_list(){ ?> <style> .status-draft{background-color: #008866 !important;} .status-pending{background-color: #F53162 !important;} ....
19,203
<p>I have a custom post-type 'videos' and on the first page I have the first video styled differently than the next videos on the page. Basically I show the first video in a large format, while the rest of the videos on the page are small.</p> <p>Question:</p> <p>On page 2, 3, etc of the video post-type, I do not wan...
[ { "answer_id": 19230, "author": "Michael", "author_id": 4884, "author_profile": "https://wordpress.stackexchange.com/users/4884", "pm_score": 2, "selected": false, "text": "<p>i don't think there is anything easier than to use the <code>is_paged()</code> together with a counter;</p>\n\n<...
2011/06/04
[ "https://wordpress.stackexchange.com/questions/19203", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/370/" ]
I have a custom post-type 'videos' and on the first page I have the first video styled differently than the next videos on the page. Basically I show the first video in a large format, while the rest of the videos on the page are small. Question: On page 2, 3, etc of the video post-type, I do not want to have a large...
In response to your comment, `$wp_query->current_post` in action. Note that it's zero-indexed: ``` <?php if (have_posts()) : while (have_posts()) : the_post(); if($wp_query->current_post==0): echo "this is the first post"; else: echo "this is post number " . ($wp_query->current_post + 1); ...
19,206
<p>On edit.php, the main content is a list of posts, with columns including the published date.</p> <p>I'd like to change the date format of the published date <em>just on the admin page</em>. In this case, I don't want to change what the users see; I want to change what the admin sees.</p> <p>I want to add the day ...
[ { "answer_id": 19229, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 4, "selected": true, "text": "<ol>\n<li><p><a href=\"https://wordpress.stackexchange.com/questions/3531/how-can-i-add-columns-to-the-post-edit-listin...
2011/06/04
[ "https://wordpress.stackexchange.com/questions/19206", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5922/" ]
On edit.php, the main content is a list of posts, with columns including the published date. I'd like to change the date format of the published date *just on the admin page*. In this case, I don't want to change what the users see; I want to change what the admin sees. I want to add the day of the week to the publis...
1. [Add a column to the post edit screen](https://wordpress.stackexchange.com/questions/3531/how-can-i-add-columns-to-the-post-edit-listing-to-show-my-custom-post-data/3532#3532) and format the date however you like. 2. [Remove the default Date column](https://wordpress.stackexchange.com/questions/19180/how-to-remove-a...
19,207
<p>I'm trying to add an Amazon advertising widget in a WordPress sidebar widget (self-hosted WordPress, v3.1.3). The widget code is basically an iframe.</p> <p>I've tried using the "Text" widget and pasting the iframe code in there, but when I save the widget, the iframe code disappears.</p> <p>I've come across this ...
[ { "answer_id": 19210, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 4, "selected": true, "text": "<p>Just create a widget that doesn’t filter your input. This is probably the most simple widget with user input you can bu...
2011/06/04
[ "https://wordpress.stackexchange.com/questions/19207", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/833/" ]
I'm trying to add an Amazon advertising widget in a WordPress sidebar widget (self-hosted WordPress, v3.1.3). The widget code is basically an iframe. I've tried using the "Text" widget and pasting the iframe code in there, but when I save the widget, the iframe code disappears. I've come across this problem/limitatio...
Just create a widget that doesn’t filter your input. This is probably the most simple widget with user input you can build. Here is the widget I use in my plugin [Magic Widgets](http://wordpress.org/extend/plugins/magic-widgets/). ``` /** * Simplified variant of the native text widget class. * * @author Fuxia Scho...
19,225
<p>How can I modify month names in "Archives" in my blog? I would like to translate english month names into my mother tongue. I'm using the english version of wordpress 3.1.3</p>
[ { "answer_id": 19266, "author": "MTT", "author_id": 1057, "author_profile": "https://wordpress.stackexchange.com/users/1057", "pm_score": 0, "selected": false, "text": "<p>I believe the <a href=\"http://wpml.org/\" rel=\"nofollow\">WordPress Multilingual</a> plugin will do this, though I...
2011/06/04
[ "https://wordpress.stackexchange.com/questions/19225", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5932/" ]
How can I modify month names in "Archives" in my blog? I would like to translate english month names into my mother tongue. I'm using the english version of wordpress 3.1.3
if the translation is only for the archive widget, a filter function might work (to be added to functions.php of the theme): ``` add_filter('get_archives_link', 'translate_archive_month'); function translate_archive_month($list) { $patterns = array( '/January/', '/February/', '/March/', '/April/', '/May/', '/Ju...
19,231
<p>I have to add a blog in my magento site.Is it possible to integrate wordpress into magento by which we are able to post blog in the wordpress and then display in the magento site.</p> <p>Thanks in advance </p> <p>Pramod</p>
[ { "answer_id": 19266, "author": "MTT", "author_id": 1057, "author_profile": "https://wordpress.stackexchange.com/users/1057", "pm_score": 0, "selected": false, "text": "<p>I believe the <a href=\"http://wpml.org/\" rel=\"nofollow\">WordPress Multilingual</a> plugin will do this, though I...
2011/06/04
[ "https://wordpress.stackexchange.com/questions/19231", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/17807/" ]
I have to add a blog in my magento site.Is it possible to integrate wordpress into magento by which we are able to post blog in the wordpress and then display in the magento site. Thanks in advance Pramod
if the translation is only for the archive widget, a filter function might work (to be added to functions.php of the theme): ``` add_filter('get_archives_link', 'translate_archive_month'); function translate_archive_month($list) { $patterns = array( '/January/', '/February/', '/March/', '/April/', '/May/', '/Ju...
19,238
<p>I'm using WordPress 3.1.3 as a full CMS, installed in the root directory of a domain. I have it setup using the built in options to have a static page as the home page, and then my blog at <code>http://www.example.com/blog</code>.</p> <p>What I would like is to have my single blog posts, category pages, archive page...
[ { "answer_id": 19242, "author": "xLRDxREVENGEx", "author_id": 4998, "author_profile": "https://wordpress.stackexchange.com/users/4998", "pm_score": 4, "selected": true, "text": "<p>Go to Settings>Permalinks and add it to the permalink structures </p>\n" }, { "answer_id": 21208, ...
2011/06/05
[ "https://wordpress.stackexchange.com/questions/19238", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5935/" ]
I'm using WordPress 3.1.3 as a full CMS, installed in the root directory of a domain. I have it setup using the built in options to have a static page as the home page, and then my blog at `http://www.example.com/blog`. What I would like is to have my single blog posts, category pages, archive pages, and tag pages, an...
Go to Settings>Permalinks and add it to the permalink structures
19,245
<p>I'm using <strong>wp_nav_menu</strong> and am trying to create custom output for the sub-level drop downs. I came across the "items_wrap" argument but there's really not much information as to what it is, how it works, and what kind of things can be done with it. </p> <p>What exactly <em>is</em> "<strong>%1$s</st...
[ { "answer_id": 19246, "author": "xLRDxREVENGEx", "author_id": 4998, "author_profile": "https://wordpress.stackexchange.com/users/4998", "pm_score": 0, "selected": false, "text": "<p>from what i gather it grabs an output and give the li a id and class with the menus name. So when you want...
2011/06/05
[ "https://wordpress.stackexchange.com/questions/19245", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1663/" ]
I'm using **wp\_nav\_menu** and am trying to create custom output for the sub-level drop downs. I came across the "items\_wrap" argument but there's really not much information as to what it is, how it works, and what kind of things can be done with it. What exactly *is* "**%1$s**" and "**%2$s**"? (Can anyone explain...
The parameter `'items_wrap'` for `wp_nav_menu()` defaults to: ``` '<ul id="%1$s" class="%2$s">%3$s</ul>' ``` This a a *template* that is parsed with [`sprintf()`](http://www.php.net/sprintf): ``` $nav_menu .= sprintf( $args->items_wrap , esc_attr( $wrap_id ) // %1$s , esc_attr( $wrap_class ) // %2$s ,...
19,290
<p>In WordPress 3.1 a post can be reached a number of ways, for example each one of these takes you to the same post (where /id is the base)</p> <pre><code>http://myblog.com/id/1008 http://myblog.com/id/1008/my-slug http://myblog.com/my-slug </code></pre> <p>How can I tell WordPress to redirect all of these variation...
[ { "answer_id": 23587, "author": "jerclarke", "author_id": 175, "author_profile": "https://wordpress.stackexchange.com/users/175", "pm_score": 2, "selected": false, "text": "<p>WordPress should do this automatically. Whatever permalink format you have set in Settings > Permalinks should b...
2011/06/05
[ "https://wordpress.stackexchange.com/questions/19290", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3976/" ]
In WordPress 3.1 a post can be reached a number of ways, for example each one of these takes you to the same post (where /id is the base) ``` http://myblog.com/id/1008 http://myblog.com/id/1008/my-slug http://myblog.com/my-slug ``` How can I tell WordPress to redirect all of these variations to ``` http://myblog.c...
Check whether the posts not being redirected actually have the correct permalink stored in the DB. There's a bug in which canonicals can't be properly guessed because the permalink structure was CHANGED after the post was created. Try either creating a new post with your current permalink structure, or editing the pos...
19,308
<p>The instructions for implementing Modernizr state that I should add <code>class="no-js"</code> to the <code>&lt;html&gt;</code> element.</p> <p>Is there a way to do this in WordPress using a hook or filter? If at all possible, I'd prefer to do this without editing the theme files.</p>
[ { "answer_id": 19309, "author": "Anh Tran", "author_id": 2051, "author_profile": "https://wordpress.stackexchange.com/users/2051", "pm_score": 3, "selected": false, "text": "<p>This is not exactly the answer, but you can use a hook for <a href=\"http://adambrown.info/p/wp_hooks/hook/lang...
2011/06/06
[ "https://wordpress.stackexchange.com/questions/19308", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1851/" ]
The instructions for implementing Modernizr state that I should add `class="no-js"` to the `<html>` element. Is there a way to do this in WordPress using a hook or filter? If at all possible, I'd prefer to do this without editing the theme files.
This is not exactly the answer, but you can use a hook for [`language_attributes`](http://adambrown.info/p/wp_hooks/hook/language_attributes?version=3.0&file=wp-includes/general-template.php) filter. This action is fired at `<html>` tag and what it does is simply echo the `lang=en` string, for ex. You can hook to that ...
19,349
<p>Just wondering if there is a way to remove WordPress's default function of adding a tag around an inserted image. I assume its a "remove_filter" function like you can do for WPAutoP, but all my searches only turned up links for gallery plugins, etc.</p> <p>Thanks in advance, Pete</p>
[ { "answer_id": 19374, "author": "goldenapples", "author_id": 290, "author_profile": "https://wordpress.stackexchange.com/users/290", "pm_score": 2, "selected": false, "text": "<p>There's an option in the wp_options table called <code>image_default_link_type</code>. Changing that to \"non...
2011/06/06
[ "https://wordpress.stackexchange.com/questions/19349", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1388/" ]
Just wondering if there is a way to remove WordPress's default function of adding a tag around an inserted image. I assume its a "remove\_filter" function like you can do for WPAutoP, but all my searches only turned up links for gallery plugins, etc. Thanks in advance, Pete
This is not able to be changed through a filter. In WordPress 2.9.2 and lower, the setting can be changed in /wp-admin/options.php. The image\_default\_link\_type field is set to "file" by default. If you set it to "none", then scroll to the bottom and save, it will disable media links. This option has been removed f...
19,350
<p>I'm trying to unregister a post type from a child theme but I haven't been able to do so, the code in the funcions.php file on the parent theme is something like this:</p> <pre><code>add_action( 'init', 'mc_projects' ); function mc_projects() { register_post_type( 'project', array( // Default options......
[ { "answer_id": 20939, "author": "Scott", "author_id": 4610, "author_profile": "https://wordpress.stackexchange.com/users/4610", "pm_score": 3, "selected": true, "text": "<p>Try the following in your child theme functions file.</p>\n\n<pre><code>add_action( 'init', 'remove_mc_projects' );...
2011/06/06
[ "https://wordpress.stackexchange.com/questions/19350", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3893/" ]
I'm trying to unregister a post type from a child theme but I haven't been able to do so, the code in the funcions.php file on the parent theme is something like this: ``` add_action( 'init', 'mc_projects' ); function mc_projects() { register_post_type( 'project', array( // Default options.... ) ); } ...
Try the following in your child theme functions file. ``` add_action( 'init', 'remove_mc_projects' ); function remove_mc_projects() { remove_action('init', 'mc_projects'); } ```
19,355
<p>I'm going to move my site from development/staging environment (i.e. dev.example.com) to production environment (example.com). </p> <p>Probably, existing links in my pages and posts will still point to the old url, i.e. dev.example.com. how do i deal with this issue? is it possible correct all the links in one go? ...
[ { "answer_id": 20939, "author": "Scott", "author_id": 4610, "author_profile": "https://wordpress.stackexchange.com/users/4610", "pm_score": 3, "selected": true, "text": "<p>Try the following in your child theme functions file.</p>\n\n<pre><code>add_action( 'init', 'remove_mc_projects' );...
2011/06/06
[ "https://wordpress.stackexchange.com/questions/19355", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5968/" ]
I'm going to move my site from development/staging environment (i.e. dev.example.com) to production environment (example.com). Probably, existing links in my pages and posts will still point to the old url, i.e. dev.example.com. how do i deal with this issue? is it possible correct all the links in one go? any sugges...
Try the following in your child theme functions file. ``` add_action( 'init', 'remove_mc_projects' ); function remove_mc_projects() { remove_action('init', 'mc_projects'); } ```
19,356
<p>hi i'm trying to insert a short code into a Text widget but all its doing it showing the code and not processing it.</p> <pre><code>&lt;?php echo do_shortcode(' [stream embed=false share=false width=500 height=560 dock=true controlbar=bottom bandwidth=high autostart=false playlistfile=http://www.xxx.com/wp-content/...
[ { "answer_id": 19359, "author": "Rev. Voodoo", "author_id": 3429, "author_profile": "https://wordpress.stackexchange.com/users/3429", "pm_score": 3, "selected": true, "text": "<p>the text widget doesn't do php....</p>\n\n<p>Here's my fave solution</p>\n\n<p><a href=\"http://wordpress.org...
2011/06/06
[ "https://wordpress.stackexchange.com/questions/19356", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5771/" ]
hi i'm trying to insert a short code into a Text widget but all its doing it showing the code and not processing it. ``` <?php echo do_shortcode(' [stream embed=false share=false width=500 height=560 dock=true controlbar=bottom bandwidth=high autostart=false playlistfile=http://www.xxx.com/wp-content/uploads/videos/pl...
the text widget doesn't do php.... Here's my fave solution <http://wordpress.org/extend/plugins/php-code-widget/> It's from Otto, so ya know it's good. Based heavily on the text widget, but allows for php
19,375
<p>Im trying to get the id of the menu item that has be class called "current-menu-item". Not the current page id, but the nav item id.</p> <p>Please help</p>
[ { "answer_id": 19377, "author": "John P Bloch", "author_id": 11, "author_profile": "https://wordpress.stackexchange.com/users/11", "pm_score": 1, "selected": false, "text": "<p>The best way would be to use the <code>nav_menu_css_class</code> filter. Something like this would work:</p>\n\...
2011/06/06
[ "https://wordpress.stackexchange.com/questions/19375", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5973/" ]
Im trying to get the id of the menu item that has be class called "current-menu-item". Not the current page id, but the nav item id. Please help
This should solve it [How to get current-menu-item title as variable?](https://wordpress.stackexchange.com/questions/16243/how-to-get-current-menu-item-title-as-variable/16337#16337) but change ``` $GLOBALS['wpse16243_title'] = $menu_item->title; ``` to ``` $GLOBALS['wpse16243_title'] = $menu_item->ID; ``` and n...
19,424
<p>What is the best method to retrieve the title tag of an external page using the http api?</p> <p>The snippet below will get the body but I can't find the right documentation about how to just get the tag. :/</p> <pre><code>$url = 'http://wordpres.org'; $response = wp_remote_get( $url ); if( is_wp_error( $respons...
[ { "answer_id": 19425, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 1, "selected": false, "text": "<p>Well, you don't want to <code>print</code> the response, you'll want to store it in a variable. Then you can use a R...
2011/06/07
[ "https://wordpress.stackexchange.com/questions/19424", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1057/" ]
What is the best method to retrieve the title tag of an external page using the http api? The snippet below will get the body but I can't find the right documentation about how to just get the tag. :/ ``` $url = 'http://wordpres.org'; $response = wp_remote_get( $url ); if( is_wp_error( $response ) ) { echo 'Someth...
here is a function i have for that: ``` function get_page_title($url){ if( !class_exists( 'WP_Http' ) ) include_once( ABSPATH . WPINC. '/class-http.php' ); $request = new WP_Http; $result = $request->request( $url ); if( is_wp_error( $result ) ) return false; ...
19,427
<p>Client has a 3.1x-based site with paywall(using s2Member) which has a public feed that only provides excerpts. He wants to be able to give members full-content feeds, so we need something that can look at the member's role/level and cut them off at the appropriate time, etc. It's accepted this will probably require ...
[ { "answer_id": 19431, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 0, "selected": false, "text": "<p>This is not possible with core so far as I know. I would recommend trying the following:</p>\n\n<ol>\n<li>Contact th...
2011/06/07
[ "https://wordpress.stackexchange.com/questions/19427", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3370/" ]
Client has a 3.1x-based site with paywall(using s2Member) which has a public feed that only provides excerpts. He wants to be able to give members full-content feeds, so we need something that can look at the member's role/level and cut them off at the appropriate time, etc. It's accepted this will probably require som...
Assuming you only want to switch it from excerpts to full content, then you could filter the rss\_use\_excerpt option based on whatever settings you prefer. Something like this would work: ``` add_filter('option_rss_use_excerpt','random_function_name_here'); function random_function_name_here($value) { if ( whatever...
19,435
<p>I've added a role of "Customer" and I am working on customizing the Users Screen for that role. What I'd like to do is customize columns based on that particular role. </p> <p><strong>Note:</strong></p> <p>For example, take a look at the screenshot. How would I remove the reference to the posts column for <em>only...
[ { "answer_id": 19437, "author": "mike23", "author_id": 1381, "author_profile": "https://wordpress.stackexchange.com/users/1381", "pm_score": 0, "selected": false, "text": "<p>Have a look at <a href=\"http://codex.wordpress.org/Function_Reference/current_user_can\" rel=\"nofollow\">curren...
2011/06/07
[ "https://wordpress.stackexchange.com/questions/19435", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1766/" ]
I've added a role of "Customer" and I am working on customizing the Users Screen for that role. What I'd like to do is customize columns based on that particular role. **Note:** For example, take a look at the screenshot. How would I remove the reference to the posts column for *only* the customer role? ![Example ...
Thanks to Mike23 for the tip. Here's the code that I'm using to add a column to *only* the "customer" role: ``` if( $_GET['role'] == "customer" ) { add_filter('manage_users_columns', 'add_ecommerce_column'); add_filter('manage_users_custom_column', 'manage_ecommerce_column', 10, 3); function add_ecommerce_column($c...
19,439
<p>Here's the code for a custom metabox. Very simply, how would I resize the textarea box? I'd like to add an expression such as cols="50" rows="5".</p> <pre><code>// Echo out the field echo '&lt;p&gt;Enter the location:&lt;/p&gt;'; echo '&lt;div class="customEditor"&gt;&lt;input type="textarea" name="_location" v...
[ { "answer_id": 19440, "author": "mike23", "author_id": 1381, "author_profile": "https://wordpress.stackexchange.com/users/1381", "pm_score": 3, "selected": true, "text": "<p>You could try styling it with CSS by adding an ID or a class to the textarea and inserting styles into the wp_admi...
2011/06/07
[ "https://wordpress.stackexchange.com/questions/19439", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5486/" ]
Here's the code for a custom metabox. Very simply, how would I resize the textarea box? I'd like to add an expression such as cols="50" rows="5". ``` // Echo out the field echo '<p>Enter the location:</p>'; echo '<div class="customEditor"><input type="textarea" name="_location" value="' . $location . '" class="wi...
You could try styling it with CSS by adding an ID or a class to the textarea and inserting styles into the wp\_admin head. Or, a quick way would be to do something like this : ``` echo '<textarea name="_dresscode" class="widefat" style="width:400px !important; height:80px !important;" >' . $dresscode . '</textarea>...
19,446
<p>We have just updated to WordPress 3.1.3 by following the WP manual install tutorial. Note: This is a <strong>Network-enabled (multi-site)</strong> install.</p> <p>After uploading the new files, we now get the following error for ALL pages in the blog:</p> <blockquote> <p>Error 101 (net::ERR_CONNECTION_RESET): Un...
[ { "answer_id": 19453, "author": "markratledge", "author_id": 268, "author_profile": "https://wordpress.stackexchange.com/users/268", "pm_score": 0, "selected": false, "text": "<pre><code>failed to open stream: No such file or directory\n</code></pre>\n\n<p>1) Did you reupload wp-admin an...
2011/06/07
[ "https://wordpress.stackexchange.com/questions/19446", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5997/" ]
We have just updated to WordPress 3.1.3 by following the WP manual install tutorial. Note: This is a **Network-enabled (multi-site)** install. After uploading the new files, we now get the following error for ALL pages in the blog: > > Error 101 (net::ERR\_CONNECTION\_RESET): Unknown error. > > > Any ideas? Here...
Are you sure `/wp-includes/load.php` made it to the server? If you were installing manually, there's a chance it got lost during the transfer. Happens to me occasionally using FileZilla. The error messages are basically telling you that the server can't find the file, so make sure the file is there.
19,461
<p>In the functions.php, I have the following code added:</p> <pre><code>add_post_type_support( 'page', 'excerpt' ); </code></pre> <p>This allows pages to have excerpts. The reason I want an excerpt is because I want to call only pages with excerpts to be one of 3 modules on the home page.</p> <p>On the front page, ...
[ { "answer_id": 19453, "author": "markratledge", "author_id": 268, "author_profile": "https://wordpress.stackexchange.com/users/268", "pm_score": 0, "selected": false, "text": "<pre><code>failed to open stream: No such file or directory\n</code></pre>\n\n<p>1) Did you reupload wp-admin an...
2011/06/07
[ "https://wordpress.stackexchange.com/questions/19461", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6000/" ]
In the functions.php, I have the following code added: ``` add_post_type_support( 'page', 'excerpt' ); ``` This allows pages to have excerpts. The reason I want an excerpt is because I want to call only pages with excerpts to be one of 3 modules on the home page. On the front page, in my home.php file, these 3 modu...
Are you sure `/wp-includes/load.php` made it to the server? If you were installing manually, there's a chance it got lost during the transfer. Happens to me occasionally using FileZilla. The error messages are basically telling you that the server can't find the file, so make sure the file is there.
19,480
<p>I've created a custom taxonomy and I want to add it as an option for custom menus (under Appearance > Menus). How do I get it to show up there (see the illustration, I want it to show up where the red square is).</p> <p><img src="https://i.stack.imgur.com/FeLSC.png" alt="enter image description here"></p>
[ { "answer_id": 19482, "author": "Daniel Koskinen", "author_id": 5998, "author_profile": "https://wordpress.stackexchange.com/users/5998", "pm_score": 5, "selected": true, "text": "<p>Your custom taxonomy should show up as an option for custom menus, if you have </p>\n\n<pre><code>'show_i...
2011/06/08
[ "https://wordpress.stackexchange.com/questions/19480", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5719/" ]
I've created a custom taxonomy and I want to add it as an option for custom menus (under Appearance > Menus). How do I get it to show up there (see the illustration, I want it to show up where the red square is). ![enter image description here](https://i.stack.imgur.com/FeLSC.png)
Your custom taxonomy should show up as an option for custom menus, if you have ``` 'show_in_nav_menus' => true ``` as a parameter when you register your post type with `register_post_type()`. You can check all the available parameters in the codex entry <http://codex.wordpress.org/Function_Reference/register_post_t...
19,499
<p>I have this code</p> <pre><code>function this_is_my_shortcode(){ wp_register_script('per-pas-belanja-online', plugins_url('js/per-pas-belanja-online.js', __FILE__), array('jquery'), '1.0.0'); wp_enqueue_script('per-pas-belanja-online'); return '&lt;div id="poppedout"&gt;Blah&lt;/div&gt;'; } add_shortcod...
[ { "answer_id": 19502, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 2, "selected": false, "text": "<p>Straight from the <a href=\"http://codex.wordpress.org/Function_Reference/wp_enqueue_script\" rel=\"nofollow\">Code...
2011/06/08
[ "https://wordpress.stackexchange.com/questions/19499", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4322/" ]
I have this code ``` function this_is_my_shortcode(){ wp_register_script('per-pas-belanja-online', plugins_url('js/per-pas-belanja-online.js', __FILE__), array('jquery'), '1.0.0'); wp_enqueue_script('per-pas-belanja-online'); return '<div id="poppedout">Blah</div>'; } add_shortcode('bubba', 'this_is_my_sho...
Straight from the [Codex](http://codex.wordpress.org/Function_Reference/wp_enqueue_script) > > Use the `wp_enqueue_scripts` action to call this function, or `admin_enqueue_scripts` to call it on the admin side. Calling it **outside** of an action can lead to troubles. > > >
19,504
<p>I like to display only 20 lines of post with the read more link using</p> <pre><code>the_content( __( 'Continue reading &lt;span class="meta-nav"&gt;&amp;rarr;&lt;/span&gt;' ) ); </code></pre> <p>But it shows full content . How can i strip it .please help me !</p>
[ { "answer_id": 19505, "author": "anu", "author_id": 490, "author_profile": "https://wordpress.stackexchange.com/users/490", "pm_score": 3, "selected": true, "text": "<p>You need to add a more quicktag to your content</p>\n\n<p>See here: <a href=\"http://codex.wordpress.org/Customizing_th...
2011/06/08
[ "https://wordpress.stackexchange.com/questions/19504", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4022/" ]
I like to display only 20 lines of post with the read more link using ``` the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>' ) ); ``` But it shows full content . How can i strip it .please help me !
You need to add a more quicktag to your content See here: <http://codex.wordpress.org/Customizing_the_Read_More>
19,517
<p>am running the <a href="http://wordpress.org/extend/plugins/custom-field-template/" rel="nofollow">CFT</a> plugin version 1.9.2 on a 3.1.3 wordpress site and in the admin i did set up 30 input file fields related to a custom post type. It all works fine until the 21st field (and beyond) that does not save any file (...
[ { "answer_id": 19515, "author": "Philip Jones", "author_id": 6022, "author_profile": "https://wordpress.stackexchange.com/users/6022", "pm_score": 0, "selected": false, "text": "<p>My experience is that moving a WP installation from one server to another is messy, with lots of manual fix...
2011/06/08
[ "https://wordpress.stackexchange.com/questions/19517", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1997/" ]
am running the [CFT](http://wordpress.org/extend/plugins/custom-field-template/) plugin version 1.9.2 on a 3.1.3 wordpress site and in the admin i did set up 30 input file fields related to a custom post type. It all works fine until the 21st field (and beyond) that does not save any file (small picture) that is select...
Moving is a royal pain indeed and everything goes into the details. A possible solution to these potential problems is a new plugin that was just released, it's called the Duplicator: <http://wordpress.org/extend/plugins/duplicator/> I haven't tested it yet, just saw the news in my Reader, but saw the video and it look...
19,529
<p>I have this issue, where I can't access the frontend without a blank page anymore. It drives me crazy. </p> <p>The backend seems to be up just fine, but the frontend is white. When trying to chose another theme (twentyten) this one also returns white, already in the preview.</p> <p>What can I possibly do?</p> <p>...
[ { "answer_id": 19531, "author": "Drew Gourley", "author_id": 4282, "author_profile": "https://wordpress.stackexchange.com/users/4282", "pm_score": 2, "selected": false, "text": "<p>If you have ftp access to your site, go to the root. There is a line in wp-config.cfg:</p>\n\n<pre><code>de...
2011/06/08
[ "https://wordpress.stackexchange.com/questions/19529", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6025/" ]
I have this issue, where I can't access the frontend without a blank page anymore. It drives me crazy. The backend seems to be up just fine, but the frontend is white. When trying to chose another theme (twentyten) this one also returns white, already in the preview. What can I possibly do? Edit 1: This is what I ...
If you have ftp access to your site, go to the root. There is a line in wp-config.cfg: ``` define('WP_DEBUG', false); ``` Switch it to: ``` define('WP_DEBUG', true); ``` Upon returning to one of the blank pages, you'll notice an error message which can shed some light on what is going wrong. From there you may ei...
19,565
<p>I uploaded a few <code>.js</code> files, so my <code>js</code> folder is in the root (The same level as wp-contents). I have a few .js files, but I just uploaded the masonry library and when I try to access it via <code>domain.com/js/masory.js</code>, it just goes to a 404. Is there something I am supposed to do wit...
[ { "answer_id": 19550, "author": "thetitan", "author_id": 6032, "author_profile": "https://wordpress.stackexchange.com/users/6032", "pm_score": 0, "selected": false, "text": "<p>A good place to start would be Web Hosting talk forums <a href=\"http://www.webhostingtalk.com/\" rel=\"nofollo...
2011/06/09
[ "https://wordpress.stackexchange.com/questions/19565", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5652/" ]
I uploaded a few `.js` files, so my `js` folder is in the root (The same level as wp-contents). I have a few .js files, but I just uploaded the masonry library and when I try to access it via `domain.com/js/masory.js`, it just goes to a 404. Is there something I am supposed to do with Wordpress ? The weird thing is, my...
I personally wouldn't bother with any of the hosting review sites. Instead ask friends and peers which services they use and if they are any good. Also checkout the userbase and the community at the host you are considering as they will give you a good indication of whether the host is of good quality or not.
19,573
<p>How can the <code>unfiltered_html</code> capability be given to non network admins in a multisite install to allow HTML in titles?</p> <p>In wp-includes/capabilities.php (below) it appears that this capability can not be given to non super_admins.</p> <pre><code>case 'unfiltered_html': // Disallow unfiltered...
[ { "answer_id": 19581, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 0, "selected": false, "text": "<p>For me, I would offer a simple marker to indicate a line break (for example, a double colon), then swap the...
2011/06/09
[ "https://wordpress.stackexchange.com/questions/19573", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/251/" ]
How can the `unfiltered_html` capability be given to non network admins in a multisite install to allow HTML in titles? In wp-includes/capabilities.php (below) it appears that this capability can not be given to non super\_admins. ``` case 'unfiltered_html': // Disallow unfiltered_html for all users, even adm...
Set it up so that your editors and writers use the default title as the first line and add a metabox for a subtitle that will output the other lines as separate lines. This will require a theme adjustment if you want them all included in the h1 header tag. With some adjustments to the admin theme you can get this metab...
19,578
<p>Done some reasonable searching for this and don't think it's been asked before.</p> <p>I've got a site which I'm developing a custom template/theme for. The site will use a page as the front page (rather than the list of posts), but I want to create a link in the template to the page of blog posts.</p> <p>There a...
[ { "answer_id": 19579, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 2, "selected": true, "text": "<pre><code>&lt;?php $blog_link = get_page_link( get_option( 'page_for_posts' ) ); ?&gt;\n</code></pre>\n" }, ...
2011/06/09
[ "https://wordpress.stackexchange.com/questions/19578", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6042/" ]
Done some reasonable searching for this and don't think it's been asked before. I've got a site which I'm developing a custom template/theme for. The site will use a page as the front page (rather than the list of posts), but I want to create a link in the template to the page of blog posts. There are some functions ...
``` <?php $blog_link = get_page_link( get_option( 'page_for_posts' ) ); ?> ```
19,587
<p>I would like to hack the default <strong>Recent Comments</strong> widget to show also the avatar of commenter.</p> <p>The modification should be really easy, if I change directly the code in <code>default-widgets.php</code></p> <pre><code>if ( $comments ) { foreach ( (array) $comments as $comment) { $o...
[ { "answer_id": 19590, "author": "Elpie", "author_id": 2761, "author_profile": "https://wordpress.stackexchange.com/users/2761", "pm_score": 1, "selected": false, "text": "<p>You can copy the widget code and make your own plugin with the changes you want or, alternatively, use one of the ...
2011/06/09
[ "https://wordpress.stackexchange.com/questions/19587", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/36/" ]
I would like to hack the default **Recent Comments** widget to show also the avatar of commenter. The modification should be really easy, if I change directly the code in `default-widgets.php` ``` if ( $comments ) { foreach ( (array) $comments as $comment) { $output .= '<li class="recentcomments">' . /* ...
Sounds like you just need to make another widget of your own in a plugin. So copy the complete code from the default widgets file, and change the class name, then just edit the code you'd like to edit. ``` class YOUR NEW WIDGET NAME extends WP_Widget { // ... foreach ( (array) $comments as $comment) ...
19,596
<p>I have a table in my database containing vote a tally I'm trying to order posts by.</p> <p>screenshot: <a href="https://i.stack.imgur.com/j83Xa.png" rel="nofollow noreferrer">the table</a></p> <p>I've tried something like this, which brings up all the voted posts and pagination okay but does not order them by DESC...
[ { "answer_id": 19598, "author": "supajb", "author_id": 3493, "author_profile": "https://wordpress.stackexchange.com/users/3493", "pm_score": 1, "selected": false, "text": "<p>User the parameter 'order' in your loop call.</p>\n\n<pre><code>$args = array(\n 'post__in' =&gt; $my_posts,\n...
2011/06/09
[ "https://wordpress.stackexchange.com/questions/19596", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5859/" ]
I have a table in my database containing vote a tally I'm trying to order posts by. screenshot: [the table](https://i.stack.imgur.com/j83Xa.png) I've tried something like this, which brings up all the voted posts and pagination okay but does not order them by DESC. Any advice if I'm approaching this right is apprecia...
### The Problem `$my_posts` doesn't contain any posts. It contains post IDs and likes. And you're dropping both into `post__in`, which can't work. I guess even the number of posts wouldn't work if the plugin(?) wouldn't add any post with a 0-x integer to the db-table per default. ### The Debug Try the following: ``...
19,601
<p>I'm having some issues with my first wordpress installation that's really throwing me for a loop. First some background info on the situation.</p> <p>I've been working on converting an HTML site into wordpress. Since the site was quite large (around 8000 pages) I used a plugin to import the HTML files. While doing ...
[ { "answer_id": 19631, "author": "Chip Bennett", "author_id": 3966, "author_profile": "https://wordpress.stackexchange.com/users/3966", "pm_score": 1, "selected": false, "text": "<p>My guess is that you're either running into issues with verbose rewrite rules (which, if you've reverted to...
2011/06/09
[ "https://wordpress.stackexchange.com/questions/19601", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6049/" ]
I'm having some issues with my first wordpress installation that's really throwing me for a loop. First some background info on the situation. I've been working on converting an HTML site into wordpress. Since the site was quite large (around 8000 pages) I used a plugin to import the HTML files. While doing so I found...
My guess is that you're either running into issues with verbose rewrite rules (which, if you've reverted to default permalink structure and still have the problem, isn't the problem), or else you're just running into server resource limits. Have you tried using W3 Total Cache or another caching Plugin, to see if anythi...
19,610
<h3>Case:</h3> <p>I got a set of classes that build form fields based on data from an input array. The class can build the following types of form fields:</p> <ul> <li>input (basic, hidden, password)</li> <li>textarea</li> <li>radio</li> <li>checkbox</li> <li>select</li> <li>colorpicker</li> <li>datepicker</li> <li>f...
[ { "answer_id": 19615, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 2, "selected": false, "text": "<p>You should really hook you scripts to the <code>wp_enqueue_scripts</code> action and your styles to the <code>wp_prin...
2011/06/09
[ "https://wordpress.stackexchange.com/questions/19610", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/385/" ]
### Case: I got a set of classes that build form fields based on data from an input array. The class can build the following types of form fields: * input (basic, hidden, password) * textarea * radio * checkbox * select * colorpicker * datepicker * file upload *EDIT:* The class uses `wp_register_script/_style` & `wp...
Your problem is adding the scripts, styles **inside** the class, and because the class instance is created when the hook `add_meta_box` is fired, at that time the `wp_enqueue_script/style` are already finished. A solution for you is adding the scripts, styles **outside** the function and the class. And because meta bo...
19,618
<p>I'm working on a theme and i use dimox's breadcrumbs to display breadcrumbs in the footer, so far so good, works almost flawlessly</p> <p>BUT</p> <p>there's one template file where i use 2 loops and i'm guessing this is what screws with the breadcrumbs... but i couldn't put my finger on it exactly...</p> <p>here'...
[ { "answer_id": 19641, "author": "Tom Auger", "author_id": 3687, "author_profile": "https://wordpress.stackexchange.com/users/3687", "pm_score": 1, "selected": true, "text": "<p>Well, I had seen it and was thrown off by the first argument, but it does exactly what is needed. From wp-inclu...
2011/06/09
[ "https://wordpress.stackexchange.com/questions/19618", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6056/" ]
I'm working on a theme and i use dimox's breadcrumbs to display breadcrumbs in the footer, so far so good, works almost flawlessly BUT there's one template file where i use 2 loops and i'm guessing this is what screws with the breadcrumbs... but i couldn't put my finger on it exactly... here's the code: ``` <div c...
Well, I had seen it and was thrown off by the first argument, but it does exactly what is needed. From wp-includes/taxonomy.php: `function wp_get_object_terms($object_ids, $taxonomies, $args = array())` And to use it as I wished, giving me a flat list of matching IDs, push 'fields'=>'ids' into $args, like so: `wp_ge...
19,626
<p>I have created a custom taxonomy as described on <a href="http://codex.wordpress.org/Function_Reference/register_post_type#Arguments" rel="nofollow">the Codex</a>. I have "public" set to true, which show_in_nav_menus is supposed to inherit from, and have also explicitly added the show_in_nav_menus variable and set i...
[ { "answer_id": 19645, "author": "kevin", "author_id": 1997, "author_profile": "https://wordpress.stackexchange.com/users/1997", "pm_score": 2, "selected": false, "text": "<p>Can you see it when you open the '<strong>Screen Options</strong>' menu on the top right of the admin next to the ...
2011/06/09
[ "https://wordpress.stackexchange.com/questions/19626", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5719/" ]
I have created a custom taxonomy as described on [the Codex](http://codex.wordpress.org/Function_Reference/register_post_type#Arguments). I have "public" set to true, which show\_in\_nav\_menus is supposed to inherit from, and have also explicitly added the show\_in\_nav\_menus variable and set it to true. However, it ...
Make sure you click "Screen Options" and check the checkbox for each menu you want to be able to select. For each user. -\_-
19,634
<p>I have a wordpress plugin that displays videos through a shortcode. My problem is it assigns the div's with ID's such as video-1-player, video-2-player, etc. I need to create a function that searches my content for <code>&lt;div id="video-(any number here)-player"&gt;</code> and adds a class inside the div.</p> <p>...
[ { "answer_id": 19658, "author": "Elpie", "author_id": 2761, "author_profile": "https://wordpress.stackexchange.com/users/2761", "pm_score": 1, "selected": false, "text": "<p>Try the Search and Replace plugin: <a href=\"http://wordpress.org/extend/plugins/search-and-replace/\" rel=\"nofol...
2011/06/09
[ "https://wordpress.stackexchange.com/questions/19634", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5140/" ]
I have a wordpress plugin that displays videos through a shortcode. My problem is it assigns the div's with ID's such as video-1-player, video-2-player, etc. I need to create a function that searches my content for `<div id="video-(any number here)-player">` and adds a class inside the div. I found this code which sea...
Try the Search and Replace plugin: <http://wordpress.org/extend/plugins/search-and-replace/> This searches for strings and will allow you to search for every instance of video-x-player, using a regex for the number. If you don't want to use regex searching on video- will bring up every instance that is already in your...
19,649
<p>i've installed a LAMP server on my ubunutu 11.04. i've installed wordpress and hooked it right with the MySQL db. i've changed the permissions of the www-data group to read and write files.</p> <p>every thing is seems to work and i can manage the site through the admin panel, but i can't install plugins cause the s...
[ { "answer_id": 19657, "author": "Elpie", "author_id": 2761, "author_profile": "https://wordpress.stackexchange.com/users/2761", "pm_score": 0, "selected": false, "text": "<p>This isn't a WordPress problem. You need to refer to the documentation for the LAMP server to check the setup opti...
2011/06/09
[ "https://wordpress.stackexchange.com/questions/19649", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3603/" ]
i've installed a LAMP server on my ubunutu 11.04. i've installed wordpress and hooked it right with the MySQL db. i've changed the permissions of the www-data group to read and write files. every thing is seems to work and i can manage the site through the admin panel, but i can't install plugins cause the system is a...
I usually do this when that happens (only locally, not for production) : ``` chown -R nobody:nobody /path/to/wordpress ```
19,653
<p>I'm building a menu which contains categories. Is there a way to make each menu option show a list of recent posts in that category when you hover over it?</p>
[ { "answer_id": 19670, "author": "Mahesh", "author_id": 6071, "author_profile": "https://wordpress.stackexchange.com/users/6071", "pm_score": 0, "selected": false, "text": "<p>If you make your navigation region widgetized then it is possible. For example make your horizontal nav area widg...
2011/06/10
[ "https://wordpress.stackexchange.com/questions/19653", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4567/" ]
I'm building a menu which contains categories. Is there a way to make each menu option show a list of recent posts in that category when you hover over it?
you can use a walker like this, ``` class Walker_Recent_Post_Category extends Walker_Category { function start_el(&$output, $category, $depth, $args) { extract($args); $cat_name = esc_attr( $category->name); $cat_name = apply_filters( 'list_cats', $cat_name, $category ); $...
19,675
<p>I have a custom content type "balloons", and I've assigned a parent category to a "balloon" item, "Water Balloon"</p> <p>I've made the Balloon category a primary menu item. I want a link to "Water Balloon" to show in the dropdown, as it would if it was a page.</p> <p>I don't know how to do this, or if it's possibl...
[ { "answer_id": 21330, "author": "Azizur Rahman", "author_id": 3797, "author_profile": "https://wordpress.stackexchange.com/users/3797", "pm_score": 0, "selected": false, "text": "<p>It's very likely you have some kind of collusion somewhere. Is it possible you have something like?</p>\n\...
2011/06/10
[ "https://wordpress.stackexchange.com/questions/19675", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/3702/" ]
I have a custom content type "balloons", and I've assigned a parent category to a "balloon" item, "Water Balloon" I've made the Balloon category a primary menu item. I want a link to "Water Balloon" to show in the dropdown, as it would if it was a page. I don't know how to do this, or if it's possible. Any ideas? Tha...
If i understand the question correct then you need this: ``` add_filter('walker_nav_menu_start_el','auto_category_subMenu',10,4); function auto_category_subMenu($item_output, $item, $depth, $args){ //first you check if the current item is a category if (!$item->object == 'category'){ return $item_outpu...
19,692
<p>Each time I register I end up in the wp-login page (back-end):</p> <p><img src="https://i.stack.imgur.com/WdvgR.png" alt="enter image description here"></p> <p>Is there any way of redirecting the users who register to a page template (front-end)?</p>
[ { "answer_id": 19698, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 5, "selected": true, "text": "<p>You can use the filter <code>registration_redirect</code> to pass back your own URL, for example;</p>\n\n<pr...
2011/06/10
[ "https://wordpress.stackexchange.com/questions/19692", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
Each time I register I end up in the wp-login page (back-end): ![enter image description here](https://i.stack.imgur.com/WdvgR.png) Is there any way of redirecting the users who register to a page template (front-end)?
You can use the filter `registration_redirect` to pass back your own URL, for example; ``` function wpse_19692_registration_redirect() { return home_url( '/my-page' ); } add_filter( 'registration_redirect', 'wpse_19692_registration_redirect' ); ``` Drop it in your `functions.php` or a plugin :)
19,696
<p>My for-fun WordPress blog at <a href="http://fakeplasticrock.com" rel="noreferrer">http://fakeplasticrock.com</a> (running WordPress 3.1.1) got hacked -- it was showing an <code>&lt;iframe&gt;</code> on every page like so:</p> <pre><code>&lt;iframe src="http://evilsite.com/go/1"&gt;&lt;/iframe&gt; &lt;!DOCTYPE html...
[ { "answer_id": 19699, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 4, "selected": false, "text": "<p>The database can contain malicious code too: hidden user accounts or values that are printed unescaped somewhere. Also...
2011/06/10
[ "https://wordpress.stackexchange.com/questions/19696", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/152/" ]
My for-fun WordPress blog at <http://fakeplasticrock.com> (running WordPress 3.1.1) got hacked -- it was showing an `<iframe>` on every page like so: ``` <iframe src="http://evilsite.com/go/1"></iframe> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html...
Have you identified the exploit vector? If not, you may be leaving yourself open to future exploit. Other things to consider: 1. Change WordPress admin user passwords - *done* 2. Change Hosting account user password 3. Change **FTP passwords** 4. Change MySQL db user password - *done* 5. [Change the **db table prefix...
19,710
<p>How do I add a class to the comment submit button? The simplified function <code>comment_form(array('id_submit'=&gt;'buttonPro'));</code> obviously only changes the id and <code>class_submit</code> does not seem to exist.</p> <p>I have read through both <a href="http://ottopress.com/2010/wordpress-3-0-theme-tip-th...
[ { "answer_id": 19713, "author": "TheDeadMedic", "author_id": 1685, "author_profile": "https://wordpress.stackexchange.com/users/1685", "pm_score": 4, "selected": true, "text": "<p>If you check out the source of the function <code>comment_form()</code>, you'll see it doesn't even print a ...
2011/06/10
[ "https://wordpress.stackexchange.com/questions/19710", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1057/" ]
How do I add a class to the comment submit button? The simplified function `comment_form(array('id_submit'=>'buttonPro'));` obviously only changes the id and `class_submit` does not seem to exist. I have read through both [Otto's](http://ottopress.com/2010/wordpress-3-0-theme-tip-the-comment-form/) and [Beau's](http:...
If you check out the source of the function `comment_form()`, you'll see it doesn't even print a class on the input; ``` <input name="submit" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>" value="<?php echo esc_attr( $args['label_submit'] ); ?>" /> ``` I'm guessing you need to add a class for styli...
19,717
<p>I know that WP 3.1 has added support for archives for custom post types but is there any way to customize the permalinks for them? </p>
[ { "answer_id": 19720, "author": "Hameedullah Khan", "author_id": 5337, "author_profile": "https://wordpress.stackexchange.com/users/5337", "pm_score": 2, "selected": true, "text": "<p>Take an example custom post type called <code>movie</code> the code below will create custom permalinks ...
2011/06/10
[ "https://wordpress.stackexchange.com/questions/19717", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2234/" ]
I know that WP 3.1 has added support for archives for custom post types but is there any way to customize the permalinks for them?
Take an example custom post type called `movie` the code below will create custom permalinks `awesomemovies/` regardless of the one created by using the has\_archive and rewrite options of register\_post\_type. ``` add_filter( 'rewrite_rules_array', 'custom_permalink_for_my_cpt' ); function custom_permalink_for_my_cpt...
19,732
<p>My source links are something linke this :</p> <pre><code>http://sample.com/entertainment/default.aspx?tabid=2305&amp;conid=102950 http://sample.com/entertainment/default.aspx?tabid=2418&amp;conid=104330 http://sample.com/entertainment/default.aspx?tabid=2429&amp;conid=104264 http://sample.com/entertainment/default...
[ { "answer_id": 19746, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>To save the link in the post meta you can use <code>update_post_meta</code></p>\n\n<p>like this for example:</...
2011/06/10
[ "https://wordpress.stackexchange.com/questions/19732", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6097/" ]
My source links are something linke this : ``` http://sample.com/entertainment/default.aspx?tabid=2305&conid=102950 http://sample.com/entertainment/default.aspx?tabid=2418&conid=104330 http://sample.com/entertainment/default.aspx?tabid=2429&conid=104264 http://sample.com/entertainment/default.aspx?tabid=2305&conid=102...
To save the link in the post meta you can use `update_post_meta` like this for example: ``` $url = "http://sample.com/entertainment/default.aspx?tabid=2305&conid=102950" $my_post = array( 'post_title' => "$title", 'post_content' => "$content", 'post_status' => 'draft', 'post_author' => 1, 'post_ca...
19,735
<p>I'm using PHP to dynamically create a custom post, and I need the author to be someone other than the logged in user. I found this <a href="https://stackoverflow.com/questions/5759359/wordpress-manually-set-the-author-of-a-post-in-php">https://stackoverflow.com/questions/5759359/wordpress-manually-set-the-author-of-...
[ { "answer_id": 19739, "author": "Álex Acuña Viera", "author_id": 6099, "author_profile": "https://wordpress.stackexchange.com/users/6099", "pm_score": 3, "selected": true, "text": "<p>If you know the ID of the author you can use wp_insert_post specifying the ID and the author ID to it.</...
2011/06/10
[ "https://wordpress.stackexchange.com/questions/19735", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4229/" ]
I'm using PHP to dynamically create a custom post, and I need the author to be someone other than the logged in user. I found this <https://stackoverflow.com/questions/5759359/wordpress-manually-set-the-author-of-a-post-in-php> but I'm wondering if there is a way to do it after the post is already inserted. I guess I c...
If you know the ID of the author you can use wp\_insert\_post specifying the ID and the author ID to it. ``` $id = $post->ID; // change this to whathever $user_id = '4'; // change this too $the_post = array(); $the_post['ID'] = $id; $the_post['post_author'] = $user_id; wp_insert_post( $the_post ); ``` The trick is...
19,753
<p>I'm working on a recipe site that has a custom post type, recipes, with two custom taxonomies for handling recipe categories and tags. The custom post type works and so does the custom taxonomy for the categories, i.e. i can access individual posts and category pages. However, when I try to access a custom taxonomy ...
[ { "answer_id": 19755, "author": "Dave Konopka", "author_id": 3837, "author_profile": "https://wordpress.stackexchange.com/users/3837", "pm_score": 0, "selected": false, "text": "<p>I've run into odd issues with 404's around custom post types/taxonomies. Try hitting save again on the blog...
2011/06/11
[ "https://wordpress.stackexchange.com/questions/19753", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6104/" ]
I'm working on a recipe site that has a custom post type, recipes, with two custom taxonomies for handling recipe categories and tags. The custom post type works and so does the custom taxonomy for the categories, i.e. i can access individual posts and category pages. However, when I try to access a custom taxonomy tag...
I've run into this issues too, two time, two differents errors, first time I just go to permalink structure in the wordpress options and hit save, that was a problem witht my htaccess files, and the second time it was the way I register the slug, Here is a complete working exemple : ``` /* Post type : offre_emploi *...
19,769
<p>I noticed in google that actually searches in my blog are getting indexed on multiple pages resulting in duplicate content. Suggestions on how to stop this? example</p> <p>/</p> <pre><code>?s=radiofixes /page/10/?s=radiofixes /page/11/?s=radiofixes /page/2/?s=radiofixes /page/3/?s=radiofixes /page/4/?s=radiofixe...
[ { "answer_id": 19755, "author": "Dave Konopka", "author_id": 3837, "author_profile": "https://wordpress.stackexchange.com/users/3837", "pm_score": 0, "selected": false, "text": "<p>I've run into odd issues with 404's around custom post types/taxonomies. Try hitting save again on the blog...
2011/06/11
[ "https://wordpress.stackexchange.com/questions/19769", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5825/" ]
I noticed in google that actually searches in my blog are getting indexed on multiple pages resulting in duplicate content. Suggestions on how to stop this? example / ``` ?s=radiofixes /page/10/?s=radiofixes /page/11/?s=radiofixes /page/2/?s=radiofixes /page/3/?s=radiofixes /page/4/?s=radiofixes /page/5/?s=radiofixes...
I've run into this issues too, two time, two differents errors, first time I just go to permalink structure in the wordpress options and hit save, that was a problem witht my htaccess files, and the second time it was the way I register the slug, Here is a complete working exemple : ``` /* Post type : offre_emploi *...
19,775
<p>In my header I use this code:</p> <pre><code>if(is_page("stores")) { // Do something } </code></pre> <p>I run some code if on the page <code>stores</code> but what I want to do is run that code if the page is <code>stores</code> or any page that is a sub page of stores. Not only that, but is recursive so if we...
[ { "answer_id": 19755, "author": "Dave Konopka", "author_id": 3837, "author_profile": "https://wordpress.stackexchange.com/users/3837", "pm_score": 0, "selected": false, "text": "<p>I've run into odd issues with 404's around custom post types/taxonomies. Try hitting save again on the blog...
2011/06/11
[ "https://wordpress.stackexchange.com/questions/19775", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/4610/" ]
In my header I use this code: ``` if(is_page("stores")) { // Do something } ``` I run some code if on the page `stores` but what I want to do is run that code if the page is `stores` or any page that is a sub page of stores. Not only that, but is recursive so if we are on a sub sub sub page of `stores` the code ...
I've run into this issues too, two time, two differents errors, first time I just go to permalink structure in the wordpress options and hit save, that was a problem witht my htaccess files, and the second time it was the way I register the slug, Here is a complete working exemple : ``` /* Post type : offre_emploi *...
19,776
<p>I just bought and installed the <a href="http://www.justin-klein.com/projects/wp-fb-autoconnect" rel="nofollow">WP-Facebook-AutoConnect</a> plugin but I am unable to login.</p> <p>Below is the debug log I got by email.</p> <pre><code> ---LOG:--- Starting login process (Client: 178.156.161.15, Version: 2.0.4, Brows...
[ { "answer_id": 19788, "author": "Otto", "author_id": 2232, "author_profile": "https://wordpress.stackexchange.com/users/2232", "pm_score": 2, "selected": false, "text": "<p>Facebook's connect.registerUsers method is deprecated and doesn't work anymore.</p>\n\n<p>Basically, the plugin is ...
2011/06/11
[ "https://wordpress.stackexchange.com/questions/19776", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/944/" ]
I just bought and installed the [WP-Facebook-AutoConnect](http://www.justin-klein.com/projects/wp-fb-autoconnect) plugin but I am unable to login. Below is the debug log I got by email. ``` ---LOG:--- Starting login process (Client: 178.156.161.15, Version: 2.0.4, Browser: Chrome 13.0.782.15 for Mac) PREMIUM: Premiu...
I used the *premium* plugin and I had to solve the following problems: * remove the application from facebook, because initially I allowed access to the proxied email address. Verifiy that your facebook account is a verified account before adding the application, otherwise the application will default to proxied email...
19,779
<p>How can I change the standard 7MB upload limit?</p> <p>I have full shell and admin access to my Wordpress blog.</p>
[ { "answer_id": 19781, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>add this to your .htaccess file in the root of WordPress installation directory:</p>\n\n<pre><code>php_value u...
2011/06/11
[ "https://wordpress.stackexchange.com/questions/19779", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6117/" ]
How can I change the standard 7MB upload limit? I have full shell and admin access to my Wordpress blog.
add this to your .htaccess file in the root of WordPress installation directory: ``` php_value upload_max_filesize 20M php_value post_max_size 20M ``` and you can change 20 to whatever you want, unless your hosting server is limiting it it should work just fine. Update: ------- Create the php.ini File and add the ...
19,792
<p>I'm queueing several scripts in my themes Functions.php:</p> <pre><code>if ( ! function_exists('b99_init_scripts') ) : function b99_init_scripts(){ if ( !is_admin()){ wp_deregister_script('jquery'); wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jque...
[ { "answer_id": 19794, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 2, "selected": false, "text": "<p><code>wp_enqueue_scripts</code> is fine if it works for you. or <code>wp_print_scripts</code> is also an option.</p...
2011/06/11
[ "https://wordpress.stackexchange.com/questions/19792", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5430/" ]
I'm queueing several scripts in my themes Functions.php: ``` if ( ! function_exists('b99_init_scripts') ) : function b99_init_scripts(){ if ( !is_admin()){ wp_deregister_script('jquery'); wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js', fa...
I would suggest creating a function named `b99_register_scripts()` and hook this into `init`. Then you can create another function named `b99_enqueue_scripts()` and hook it into `wp_print_scripts`.
19,795
<p>I am having difficulty with Wordpress continually changing my code on me. IE: </p> <p><strong>FROM THIS:</strong> </p> <pre><code>&lt;script type="text/javascript" src="&lt;?php echo get_stylesheet_directory_uri(); ?&gt;/js/swfobject.js" &gt;&lt;/script&gt; </code></pre> <p><strong>TO:</strong></p> <pre><code>&l...
[ { "answer_id": 19794, "author": "Milo", "author_id": 4771, "author_profile": "https://wordpress.stackexchange.com/users/4771", "pm_score": 2, "selected": false, "text": "<p><code>wp_enqueue_scripts</code> is fine if it works for you. or <code>wp_print_scripts</code> is also an option.</p...
2011/06/09
[ "https://wordpress.stackexchange.com/questions/19795", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/15737/" ]
I am having difficulty with Wordpress continually changing my code on me. IE: **FROM THIS:** ``` <script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/swfobject.js" ></script> ``` **TO:** ``` <script src="&lt;?php echo get_stylesheet_directory_uri(); ?" type="text/javascript">// <!...
I would suggest creating a function named `b99_register_scripts()` and hook this into `init`. Then you can create another function named `b99_enqueue_scripts()` and hook it into `wp_print_scripts`.
19,822
<p>On the homepage I want to display the latest 4 posts from the 'news' and 'events' category, whereas on the events page, I just want to display all posts in the 'events' category in WP's usual paginated form if there is a lot of them.</p> <p>Do you know of any plugin that handles this kind of rules based post genera...
[ { "answer_id": 19836, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": -1, "selected": false, "text": "<p>Take a look at List category posts plugin <a href=\"http://wordpress.org/extend/plugins/list-category-posts/...
2011/06/12
[ "https://wordpress.stackexchange.com/questions/19822", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6138/" ]
On the homepage I want to display the latest 4 posts from the 'news' and 'events' category, whereas on the events page, I just want to display all posts in the 'events' category in WP's usual paginated form if there is a lot of them. Do you know of any plugin that handles this kind of rules based post generation? If n...
you should maybe think about using one of Wordpress' built in queries for this sort of thing and create yourself a couple of custom loops. There probably are plugins out there that can do this for you but as a general rule it's better to reduce reliance on 3rd party scripts wherever possible. To do what you have descr...
19,824
<p>I'm using different method to form a gallery in Wordpress, so I would like to hide an option to insert images and galleries into post for anyone but Administrator.</p> <p>Can someone show me an example how it's done?</p>
[ { "answer_id": 19827, "author": "mike23", "author_id": 1381, "author_profile": "https://wordpress.stackexchange.com/users/1381", "pm_score": 1, "selected": false, "text": "<p>To remove elements in the media editor, you can <em>unset</em> them. I haven't tested it for the insert button, b...
2011/06/12
[ "https://wordpress.stackexchange.com/questions/19824", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5744/" ]
I'm using different method to form a gallery in Wordpress, so I would like to hide an option to insert images and galleries into post for anyone but Administrator. Can someone show me an example how it's done?
If you actually wanted to remove it instead of just hiding it you could remove the 'admin-gallery' script that is used to insert the gallery settings form. And if you wanted it to be remove only for non-admins then something like this should work: ``` function disable_wp_gallery() { if( !current_user_can('manage_o...
19,838
<p>I'd like users to be able to create and remove additional meta box fields as needed.</p> <p>For example, say a music podcast with a variable amount of songs played per episode. The user should be able to click a button that will add additional fields to enter each song as needed. </p> <p>Ideally this would be don...
[ { "answer_id": 19843, "author": "Elpie", "author_id": 2761, "author_profile": "https://wordpress.stackexchange.com/users/2761", "pm_score": 2, "selected": false, "text": "<p>This is done through custom fields BUT you should never use anything that lets users <strike>add</strike> create o...
2011/06/12
[ "https://wordpress.stackexchange.com/questions/19838", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5302/" ]
I'd like users to be able to create and remove additional meta box fields as needed. For example, say a music podcast with a variable amount of songs played per episode. The user should be able to click a button that will add additional fields to enter each song as needed. Ideally this would be done without the use...
So you mean something like this? ![enter image description here](https://i.stack.imgur.com/rMmRt.png) and when you click on Add tracks it becomes this: ![enter image description here](https://i.stack.imgur.com/IZKzR.png) If this is what you mean, it's done by creating a metabox that has a simple jQuery function to ...
19,854
<p>I have a custom post type without title support and I'm trying to generate one from post's taxonomies and custom fields. To do so, I'm using this code:</p> <pre><code>function custom_post_type_title_filter( $data , $postarr ) { if ($postarr['post_type'] == 'cars'){ $id = get_the_ID(); ...
[ { "answer_id": 19855, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 1, "selected": false, "text": "<p>Hook into the action <code>'save_post'</code> (<a href=\"https://wordpress.stackexchange.com/questions/17386/custom-fi...
2011/06/13
[ "https://wordpress.stackexchange.com/questions/19854", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/5744/" ]
I have a custom post type without title support and I'm trying to generate one from post's taxonomies and custom fields. To do so, I'm using this code: ``` function custom_post_type_title_filter( $data , $postarr ) { if ($postarr['post_type'] == 'cars'){ $id = get_the_ID(); $engine= '...
You can try the following code. ``` function custom_post_type_title ( $post_id ) { global $wpdb; if ( get_post_type( $post_id ) == 'cars' ) { $engine= ', '.get_post_meta($post_id, 'Engine', true).'l'; $terms = wp_get_object_terms($post_id, 'brand'); $abrand= ' '.$terms[0]->name; ...
19,863
<p>I am using a plugin to forward photo posts from wordpress to a tumblr blog.</p> <p>I have the following code:</p> <pre> //post blog to tumblr function postBlogTumblr($postID) { $URLServer = "http://www.tumblr.com/api/write"; $t_post = get_post($postID); $t_url = get_permalink($postID); $tumblr_data...
[ { "answer_id": 19876, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": false, "text": "<p>you can use this snippet to get the first image of a post attachment id:</p>\n\n<pre><code>$images =&amp; get...
2011/06/13
[ "https://wordpress.stackexchange.com/questions/19863", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6149/" ]
I am using a plugin to forward photo posts from wordpress to a tumblr blog. I have the following code: ``` //post blog to tumblr function postBlogTumblr($postID) { $URLServer = "http://www.tumblr.com/api/write"; $t_post = get_post($postID); $t_url = get_permalink($postID); $tumblr_data = unserialize(...
you can use this snippet to get the first image of a post attachment id: ``` $images =& get_children( 'post_type=attachment&post_mime_type=image&post_parent=' . $postID ); $attachment_id = $images[0]->ID; ```
19,874
<p>Im just wondering if its possible to create user role that allows to write/edit custom post type for example: Consultants, but not allow to write normal posts (used for as news for example).</p> <p>I know that if user wants to edit posts its a must to have edit_post enabled for him. Question is if i can create some...
[ { "answer_id": 19876, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": false, "text": "<p>you can use this snippet to get the first image of a post attachment id:</p>\n\n<pre><code>$images =&amp; get...
2011/06/13
[ "https://wordpress.stackexchange.com/questions/19874", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6152/" ]
Im just wondering if its possible to create user role that allows to write/edit custom post type for example: Consultants, but not allow to write normal posts (used for as news for example). I know that if user wants to edit posts its a must to have edit\_post enabled for him. Question is if i can create something lik...
you can use this snippet to get the first image of a post attachment id: ``` $images =& get_children( 'post_type=attachment&post_mime_type=image&post_parent=' . $postID ); $attachment_id = $images[0]->ID; ```
19,883
<p>I'm building a content slider that needs to show posts from a custom post type called "Features," and also show standard blog posts that are assigned to a "Featured" category. I'd like to do this within a single loop. Can anyone help me put together the query that could handle this?</p>
[ { "answer_id": 19885, "author": "lsparks", "author_id": 6156, "author_profile": "https://wordpress.stackexchange.com/users/6156", "pm_score": 0, "selected": false, "text": "<p>Fix paging issues:</p>\n\n<pre><code>$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;\n</code></p...
2011/06/13
[ "https://wordpress.stackexchange.com/questions/19883", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6154/" ]
I'm building a content slider that needs to show posts from a custom post type called "Features," and also show standard blog posts that are assigned to a "Featured" category. I'd like to do this within a single loop. Can anyone help me put together the query that could handle this?
``` $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts( array( 'post_type' => array( 'post', 'features', ), 'category_name' => 'Featured', 'paged' => $paged ) ); // have some posts? if (have_posts())...
19,900
<p>There're the functions <code>get_theme_data();</code> &amp; <code>get_plugin_data();</code> - which both use <code>get_file_data();</code> that needs a specific file as <code>$input</code>.</p> <p>I got a set of classes that may be used by a plugin or a theme, without a specific location. Everything works, but I do...
[ { "answer_id": 19908, "author": "Hameedullah Khan", "author_id": 5337, "author_profile": "https://wordpress.stackexchange.com/users/5337", "pm_score": 3, "selected": false, "text": "<p>You can get theme's main file using following:</p>\n\n<pre><code>$theme_info_file = trailingslashit( ge...
2011/06/13
[ "https://wordpress.stackexchange.com/questions/19900", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/385/" ]
There're the functions `get_theme_data();` & `get_plugin_data();` - which both use `get_file_data();` that needs a specific file as `$input`. I got a set of classes that may be used by a plugin or a theme, without a specific location. Everything works, but I don't know how i would determine what the **main** plugin or...
### How do get the comment header data of a theme OR plugin... ... that holds a specific class. The following shows how you can drop a class inside any plugin or theme and still be able to get any theme or plugin data from the comment header. This is useful for updating settings/db-options for example. You **don't**...
19,907
<p>If I use a custom widgetized area (for example footer) where there is only a limited number of spots for widgets (by design), can I limit the number of widgets the user may include in that specific widgetized area? It doesn't matter if the solution is at the backend or the front end. Thank you.</p>
[ { "answer_id": 19921, "author": "kaiser", "author_id": 385, "author_profile": "https://wordpress.stackexchange.com/users/385", "pm_score": 0, "selected": false, "text": "<p>Interessting Q. Didn't find out much at a brief look, but here's a guess: <code>print_r( $GLOBALS['wp_registered_si...
2011/06/13
[ "https://wordpress.stackexchange.com/questions/19907", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/6155/" ]
If I use a custom widgetized area (for example footer) where there is only a limited number of spots for widgets (by design), can I limit the number of widgets the user may include in that specific widgetized area? It doesn't matter if the solution is at the backend or the front end. Thank you.
to help you with your question, I have a suggestion. Let's use the `first-footer-widget-area` present in the default Twenty Ten template `sidebar-footer.php` file like an example. As a good practice and secure, firstly backup it to avoid headaches. The original Twenty Ten template code for presenting first footer wid...