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
6,796
<p>I hope somebody would be kind enough to help. I currently have a page that orders all of the posts by comment count, but I want to change the loop to order the posts by view count. I have installed the 'wp-postviews.1.50' plugin and have got it to display the number of views on each post, so I know that side of it i...
[ { "answer_id": 6797, "author": "anu", "author_id": 490, "author_profile": "https://wordpress.stackexchange.com/users/490", "pm_score": 0, "selected": false, "text": "<p>From the plugin documentation</p>\n\n<blockquote>\n <p>To Display Most Viewed Posts Use:</p>\n</blockquote>\n\n<pre><c...
2011/01/12
[ "https://wordpress.stackexchange.com/questions/6796", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2447/" ]
I hope somebody would be kind enough to help. I currently have a page that orders all of the posts by comment count, but I want to change the loop to order the posts by view count. I have installed the 'wp-postviews.1.50' plugin and have got it to display the number of views on each post, so I know that side of it is w...
Just wanted to give an update. Someone was kind enough to show me how to update the code I posted above. It turned out to be quite simple (if you know what you're doing!). So I have posted it below for anyone that wants to do something similar. ``` <?php $posts_per_page = get_query_var('posts_per_page'); ?> <?php $pa...
6,798
<p>I've tried disabling WP's auto-paragraph thingy using</p> <p><code>remove_filter ('the_content', 'wpautop');</code></p> <p>but I am still getting my stuff wrapped in automatic <code>&lt;p&gt;</code> tags... What am I doing wrong?</p> <p>Its at the bottom of a functions file. Its not in functions.php, but in a fil...
[ { "answer_id": 6799, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>Your code is absolutely correct. You can try this snippet in template to ensure it is being removed:</p>\n\n<pre><cod...
2011/01/12
[ "https://wordpress.stackexchange.com/questions/6798", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1118/" ]
I've tried disabling WP's auto-paragraph thingy using `remove_filter ('the_content', 'wpautop');` but I am still getting my stuff wrapped in automatic `<p>` tags... What am I doing wrong? Its at the bottom of a functions file. Its not in functions.php, but in a file that functions.php includes (and putting it in fun...
Had same problem, fixed with css: ``` <style> p:empty{ height: 0; margin: 0; padding: 0; } </style> ```
6,800
<p>I use the following function in order to retrieve tags of a post, remove an element from the array and then set the result to the post:</p> <pre><code>$post_tags = wp_get_post_terms( $post_id ); foreach ( $post_tags as $key =&gt; $tag) { $tag_string = http_build_query( $tag ); if( 0 != strpos( $tag_string ,...
[ { "answer_id": 6802, "author": "onetrickpony", "author_id": 1986, "author_profile": "https://wordpress.stackexchange.com/users/1986", "pm_score": 1, "selected": false, "text": "<p><a href=\"http://codex.wordpress.org/Function_Reference/wp_get_post_terms\" rel=\"nofollow\">wp_get_post_ter...
2011/01/12
[ "https://wordpress.stackexchange.com/questions/6800", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1567/" ]
I use the following function in order to retrieve tags of a post, remove an element from the array and then set the result to the post: ``` $post_tags = wp_get_post_terms( $post_id ); foreach ( $post_tags as $key => $tag) { $tag_string = http_build_query( $tag ); if( 0 != strpos( $tag_string , 'tag-to-be-delet...
Your code looks little clunky, `http_build_query()` is definitely not meant for such. Also what you are fetching is not simple array, but array of tag objects. My take: ``` $post_tags = wp_get_post_terms( $post_id, 'post_tag', array( 'fields'=>'names' ) ); $pos = array_search( 'tag-to-be-deleted', $post_tags ); if( ...
6,811
<p>Is it possible to make a meta box that attaches multiple images to a post? </p>
[ { "answer_id": 6812, "author": "Zack", "author_id": 2322, "author_profile": "https://wordpress.stackexchange.com/users/2322", "pm_score": 0, "selected": false, "text": "<p>Yes it's quite possible. See a <a href=\"https://wordpress.stackexchange.com/questions/6557/redesigning-custom-post-...
2011/01/12
[ "https://wordpress.stackexchange.com/questions/6811", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1925/" ]
Is it possible to make a meta box that attaches multiple images to a post?
That depends entirely on what you mean by "attach." Each WordPress post can already have multiple media attachments - photos, documents, etc. You upload these using the built-in uploader and they'll all be marked as "attached" to that specific post ID. You can refer to these later programatically elsewhere. For examp...
6,818
<p>I have a custom post type created for a directory that will end up being sorted alphabetically. I will be sorting the posts in alphabetical order by title, so I want to make sure that the Title is entered as last name/first name. Is there a way to change that default help text -- "Enter Title Here" -- in my custom p...
[ { "answer_id": 6819, "author": "Martin-Al", "author_id": 1463, "author_profile": "https://wordpress.stackexchange.com/users/1463", "pm_score": 3, "selected": false, "text": "<p>Take a look in <a href=\"http://core.trac.wordpress.org/browser/tags/3.5/wp-admin/edit-form-advanced.php#L329\"...
2011/01/12
[ "https://wordpress.stackexchange.com/questions/6818", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2041/" ]
I have a custom post type created for a directory that will end up being sorted alphabetically. I will be sorting the posts in alphabetical order by title, so I want to make sure that the Title is entered as last name/first name. Is there a way to change that default help text -- "Enter Title Here" -- in my custom post...
There is no way to customize that string explicitly. But it is passed through translation function and so is easy to filter. Try something like this (don't forget to change to your post type): ``` add_filter('gettext','custom_enter_title'); function custom_enter_title( $input ) { global $post_type; if( is...
6,821
<p>My category descriptions are extremely long, so I don't want the descriptions to be used in the title attribute of my category lists. However, WP does this automatically when it outputs the default category widget in the markup.</p> <p>Is it possible to add a filter in functions.php that assigns the default value f...
[ { "answer_id": 6819, "author": "Martin-Al", "author_id": 1463, "author_profile": "https://wordpress.stackexchange.com/users/1463", "pm_score": 3, "selected": false, "text": "<p>Take a look in <a href=\"http://core.trac.wordpress.org/browser/tags/3.5/wp-admin/edit-form-advanced.php#L329\"...
2011/01/12
[ "https://wordpress.stackexchange.com/questions/6821", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
My category descriptions are extremely long, so I don't want the descriptions to be used in the title attribute of my category lists. However, WP does this automatically when it outputs the default category widget in the markup. Is it possible to add a filter in functions.php that assigns the default value for 'use\_d...
There is no way to customize that string explicitly. But it is passed through translation function and so is easy to filter. Try something like this (don't forget to change to your post type): ``` add_filter('gettext','custom_enter_title'); function custom_enter_title( $input ) { global $post_type; if( is...
6,829
<p>I've added a "Custom Title" field to the Category editor in order to capture a keyword friendly title that can be used separately from the category name. It works great, but it appears as the last input element of the category screen. Ideally, I would like it to sit under the "Name" field (or at the very top). Is th...
[ { "answer_id": 6836, "author": "MathSmath", "author_id": 1537, "author_profile": "https://wordpress.stackexchange.com/users/1537", "pm_score": 0, "selected": false, "text": "<p>There is no php-based solution without hacking core. Crack open the file <code>wp-admin/edt-tag-form.php</code>...
2011/01/12
[ "https://wordpress.stackexchange.com/questions/6829", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
I've added a "Custom Title" field to the Category editor in order to capture a keyword friendly title that can be used separately from the category name. It works great, but it appears as the last input element of the category screen. Ideally, I would like it to sit under the "Name" field (or at the very top). Is this ...
WordPress doesn't provide the hooks you want but it you are willing to use PHP's output buffering and `preg_replace()` you can get it to work without hacking core. Here's an answer that talks about the general technique required: * [**Removing Unnecessary Text from Admin Menu without CSS**](https://wordpress.stackexch...
6,840
<p>I'm not looking for a sitemap, I'm looking to create an xml file that I can have a flash menu access, but I don't want to generate the XML file each time someone visits a page, I want to have a static XML to refer to for speed. And I'd like to have wordpress update the file whenever new content is posted(not comment...
[ { "answer_id": 6841, "author": "MathSmath", "author_id": 1537, "author_profile": "https://wordpress.stackexchange.com/users/1537", "pm_score": 1, "selected": true, "text": "<p>Hmm... not sure if there are any WordPress-specific functions for creating files. There's wp_handle_upload, but ...
2011/01/12
[ "https://wordpress.stackexchange.com/questions/6840", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2457/" ]
I'm not looking for a sitemap, I'm looking to create an xml file that I can have a flash menu access, but I don't want to generate the XML file each time someone visits a page, I want to have a static XML to refer to for speed. And I'd like to have wordpress update the file whenever new content is posted(not comments)....
Hmm... not sure if there are any WordPress-specific functions for creating files. There's wp\_handle\_upload, but I'm not sure how you'd use it in this context. Depending on your server configuration, you can probably just use fopen and fwrite to do this. Keep the code you're currently using (with your custom loops....
6,856
<p>I'm questioning how i can <strong>get rid of the post-editor</strong> (visual + html). I tried to not register post type support, and it still appears (de-registering works fine with every other default meta box on post edit screen). I also tried to deregister it with remove_meta_box, which didn't work too (works fo...
[ { "answer_id": 6857, "author": "Carson", "author_id": 2107, "author_profile": "https://wordpress.stackexchange.com/users/2107", "pm_score": 2, "selected": false, "text": "<p>I use the Custom Post Type UI plugin to create custom post types. Using this plugin, you can disable the post-edi...
2011/01/13
[ "https://wordpress.stackexchange.com/questions/6856", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/385/" ]
I'm questioning how i can **get rid of the post-editor** (visual + html). I tried to not register post type support, and it still appears (de-registering works fine with every other default meta box on post edit screen). I also tried to deregister it with remove\_meta\_box, which didn't work too (works for everything e...
Giving a blank array to 'supports' in the declaration of the post type should get rid of the editor and the title, along with every other default box in the edit post page. ``` $supports = array (''); $args = array( 'label' => 'people', 'supports' => $supports, 'hierarchical' => false, 'pub...
6,859
<p>I have an excel spreadsheet that needs to get on a WP site PDQ and IE is choking on it.</p> <p>I tried making an html table, but it's huge.</p> <p>I looked into some kind a database plugin that would let me import a cvs and then let users browse it, but I can't even figure out the right search terms.</p> <p>I would ...
[ { "answer_id": 6862, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 3, "selected": false, "text": "<p>Do you need this data properly integrated in WordPress or merely available for users to view?</p>\n\n<p>If latter I'd...
2011/01/13
[ "https://wordpress.stackexchange.com/questions/6859", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2469/" ]
I have an excel spreadsheet that needs to get on a WP site PDQ and IE is choking on it. I tried making an html table, but it's huge. I looked into some kind a database plugin that would let me import a cvs and then let users browse it, but I can't even figure out the right search terms. I would appreciate any input....
If you're using Google Docs, then this plugin [Google Spreadsheet Viewer](http://wordpress.org/extend/plugins/inline-google-spreadsheet-viewer/) might be helpful.
6,873
<p>I had asked a question earlier, on <a href="https://wordpress.stackexchange.com/q/6190/1606">getting post-thumbnails from another WP-site</a>. There, the awesome <a href="https://wordpress.stackexchange.com/users/89/mikeschinkel">Mike</a> coded a SQL query whose results are then passes on to a PHP array. The piece o...
[ { "answer_id": 6877, "author": "hakre", "author_id": 178, "author_profile": "https://wordpress.stackexchange.com/users/178", "pm_score": 2, "selected": false, "text": "<p>I must admit that I do not really know if it is wise to use the power of WP image_resice on HTTP linked images. I wou...
2011/01/13
[ "https://wordpress.stackexchange.com/questions/6873", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1606/" ]
I had asked a question earlier, on [getting post-thumbnails from another WP-site](https://wordpress.stackexchange.com/q/6190/1606). There, the awesome [Mike](https://wordpress.stackexchange.com/users/89/mikeschinkel) coded a SQL query whose results are then passes on to a PHP array. The piece of code from that answer t...
Calling `image_resize()` would be difficult, since it would search for the image in your main blog's upload directory. If it is a fixed image size I would just add it to the configuration of your photoblog, so it is created there when you upload new images (you can then [rebuild your old image thumbnails](https://wordp...
6,883
<p>I've done this with posts, but I can't find the proper way to reference the category table's columns.</p> <p>I'm trying to add a column titled "Image" to the table, so that when the table grid of categories is displayed, if there is a category image assigned to the category, it will appear in the grid.</p> <p>The ...
[ { "answer_id": 6885, "author": "Jan Fabry", "author_id": 8, "author_profile": "https://wordpress.stackexchange.com/users/8", "pm_score": 4, "selected": true, "text": "<p>The filter is <a href=\"http://core.trac.wordpress.org/browser/tags/3.0.4/wp-admin/includes/template.php#L761\"><code>...
2011/01/13
[ "https://wordpress.stackexchange.com/questions/6883", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
I've done this with posts, but I can't find the proper way to reference the category table's columns. I'm trying to add a column titled "Image" to the table, so that when the table grid of categories is displayed, if there is a category image assigned to the category, it will appear in the grid. The first step for me...
The filter is [`manage_{$screen->id}_columns`](http://core.trac.wordpress.org/browser/tags/3.0.4/wp-admin/includes/template.php#L761), and `$screen->id` is `edit-category`, giving you `manage_edit-category_columns`. I found this by placing a `var_dump()` in `get_column_headers()`, which is called by `print_column_head...
6,884
<p>I've created a custom post section and removed all of the default items (title, editor, etc...) using add_action and added my own custom meta boxes.</p> <p>The Issue: Since i've removed the default Title box there's no way to get back into the post since it shows the custom meta box content in custom columns on the...
[ { "answer_id": 6885, "author": "Jan Fabry", "author_id": 8, "author_profile": "https://wordpress.stackexchange.com/users/8", "pm_score": 4, "selected": true, "text": "<p>The filter is <a href=\"http://core.trac.wordpress.org/browser/tags/3.0.4/wp-admin/includes/template.php#L761\"><code>...
2011/01/13
[ "https://wordpress.stackexchange.com/questions/6884", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1114/" ]
I've created a custom post section and removed all of the default items (title, editor, etc...) using add\_action and added my own custom meta boxes. The Issue: Since i've removed the default Title box there's no way to get back into the post since it shows the custom meta box content in custom columns on the top leve...
The filter is [`manage_{$screen->id}_columns`](http://core.trac.wordpress.org/browser/tags/3.0.4/wp-admin/includes/template.php#L761), and `$screen->id` is `edit-category`, giving you `manage_edit-category_columns`. I found this by placing a `var_dump()` in `get_column_headers()`, which is called by `print_column_head...
6,891
<p>In my WordPress plugin I have a php file that generates some stats about the blog and outputs it as a simple text file. To access WordPress functions I've included this at the top of the file:</p> <pre><code>define('WP_USE_THEMES', false); require(dirname(__FILE__) . '/../../../wp-blog-header.php'); </code></pre> ...
[ { "answer_id": 6895, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 4, "selected": true, "text": "<p>Mark,</p>\n\n<p>I hate to say it, but you're going about this the wrong way. PHP files in your plug-in should <em>neve...
2011/01/13
[ "https://wordpress.stackexchange.com/questions/6891", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
In my WordPress plugin I have a php file that generates some stats about the blog and outputs it as a simple text file. To access WordPress functions I've included this at the top of the file: ``` define('WP_USE_THEMES', false); require(dirname(__FILE__) . '/../../../wp-blog-header.php'); ``` Now I'd like to hide th...
Mark, I hate to say it, but you're going about this the wrong way. PHP files in your plug-in should *never* be accessed directly in this way. Instead, they should be loaded from within WordPress just like everything else. Here are some alternative paths you could take: **Create an admin page that displays your stats...
6,901
<p>Current state: I'm parsing XML feeds into the front end and/or the back end (Admin UI), but not into the DB. Inside those feeds i place mp3- and video content, currently only as plain text (no link, no player).</p> <p>Future goal: I want to change the above behavior so visitors can watch/listen to video/audio conte...
[ { "answer_id": 6949, "author": "Patriek", "author_id": 2434, "author_profile": "https://wordpress.stackexchange.com/users/2434", "pm_score": 0, "selected": false, "text": "<p>If your trying to replace XML Data I think the best way would be to use the XMLParser functions or the Simple XML...
2011/01/13
[ "https://wordpress.stackexchange.com/questions/6901", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/170/" ]
Current state: I'm parsing XML feeds into the front end and/or the back end (Admin UI), but not into the DB. Inside those feeds i place mp3- and video content, currently only as plain text (no link, no player). Future goal: I want to change the above behavior so visitors can watch/listen to video/audio content. What ...
I believe part of what you're looking for is the WP\_Embed class defined in wp-includes/media.php. It implements a framework for automatically replacing urls with the output of embed handlers. I'm afraid you'll have to do the deeper research yourself (this was apparently introduces in 2.9.0, so documentation might stil...
6,903
<p>I have been working hard trying to understand regular-expressions to use in my web site using the redirection plugin. I have changed my permalinks a few times in the past year because I did not know better or had incorrect advice. The upshot of this is that Google web master tools shows hundreds of 404's. </p> <p...
[ { "answer_id": 6919, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>Try putting -? or -* at the end of your regex.</p>\n" }, { "answer_id": 6974, "author": "Jan Fabry", ...
2011/01/13
[ "https://wordpress.stackexchange.com/questions/6903", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I have been working hard trying to understand regular-expressions to use in my web site using the redirection plugin. I have changed my permalinks a few times in the past year because I did not know better or had incorrect advice. The upshot of this is that Google web master tools shows hundreds of 404's. I decided t...
It seems you can have both post ID's and numbers in the page slug. So `my-post-2` could be `my-post` with post ID `2` or `my-post-2` with no post ID. In theory there is no way to solve this, but in practice maybe we can assume that you won't have ten similar slugs, so the slug number is at most one digit, and the post ...
6,906
<p>I am inserting an image in a post and I want it to point to the post detail page, not the attachment.</p> <p>What should I do?</p> <p>Thanks in advance.</p>
[ { "answer_id": 6919, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>Try putting -? or -* at the end of your regex.</p>\n" }, { "answer_id": 6974, "author": "Jan Fabry", ...
2011/01/13
[ "https://wordpress.stackexchange.com/questions/6906", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/971/" ]
I am inserting an image in a post and I want it to point to the post detail page, not the attachment. What should I do? Thanks in advance.
It seems you can have both post ID's and numbers in the page slug. So `my-post-2` could be `my-post` with post ID `2` or `my-post-2` with no post ID. In theory there is no way to solve this, but in practice maybe we can assume that you won't have ten similar slugs, so the slug number is at most one digit, and the post ...
6,908
<p>I've basically done a full plugin and now just "prettifying" it sort-of. One thing I'm doing is re-doing the columns for listing the "posts" I made. This part is fine, and all columns are replaced as needed, however, there's one column that puzzles me.. the title field. :/</p> <pre><code> add_action( 'manage_pos...
[ { "answer_id": 6938, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 1, "selected": false, "text": "<p>Hi <strong>@Zack:</strong> </p>\n\n<p>I'm going out on a limb here since your question wasn't clear. It sounds l...
2011/01/13
[ "https://wordpress.stackexchange.com/questions/6908", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2322/" ]
I've basically done a full plugin and now just "prettifying" it sort-of. One thing I'm doing is re-doing the columns for listing the "posts" I made. This part is fine, and all columns are replaced as needed, however, there's one column that puzzles me.. the title field. :/ ``` add_action( 'manage_posts_custom_colu...
I did a slight hack for this to work. I added a hidden field named "post\_title" as if I'm enabling Title support, though without actually having the ugly title bar positioned. ``` <div id="titlewrap"> <input type="hidden" name="post_title" size="30" tabindex="1" value="" id="title" autocomplete="off" /> </div> ...
6,909
<p>I have a Theme Options page where the user can add certain options like Facebook links, etc. One of the options is for some ad code and when saving it as an option it gets escaped over and over again.</p> <p>What's the best approach for saving code inserted in an admin page <code>&lt;textarea&gt;</code> using <code...
[ { "answer_id": 6912, "author": "onetrickpony", "author_id": 1986, "author_profile": "https://wordpress.stackexchange.com/users/1986", "pm_score": 4, "selected": true, "text": "<pre><code>stripslashes(wp_filter_post_kses(addslashes($_POST['sidebar_code'])));\n</code></pre>\n\n<p>but you s...
2011/01/13
[ "https://wordpress.stackexchange.com/questions/6909", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/20/" ]
I have a Theme Options page where the user can add certain options like Facebook links, etc. One of the options is for some ad code and when saving it as an option it gets escaped over and over again. What's the best approach for saving code inserted in an admin page `<textarea>` using `update_option( 'sidebar_code', ...
``` stripslashes(wp_filter_post_kses(addslashes($_POST['sidebar_code']))); ``` but you should know that the kses filter is not 100% safe.
6,916
<p>In the code snippet below, I trying to get the_excerpt to be written out without tags. However, the source formatting shows that the_excerpt is always wrapped in P tags. How can I pull the excerpt without tags?</p> <pre><code>foreach($myrecentposts as $idxrecent=&gt;$post) { ?&gt; &lt;li class="page_item"&gt; ...
[ { "answer_id": 6918, "author": "goldenapples", "author_id": 290, "author_profile": "https://wordpress.stackexchange.com/users/290", "pm_score": 3, "selected": false, "text": "<p>What about removing the <code>wpautop</code> filter before your list? </p>\n\n<pre><code>remove_filter( 'the_e...
2011/01/13
[ "https://wordpress.stackexchange.com/questions/6916", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
In the code snippet below, I trying to get the\_excerpt to be written out without tags. However, the source formatting shows that the\_excerpt is always wrapped in P tags. How can I pull the excerpt without tags? ``` foreach($myrecentposts as $idxrecent=>$post) { ?> <li class="page_item"> <a href="<?php the_perm...
in your code above use `get_the_excerpt()` instead of `the_excerpt()`, because the last one will output the excerpt to the screen, and not pass it to your other functions...
6,950
<p>I'm writing a plugin called 'Featured Releases' for a client. The user fills out a short form in the admin area which inserts some text and an image id into the wordpress database via $wpdb->insert. On my development machine it works fine, but on the production server (which has over 500 posts of all sorts, mostly...
[ { "answer_id": 6957, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>Cryptic indeed. Something goes wrong only in production and only on brief stage of query execution (which is used ext...
2011/01/14
[ "https://wordpress.stackexchange.com/questions/6950", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I'm writing a plugin called 'Featured Releases' for a client. The user fills out a short form in the admin area which inserts some text and an image id into the wordpress database via $wpdb->insert. On my development machine it works fine, but on the production server (which has over 500 posts of all sorts, mostly imag...
Great advice Rarst! The output of $wpdb->queries was exactly what it should be: ``` "INSERT INTO `wp_featured_releases` (`fr_band`,`fr_album`,`fr_album_description`,`fr_image_id`,`fr_shop_url`,`fr_modified`) VALUES ('','','','504','','2011-01-14 10:49:58pm')" ``` 504 is the correct id for the image, but the value in...
6,953
<p>How do I limit the query by two custom meta fields, a start date and an end date? This is what my data looks like:</p> <pre> meta_key | meta_value | ------------------------| start_date | 20100131 | //Jan 15, 2010 end_date | 20100206 | //Feb 6, 2010 ------------------------' $today = date(YYYYMMDD); </pre>...
[ { "answer_id": 6964, "author": "anu", "author_id": 490, "author_profile": "https://wordpress.stackexchange.com/users/490", "pm_score": 0, "selected": false, "text": "<p>The answer to this question: <a href=\"https://wordpress.stackexchange.com/questions/6796/how-to-change-loop-to-order-p...
2011/01/14
[ "https://wordpress.stackexchange.com/questions/6953", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2462/" ]
How do I limit the query by two custom meta fields, a start date and an end date? This is what my data looks like: ``` meta_key | meta_value | ------------------------| start_date | 20100131 | //Jan 15, 2010 end_date | 20100206 | //Feb 6, 2010 ------------------------' $today = date(YYYYMMDD); ``` The post...
**Edited again to demonstrate adding and removing filters:** Include these general functions in your **functions.php**. These are the filters you will invoke for the loops where you want to limit your query by these two meta values: ``` function date_check_join( $join ) { global $wpdb; $join .= " JOIN ".$wpdb...
6,990
<p>I download and configure Wordpress for a development environment and a production environment. After it's set up on one server we check it into a subversion repo and then go and check it out on the production server. Deployment complete. </p> <p>The trouble is when I have to update. I'm supposed to delete wp-includ...
[ { "answer_id": 6991, "author": "sanchothefat", "author_id": 1733, "author_profile": "https://wordpress.stackexchange.com/users/1733", "pm_score": 2, "selected": false, "text": "<p>I always check out from wordpress.org's svn repository, and then use svn externals to pull in my own themes/...
2011/01/14
[ "https://wordpress.stackexchange.com/questions/6990", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/69/" ]
I download and configure Wordpress for a development environment and a production environment. After it's set up on one server we check it into a subversion repo and then go and check it out on the production server. Deployment complete. The trouble is when I have to update. I'm supposed to delete wp-includes and wp-...
Externals, definitely. Set up your own SVN repo, then make WP as an external in the repo. I put it into a /wp directory. You can access the WP SVN as an external here: <http://core.svn.wordpress.org/> I tend to use trunk. You can use a branch, if you really, really want. Branches get auto updated with minor releases (...
6,993
<p>How can I make a similar posts section in my theme, but without using a plugin. I'm going to be giving my theme away for free, so I don't want to have to force people to install plugins to use my theme.</p> <p>How can it be done?</p>
[ { "answer_id": 6994, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>The line between theme code and plugin code is more about intended purpose than technical limitation. Either can do w...
2011/01/14
[ "https://wordpress.stackexchange.com/questions/6993", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2415/" ]
How can I make a similar posts section in my theme, but without using a plugin. I'm going to be giving my theme away for free, so I don't want to have to force people to install plugins to use my theme. How can it be done?
Put this in your single.php: ``` $tags = wp_get_post_tags($post->ID); if ($tags) { $first_tag = $tags[0]->term_id; $args=array( 'tag__in' => array($first_tag), 'post__not_in' => array($post->ID), 'showposts'=>4, 'caller_get_posts'=>1 ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query...
7,001
<p>My plugin is freezing the execution of the page at the point where it calls the functions below.</p> <p>I have two problems...</p> <p>1) How can I recode the function so that if there is an error, the plugin does not stop the page from loading, but rather, returns an error message?</p> <p>2) How can I feedback wh...
[ { "answer_id": 6994, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>The line between theme code and plugin code is more about intended purpose than technical limitation. Either can do w...
2011/01/14
[ "https://wordpress.stackexchange.com/questions/7001", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
My plugin is freezing the execution of the page at the point where it calls the functions below. I have two problems... 1) How can I recode the function so that if there is an error, the plugin does not stop the page from loading, but rather, returns an error message? 2) How can I feedback what the error might be? I...
Put this in your single.php: ``` $tags = wp_get_post_tags($post->ID); if ($tags) { $first_tag = $tags[0]->term_id; $args=array( 'tag__in' => array($first_tag), 'post__not_in' => array($post->ID), 'showposts'=>4, 'caller_get_posts'=>1 ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query...
7,002
<p>I have a plugin that has a single method that requires PHP5. How can I code around the fact that the server may have PHP4?</p> <p>Code is below... (I'm thinking its the DOMDocument object that's freezing the plugin when running on a PHP4 server.</p> <pre><code>function rseo_doTheParse($heading, $post){ $conten...
[ { "answer_id": 7003, "author": "MathSmath", "author_id": 1537, "author_profile": "https://wordpress.stackexchange.com/users/1537", "pm_score": 2, "selected": false, "text": "<p>Try <a href=\"http://php.net/manual/en/function.phpversion.php\" rel=\"nofollow\">phpversion();</a></p>\n" },...
2011/01/14
[ "https://wordpress.stackexchange.com/questions/7002", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
I have a plugin that has a single method that requires PHP5. How can I code around the fact that the server may have PHP4? Code is below... (I'm thinking its the DOMDocument object that's freezing the plugin when running on a PHP4 server. ``` function rseo_doTheParse($heading, $post){ $content = $post->post_conte...
``` function is_php4(){ return version_compare(phpversion(),'5','<'); } ```
7,004
<p>I use custom permalink structure:</p> <p>/%tag%/%postname%/</p> <p>and it is not working. I get url - <a href="http://mydomain.com/%tag%/post/" rel="nofollow">http://mydomain.com/%tag%/post/</a>. So there is no tag name, just %tag%. If i place %category% instead ot %tag%, everithing is ok.</p> <p>Can somebody sol...
[ { "answer_id": 7003, "author": "MathSmath", "author_id": 1537, "author_profile": "https://wordpress.stackexchange.com/users/1537", "pm_score": 2, "selected": false, "text": "<p>Try <a href=\"http://php.net/manual/en/function.phpversion.php\" rel=\"nofollow\">phpversion();</a></p>\n" },...
2011/01/14
[ "https://wordpress.stackexchange.com/questions/7004", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I use custom permalink structure: /%tag%/%postname%/ and it is not working. I get url - <http://mydomain.com/%tag%/post/>. So there is no tag name, just %tag%. If i place %category% instead ot %tag%, everithing is ok. Can somebody solve this problem?
``` function is_php4(){ return version_compare(phpversion(),'5','<'); } ```
7,009
<p>I want to be able to change the amount of post shown on each archive page on a per category basis. Is there something I can change in the loop code or a plugin that gives me that ability?</p> <p>Thank you SE community.</p>
[ { "answer_id": 7022, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": false, "text": "<p>paste this in your theme function.php file</p>\n\n<pre><code>add_filter('pre_get_posts', 'Per_category_basis')...
2011/01/14
[ "https://wordpress.stackexchange.com/questions/7009", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I want to be able to change the amount of post shown on each archive page on a per category basis. Is there something I can change in the loop code or a plugin that gives me that ability? Thank you SE community.
paste this in your theme function.php file ``` add_filter('pre_get_posts', 'Per_category_basis'); function Per_category_basis($query){ if ($query->is_category) { // category named 'books' show 12 posts if (is_category('books'){ $query->set('posts_per_page', 12); } // ca...
7,014
<p>I'm look for a custom SQL query that will let me pull in the latest comments from across a WP multi-site install.</p> <p>The end result will be identical to a regular recent comments widget, but from all sites within the installation.</p> <p>Ideas?</p> <p>Thanks</p>
[ { "answer_id": 7028, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": false, "text": "<p>try this:</p>\n\n<pre><code>$sqlstr = '';\n$blog_list = get_blog_list( 0, 'all' );\n$sqlstr = \"SELECT 1 as bl...
2011/01/15
[ "https://wordpress.stackexchange.com/questions/7014", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2418/" ]
I'm look for a custom SQL query that will let me pull in the latest comments from across a WP multi-site install. The end result will be identical to a regular recent comments widget, but from all sites within the installation. Ideas? Thanks
Ok, I did some research based on [בניית אתרים](https://wordpress.stackexchange.com/users/2487/)'s solution here, as I'm interested in this too. First you need to get a list of blog IDs, and `get_blog_list()` is deprecated because it seems to be a "[suicidal database query](http://wordpress.org/support/topic/suicidal-...
7,017
<p>I've seen wp-snippets.com uses Twitter sign-in which somehow creates a WordPress users with the Twitter credentials.</p> <p>wp-snippets.com > signin with twitter > Oauth > CallbackURL = wp-admin with twitter credentials written to WP user</p> <p>How is this achieved? I've searched a lot plugins and cannot see anyt...
[ { "answer_id": 7028, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 2, "selected": false, "text": "<p>try this:</p>\n\n<pre><code>$sqlstr = '';\n$blog_list = get_blog_list( 0, 'all' );\n$sqlstr = \"SELECT 1 as bl...
2011/01/15
[ "https://wordpress.stackexchange.com/questions/7017", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1907/" ]
I've seen wp-snippets.com uses Twitter sign-in which somehow creates a WordPress users with the Twitter credentials. wp-snippets.com > signin with twitter > Oauth > CallbackURL = wp-admin with twitter credentials written to WP user How is this achieved? I've searched a lot plugins and cannot see anything that writes ...
Ok, I did some research based on [בניית אתרים](https://wordpress.stackexchange.com/users/2487/)'s solution here, as I'm interested in this too. First you need to get a list of blog IDs, and `get_blog_list()` is deprecated because it seems to be a "[suicidal database query](http://wordpress.org/support/topic/suicidal-...
7,021
<p>I have been looking all over the internet for this, and have not yet found an answer I could use.<br> Found out that I may can use something called query_posts or get_posts, but I have no idea how to use them.</p> <p>Isn't there some sort of plugin that could do this for me? Say if I made a post under the category ...
[ { "answer_id": 7023, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 0, "selected": false, "text": "<p>what you are looking for are SUB-CATEGORIES,\nunder the category guide create a sub categories named \"Compute...
2011/01/15
[ "https://wordpress.stackexchange.com/questions/7021", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2236/" ]
I have been looking all over the internet for this, and have not yet found an answer I could use. Found out that I may can use something called query\_posts or get\_posts, but I have no idea how to use them. Isn't there some sort of plugin that could do this for me? Say if I made a post under the category Guides, w...
I've just recently done something like this using the Custom Post Type UI plugin and creating a template file. The idea goes something like this... 1. Install Custom Post Type UI, Watch the video, add a new post type called "Computer Guides" 2. Next you're going to create a page template which will list all your com...
7,029
<h2>This question is a bit unique.</h2> <p>It is in part a <em>&quot;challenge&quot;</em> I'm issuing to the WordPress team <em>(<strong>or anyone else</strong>)</em> related to trac tickets: <a href="http://core.trac.wordpress.org/ticket/16048" rel="noreferrer">#16048</a>, <a href="http://core.trac.wordpress.org/ticke...
[ { "answer_id": 7023, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 0, "selected": false, "text": "<p>what you are looking for are SUB-CATEGORIES,\nunder the category guide create a sub categories named \"Compute...
2011/01/15
[ "https://wordpress.stackexchange.com/questions/7029", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/89/" ]
This question is a bit unique. ------------------------------ It is in part a *"challenge"* I'm issuing to the WordPress team *(**or anyone else**)* related to trac tickets: [#16048](http://core.trac.wordpress.org/ticket/16048), [#16050](http://core.trac.wordpress.org/ticket/16050) and [#16204](http://core.trac.wordpr...
I've just recently done something like this using the Custom Post Type UI plugin and creating a template file. The idea goes something like this... 1. Install Custom Post Type UI, Watch the video, add a new post type called "Computer Guides" 2. Next you're going to create a page template which will list all your com...
7,030
<p>My question is actually quite simple, but I think there are a number of answers to choose from:</p> <p><strong>If one were to use WordPress, what would be the most elegant way of creating a part of the website that has "People Profiles", whereby; they can update their own mini-blog, add images, assign them a multit...
[ { "answer_id": 7023, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 0, "selected": false, "text": "<p>what you are looking for are SUB-CATEGORIES,\nunder the category guide create a sub categories named \"Compute...
2011/01/15
[ "https://wordpress.stackexchange.com/questions/7030", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2393/" ]
My question is actually quite simple, but I think there are a number of answers to choose from: **If one were to use WordPress, what would be the most elegant way of creating a part of the website that has "People Profiles", whereby; they can update their own mini-blog, add images, assign them a multitude of taxonomie...
I've just recently done something like this using the Custom Post Type UI plugin and creating a template file. The idea goes something like this... 1. Install Custom Post Type UI, Watch the video, add a new post type called "Computer Guides" 2. Next you're going to create a page template which will list all your com...
7,046
<p>I want to grab the two latest blog posts on my homepage. i would also like the option to select the category if I want to also, but mainly just pulling the latest 2 blog posts.</p> <p>Thanks</p>
[ { "answer_id": 7049, "author": "Wyck", "author_id": 1509, "author_profile": "https://wordpress.stackexchange.com/users/1509", "pm_score": 1, "selected": false, "text": "<p>Well Kevin no one here is going to write code for you.</p>\n\n<p>To make a shortcode you can use your functions.php<...
2011/01/15
[ "https://wordpress.stackexchange.com/questions/7046", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I want to grab the two latest blog posts on my homepage. i would also like the option to select the category if I want to also, but mainly just pulling the latest 2 blog posts. Thanks
paste this code in your theme's functions.php file ``` function custom_query_shortcode($atts) { // EXAMPLE USAGE: // [loop_shortcode the_query="showposts=100&post_type=page&post_parent=453"] // Defaults extract(shortcode_atts(array( "the_query" => '' ), $atts)); // de-funkify query $the_q...
7,047
<p>Can add_filter() be used to intercept a plugin function?</p> <p>I'm not having any success, so I'm thinking perhaps I'm doing this wrong.</p> <p>The plugin is "All in One SEO" and the function I'm trying to intercept is in the All_in_One_SEO_Pack class and its called get_original_title()</p> <p>Here's the code I'...
[ { "answer_id": 7050, "author": "Denis de Bernardy", "author_id": 1208, "author_profile": "https://wordpress.stackexchange.com/users/1208", "pm_score": 3, "selected": true, "text": "<p>It is, but you're doing this wrong. I'm not familiar with that plugin, but chances are it's hooking into...
2011/01/15
[ "https://wordpress.stackexchange.com/questions/7047", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
Can add\_filter() be used to intercept a plugin function? I'm not having any success, so I'm thinking perhaps I'm doing this wrong. The plugin is "All in One SEO" and the function I'm trying to intercept is in the All\_in\_One\_SEO\_Pack class and its called get\_original\_title() Here's the code I'm trying to inter...
It is, but you're doing this wrong. I'm not familiar with that plugin, but chances are it's hooking into the wp\_title hook. You should be able to a) call remove\_filter() from your theme to disable the plugin's title manipulation, and/or b) override the result returned by the plugin by plugging into the same hook (jus...
7,074
<p>I need to get posts that have two meta-values. </p> <p>It tried the following code, but this is getting empty result</p> <pre><code>&lt;?php $featuredquery = " SELECT wposts.* FROM $wpdb-&gt;posts wposts, $wpdb-&gt;postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND (wpostmeta.meta_key = 'a...
[ { "answer_id": 7075, "author": "goldenapples", "author_id": 290, "author_profile": "https://wordpress.stackexchange.com/users/290", "pm_score": 3, "selected": true, "text": "<p>I'm not an SQL expert, but I would think you might have to JOIN twice to pick two distinct rows out of <code>wp...
2011/01/16
[ "https://wordpress.stackexchange.com/questions/7074", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1463/" ]
I need to get posts that have two meta-values. It tried the following code, but this is getting empty result ``` <?php $featuredquery = " SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND (wpostmeta.meta_key = 'article_level' AND wpostmeta.me...
I'm not an SQL expert, but I would think you might have to JOIN twice to pick two distinct rows out of `wp_postmeta`: ``` $featuredquery = " SELECT wposts.* FROM $wpdb->posts wposts JOIN $wpdb->postmeta article_level ON ( wposts.ID = article_level.post_id AND article_level.meta_key = 'articl...
7,081
<p>I have a site with CPT (short for custom post type) "bagp_deals" and custom taxonomies "ba_locations" and "ba_cats" basically Its post type of "Deals" with "Location" and "Categories" as hierarchical taxonomies. On the default edit screen i want to limit the selection to just one of each (one location and one catego...
[ { "answer_id": 7086, "author": "scribu", "author_id": 205, "author_profile": "https://wordpress.stackexchange.com/users/205", "pm_score": 4, "selected": true, "text": "<p>Instead of hacking it with jQuery, a more reliable solution would be to replace the meta box with your own, in PHP.</...
2011/01/16
[ "https://wordpress.stackexchange.com/questions/7081", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2487/" ]
I have a site with CPT (short for custom post type) "bagp\_deals" and custom taxonomies "ba\_locations" and "ba\_cats" basically Its post type of "Deals" with "Location" and "Categories" as hierarchical taxonomies. On the default edit screen i want to limit the selection to just one of each (one location and one catego...
Instead of hacking it with jQuery, a more reliable solution would be to replace the meta box with your own, in PHP. Anyway, the problem is most likely with the '[' and ']' characters in the selector: ``` "input[name=tax_input[ba_locations][]]" ``` could be rewritten as ``` "input[name=tax_input\\[ba_locations\\]\\...
7,090
<p>I have searched high and low for a simple solution to this, but to no avail. Wordpress keeps on wrapping my images in p tags and because of the eccentric nature of the layout for a site I am working on, this is highly annoying.</p> <p>I have created a jQuery solution to unwrap images, but it isn't that great. It la...
[ { "answer_id": 7097, "author": "Soska", "author_id": 774, "author_profile": "https://wordpress.stackexchange.com/users/774", "pm_score": 2, "selected": false, "text": "<p>maybe this will help</p>\n\n<pre><code>remove_filter('the_content', 'wpautop')\n</code></pre>\n\n<p>But then you are ...
2011/01/17
[ "https://wordpress.stackexchange.com/questions/7090", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1687/" ]
I have searched high and low for a simple solution to this, but to no avail. Wordpress keeps on wrapping my images in p tags and because of the eccentric nature of the layout for a site I am working on, this is highly annoying. I have created a jQuery solution to unwrap images, but it isn't that great. It lags because...
here's what we did yesterday on a client site that we were having this exact problem with... I created a quick filter as a plugin and activated it. ``` <?php /* Plugin Name: Image P tag remover Description: Plugin to remove p tags from around images in content outputting, after WP autop filter has added them. (oh the ...
7,105
<p>I have a plugin that sets up a custom rewrite rule. I can access the short URL and the content is returned correctly, but the HTTP response is <code>404, Page not found</code>.</p> <p>From searching the web it seems like WordPress is returning 404, because it thinks this is not a valid WP page (http://wordpress.org...
[ { "answer_id": 7115, "author": "prettyboymp", "author_id": 203, "author_profile": "https://wordpress.stackexchange.com/users/203", "pm_score": 3, "selected": true, "text": "<p>This has been an issue in core for a while, <a href=\"http://core.trac.wordpress.org/ticket/10722\" rel=\"nofoll...
2011/01/17
[ "https://wordpress.stackexchange.com/questions/7105", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I have a plugin that sets up a custom rewrite rule. I can access the short URL and the content is returned correctly, but the HTTP response is `404, Page not found`. From searching the web it seems like WordPress is returning 404, because it thinks this is not a valid WP page (http://wordpress.org/support/topic/404-on...
This has been an issue in core for a while, <http://core.trac.wordpress.org/ticket/10722>. The simplest solution is to just overwrite the headers on 'template\_redirect'. You can replace them as long as you haven't started any output yet, which you shouldn't have at this point. Just call status\_header( 200 ); No cac...
7,111
<p>I'm trying to uplaod video files,my upload file size limit is 96mb,and I can upload videos until 10mb size,but I want to uplaod videos that have 20mb size.If I try to uplaod bigger video I get http error,I found on web a lot of solutions but none of them acctualy help me.Is there any other solution how to fix http u...
[ { "answer_id": 7119, "author": "Pippin", "author_id": 2418, "author_profile": "https://wordpress.stackexchange.com/users/2418", "pm_score": 0, "selected": false, "text": "<p>Increase the WordPress upload limit: <a href=\"http://wordpress.org/support/topic/how-to-increase-the-max-upload-s...
2011/01/17
[ "https://wordpress.stackexchange.com/questions/7111", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1147/" ]
I'm trying to uplaod video files,my upload file size limit is 96mb,and I can upload videos until 10mb size,but I want to uplaod videos that have 20mb size.If I try to uplaod bigger video I get http error,I found on web a lot of solutions but none of them acctualy help me.Is there any other solution how to fix http upla...
Are you on shared hosting by any chance? Shared hosts tend to limit the max uploadable file size on their end and there is nothing you can add to your scripts to change that. If not, then I am mistaken and this is not the solution you are looking for. However, if you are on shared hosting it might pay to contact them ...
7,112
<p>I am building a Digg like website in WordPress.</p> <p>After installing W3 Total Cache, I noticed certain elements such as number of votes (and voters ids) per post are cached even though they shouldn't be (at least not after a user votes for an article). I assume it is not possible to prevent specific elements in ...
[ { "answer_id": 7113, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 3, "selected": false, "text": "<p>W3 Total Cache supports fragment caching. From FAQ:</p>\n\n<pre><code>How do I implement fragment caching? \n\nEdit y...
2011/01/17
[ "https://wordpress.stackexchange.com/questions/7112", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1567/" ]
I am building a Digg like website in WordPress. After installing W3 Total Cache, I noticed certain elements such as number of votes (and voters ids) per post are cached even though they shouldn't be (at least not after a user votes for an article). I assume it is not possible to prevent specific elements in a page fro...
if you want to flush the cache you can do that: the plugin has functions for that ``` <?php flush_pgcache() //page cache flush_dbcache() // database cache flush_minify() // minify cache flush_all() //all caches ?> ``` and you just need to call it like this: ``` <?php $w3_plugin_totalcache->flush_all(); ?> ...
7,123
<p>I have an environment running WP 3.0.1 with a Master db and two slaves. I am using HyperDB to force all writes to go to the Master, and all reads to read from the two slaves. </p> <p>I am experiencing a variety of issues in wp-admin pages where data is being written to the master, and WordPress attempts to read fro...
[ { "answer_id": 12373, "author": "Tom", "author_id": 3282, "author_profile": "https://wordpress.stackexchange.com/users/3282", "pm_score": 0, "selected": false, "text": "<p>I would advise that you deploy another copy of your site with different connection details to <a href=\"http://admin...
2011/01/17
[ "https://wordpress.stackexchange.com/questions/7123", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1427/" ]
I have an environment running WP 3.0.1 with a Master db and two slaves. I am using HyperDB to force all writes to go to the Master, and all reads to read from the two slaves. I am experiencing a variety of issues in wp-admin pages where data is being written to the master, and WordPress attempts to read from a slave,...
You didn't mention a HyperDB revision so I'm assuming trunk @337290. HyperDB's SRTM feature (send reads to master) works two ways. First, it keeps track of which tables have received writes during the current script and sends all subsequent reads for those tables to the master. Second, it gives you a way to force all ...
7,138
<p>What do i need to do to enable categories and tags for a custom post type i´ve made? I use the following code:</p> <pre><code>/* Create custom post type: "Tilbud" */ register_post_type('tilbud', array( 'label' =&gt; __('Tilbud'), 'singular_label' =&gt; __('Tilbud'), 'public' =&gt; true, 'show_ui' =&gt; true, 'capab...
[ { "answer_id": 7140, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 4, "selected": false, "text": "<p>change your code to this:</p>\n\n<pre><code>/* Create custom post type: \"Tilbud\" */\nregister_post_type('til...
2011/01/17
[ "https://wordpress.stackexchange.com/questions/7138", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
What do i need to do to enable categories and tags for a custom post type i´ve made? I use the following code: ``` /* Create custom post type: "Tilbud" */ register_post_type('tilbud', array( 'label' => __('Tilbud'), 'singular_label' => __('Tilbud'), 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hi...
It worked when I added the following code: ``` function add_tags_categories() { register_taxonomy_for_object_type('category', 'tilbud'); register_taxonomy_for_object_type('post_tag', 'tilbud'); } add_action('init', 'add_tags_categories'); ```
7,142
<p>When certain conditions are met (e.g. post vs. page or a category is tagged, etc) I would like to load an additional CSS file. This file would, in theory, change link colors. Or perhaps change the background color. Cosmetic changes. My thinking was to add code to functions.php, however, I don't think this is actuall...
[ { "answer_id": 7140, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 4, "selected": false, "text": "<p>change your code to this:</p>\n\n<pre><code>/* Create custom post type: \"Tilbud\" */\nregister_post_type('til...
2011/01/18
[ "https://wordpress.stackexchange.com/questions/7142", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1990/" ]
When certain conditions are met (e.g. post vs. page or a category is tagged, etc) I would like to load an additional CSS file. This file would, in theory, change link colors. Or perhaps change the background color. Cosmetic changes. My thinking was to add code to functions.php, however, I don't think this is actually a...
It worked when I added the following code: ``` function add_tags_categories() { register_taxonomy_for_object_type('category', 'tilbud'); register_taxonomy_for_object_type('post_tag', 'tilbud'); } add_action('init', 'add_tags_categories'); ```
7,152
<p>I have two totally separate WP websites setup. Different domains, different databases. I manage both of them and they are both hosted on a dedicated server. I am trying to include some basic content that requires just a tad more than an RSS feed. I need to pull data from SITE-1 and display it on SITE-2, using ba...
[ { "answer_id": 7154, "author": "onetrickpony", "author_id": 1986, "author_profile": "https://wordpress.stackexchange.com/users/1986", "pm_score": 4, "selected": true, "text": "<p>Yeah</p>\n\n<pre><code>$wpdb2 = new wpdb('dbuser', 'dbpassword', 'dbname', 'dbhost');\n\n// get 10 posts, ass...
2011/01/18
[ "https://wordpress.stackexchange.com/questions/7152", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1663/" ]
I have two totally separate WP websites setup. Different domains, different databases. I manage both of them and they are both hosted on a dedicated server. I am trying to include some basic content that requires just a tad more than an RSS feed. I need to pull data from SITE-1 and display it on SITE-2, using basic WP ...
Yeah ``` $wpdb2 = new wpdb('dbuser', 'dbpassword', 'dbname', 'dbhost'); // get 10 posts, assuming the other WordPress db table prefix is "wp_" $query = "SELECT post_title, guid FROM wp_posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date DESC LIMIT 10"; $somepo...
7,168
<p>Wordpress default taxonomy (Categories) has the item Uncategorized by default. How to add a default item to a new custom taxonomy?</p> <p><strong>functions.php:</strong></p> <pre><code>// === CUSTOM TAXONOMIES === // function my_custom_taxonomies() { register_taxonomy( 'block', // internal name ...
[ { "answer_id": 7170, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>Default category is hardcoded case in <a href=\"http://codex.wordpress.org/Function_Reference/wp_insert_post\" rel=\"...
2011/01/18
[ "https://wordpress.stackexchange.com/questions/7168", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
Wordpress default taxonomy (Categories) has the item Uncategorized by default. How to add a default item to a new custom taxonomy? **functions.php:** ``` // === CUSTOM TAXONOMIES === // function my_custom_taxonomies() { register_taxonomy( 'block', // internal name = machine-readable taxonomy name ...
Have a look here: <https://web.archive.org/web/20150403012347/http://wordpress.mfields.org/2010/set-default-terms-for-your-custom-taxonomies-in-wordpress-3-0/> Basically what you need to do is use the save\_post hook to check the terms for the post and add the default term from your taxonomy if it's empty. If you j...
7,177
<p>I'm migrating content from an existing site into wordpress. The old site has cross links that I'd like to maintain in the new site. I can convert the old links to wordpress format links (based on post-id), but in order to do that I need to assign the posts their own ID's on migration. is there any way to do that ?</...
[ { "answer_id": 7178, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<p>Do you mean that old site used \"ugly\" permalinks? <code>http://example.com/?p=N</code></p>\n\n<p><del>I am not enti...
2011/01/18
[ "https://wordpress.stackexchange.com/questions/7177", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/395/" ]
I'm migrating content from an existing site into wordpress. The old site has cross links that I'd like to maintain in the new site. I can convert the old links to wordpress format links (based on post-id), but in order to do that I need to assign the posts their own ID's on migration. is there any way to do that ? The...
Yes, use the "import\_id" field in the post, when calling wp\_insert\_post. This is treated as a "suggested" ID for the post that will be used if no post with that ID already exists. ``` $post = array( 'post_title'=>'whatever', 'post_content'=>'whatever', 'import_id'=>123 ); wp_insert_post($post); ```
7,185
<p>I'm working with a couple of plugins that ask for a list of category IDs to include/exclude.</p> <p>When I go to the categories section and select "Edit" I don't see an ID field listed on the page, though I see all the other details. Since I will be relaying this information onto other users, how can I find the cat...
[ { "answer_id": 7187, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>there are some plugins that reveal the ID's on the admin side like\n<a href=\"http://wordpress.org/extend/plugi...
2011/01/18
[ "https://wordpress.stackexchange.com/questions/7185", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1165/" ]
I'm working with a couple of plugins that ask for a list of category IDs to include/exclude. When I go to the categories section and select "Edit" I don't see an ID field listed on the page, though I see all the other details. Since I will be relaying this information onto other users, how can I find the category ID f...
there are some plugins that reveal the ID's on the admin side like [WP Show IDs](http://wordpress.org/extend/plugins/wp-show-ids/) and by code like this: ``` //as dropdown $categories= get_categories(array('hide_empty' => 0,'taxonomy' => 'category')); echo '<select>'; foreach ($categories as $c...
7,204
<p>I´m using the following code to create a new post type:</p> <pre><code>/* Create custom post type: "Tilbud" */ register_post_type('tilbud', array( 'label' =&gt; __('Tilbud'), 'public' =&gt; true, 'show_ui' =&gt; true, 'capability_type' =&gt; 'post', 'hierarchical' =&gt; false, 'rewrite' =&gt; array('slug' =&gt; '??...
[ { "answer_id": 7213, "author": "John P Bloch", "author_id": 11, "author_profile": "https://wordpress.stackexchange.com/users/11", "pm_score": 4, "selected": true, "text": "<p>My plugin here: <a href=\"http://wordpress.org/extend/plugins/custom-post-permalinks/\">http://wordpress.org/exte...
2011/01/18
[ "https://wordpress.stackexchange.com/questions/7204", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I´m using the following code to create a new post type: ``` /* Create custom post type: "Tilbud" */ register_post_type('tilbud', array( 'label' => __('Tilbud'), 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => array('slug' => '???'), 'query_var' => false, 'taxonom...
My plugin here: <http://wordpress.org/extend/plugins/custom-post-permalinks/> does exactly what you need. All you need to do with that code is remove the query\_var argument and change the rewrite slug to 'tilbud' (or whatever you'd like to have in the permastruct).
7,205
<p>I'm at a loss. I've got a custom meta box with the 'multicheck' code that Jan created. It's working great. My issue now is getting the data to return properly.</p> <p>Scenario: there are 5 possible values, each with the same meta_key. What I am trying to do is display specific content if a value is stored with one ...
[ { "answer_id": 7208, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>Can you share the code that you are using to register those boxes? Sounds like each time you are saving, each value...
2011/01/18
[ "https://wordpress.stackexchange.com/questions/7205", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/403/" ]
I'm at a loss. I've got a custom meta box with the 'multicheck' code that Jan created. It's working great. My issue now is getting the data to return properly. Scenario: there are 5 possible values, each with the same meta\_key. What I am trying to do is display specific content if a value is stored with one of the 5 ...
Your foreach is the problem. You're iterating once for each offering, yet you're evaluating ALL offering values in the array each time. So your PHP is dutifully printing all available offerings \* the number of offerings. I'd say go without the foreach() and see what happens. **EDIT 1** Also please note, you're castin...
7,211
<p>I'm trying to conditionally display some content in a theme using custom roles and capabilities. First, I define a custom role:</p> <p><code>add_role('free_vendor', 'Free Vendor Listing', array('read', 'edit_posts', 'delete_posts', 'display_map'));</code></p> <p>This is run directly from functions.php (do I need t...
[ { "answer_id": 7215, "author": "Pippin", "author_id": 2418, "author_profile": "https://wordpress.stackexchange.com/users/2418", "pm_score": 1, "selected": false, "text": "<p>Try using <a href=\"http://codex.wordpress.org/Function_Reference/current_user_can\" rel=\"nofollow\">current_user...
2011/01/18
[ "https://wordpress.stackexchange.com/questions/7211", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I'm trying to conditionally display some content in a theme using custom roles and capabilities. First, I define a custom role: `add_role('free_vendor', 'Free Vendor Listing', array('read', 'edit_posts', 'delete_posts', 'display_map'));` This is run directly from functions.php (do I need to add it to an action somewh...
first about the add\_role you only need to run this once, so after you paste it in your functions.php and saved you can remove it and save again and the role will be there always. then about the author\_can function, i really never use it so i can tell whats wrong but you can use current\_user\_can() function like th...
7,221
<p>I've been trying to include the jquery ui effects (more specifically the shake effect) on my wordpress theme. So far, I've only been able to include the jQuery script, but I really have no clue where to place the ui scripts and how to enqueue them.</p> <p>This is the code I have. It obviously doesnt work:</p> <pre...
[ { "answer_id": 7222, "author": "editor", "author_id": 1860, "author_profile": "https://wordpress.stackexchange.com/users/1860", "pm_score": 2, "selected": false, "text": "<p>There doesn't appear to be a default load for this jQuery library (full list <a href=\"http://codex.wordpress.org/...
2011/01/18
[ "https://wordpress.stackexchange.com/questions/7221", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1806/" ]
I've been trying to include the jquery ui effects (more specifically the shake effect) on my wordpress theme. So far, I've only been able to include the jQuery script, but I really have no clue where to place the ui scripts and how to enqueue them. This is the code I have. It obviously doesnt work: ``` <?php wp_e...
While WordPress does include the jQuery UI libraries, it does not include the UI/Effects library. That library is separate and standalone. You'll need to include a copy of the effects.core.js file and enqueue it separately. Note that you should name it jquery-effects-core when en-queuing it, for naming consistency. Y...
7,225
<p>Is there a simple PHP or Javascript method of getting the total number of FaceBook friends? Twitter makes it super easy to do that, and I need to do the same for one of my WordPress installs.</p>
[ { "answer_id": 7227, "author": "Otto", "author_id": 2232, "author_profile": "https://wordpress.stackexchange.com/users/2232", "pm_score": 4, "selected": true, "text": "<p>To get your friends as a JSON object from Facebook, you can use their Graph API. Easiest way is to visit this page:\n...
2011/01/18
[ "https://wordpress.stackexchange.com/questions/7225", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2418/" ]
Is there a simple PHP or Javascript method of getting the total number of FaceBook friends? Twitter makes it super easy to do that, and I need to do the same for one of my WordPress installs.
To get your friends as a JSON object from Facebook, you can use their Graph API. Easiest way is to visit this page: <http://developers.facebook.com/docs/reference/api/user/> Scroll down until you find the Friends link in the "Connections" table. That link will give you a JSON object containing all your friends. Note t...
7,232
<p>I have about 10 different category posts etc.</p> <p>As you know, withing each category there is the next and previous navigation to toggle between posts. When you reach the Last post in a category, the next navigation then takes you to the NEXT category...</p> <p>My question is, is there there a way to loop only ...
[ { "answer_id": 7235, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 1, "selected": false, "text": "<p>i had the same problem with one of my sites and i used this hack:\non your themes category.php (or if your doe...
2011/01/19
[ "https://wordpress.stackexchange.com/questions/7232", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2583/" ]
I have about 10 different category posts etc. As you know, withing each category there is the next and previous navigation to toggle between posts. When you reach the Last post in a category, the next navigation then takes you to the NEXT category... My question is, is there there a way to loop only withing the categ...
i had the same problem with one of my sites and i used this hack: on your themes category.php (or if your doesn't have one then archive.php ) before the loop part witch is something like this: ``` if ( have_posts() ) : while ( have_posts() ) : the_post(); ``` add this code ``` if (is_category()){ $category = ...
7,241
<p>I want to allow my users to upload files in admin panel, but I'm not sure where should I upload these files and how the script should look like?</p> <pre><code>&lt;p&gt;Please provide link to a file or click "Upload" to upload it from your PC:&lt;/p&gt; &lt;form&gt; Link: &lt;input type="text" name ="logo_url"&gt; ...
[ { "answer_id": 7253, "author": "Anders", "author_id": 2188, "author_profile": "https://wordpress.stackexchange.com/users/2188", "pm_score": -1, "selected": false, "text": "<p>If you use the <a href=\"http://wordpress.org/extend/plugins/contact-form-7/\" rel=\"nofollow\">Contact Form 7</a...
2011/01/19
[ "https://wordpress.stackexchange.com/questions/7241", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1869/" ]
I want to allow my users to upload files in admin panel, but I'm not sure where should I upload these files and how the script should look like? ``` <p>Please provide link to a file or click "Upload" to upload it from your PC:</p> <form> Link: <input type="text" name ="logo_url"> Upload: <input type="file" name="logo_...
See this [very similar question](https://wordpress.stackexchange.com/questions/4307/how-can-i-add-an-image-upload-field-directly-to-a-custom-write-panel/4413#4413). The answer can be adjusted to work with all types of files, not just images.
7,258
<p>The two functions below are designed to return a list of posts that share the same category as the current post being viewed in single.php</p> <p>However, when I var_dump on $cat (should be a list of the categories assigned to the current post), I'm not getting what I'm expecting. Do I need to deserialize the array...
[ { "answer_id": 7259, "author": "Pippin", "author_id": 2418, "author_profile": "https://wordpress.stackexchange.com/users/2418", "pm_score": 3, "selected": true, "text": "<p>You can use <a href=\"http://codex.wordpress.org/Function_Reference/get_the_category\" rel=\"nofollow\">get_the_cat...
2011/01/19
[ "https://wordpress.stackexchange.com/questions/7258", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
The two functions below are designed to return a list of posts that share the same category as the current post being viewed in single.php However, when I var\_dump on $cat (should be a list of the categories assigned to the current post), I'm not getting what I'm expecting. Do I need to deserialize the array before p...
You can use [get\_the\_category()](http://codex.wordpress.org/Function_Reference/get_the_category) It will return an array of category IDs belonging to the current post. ``` $post_cats= array(); $categories = get_the_category(); foreach($categories as $cat) : array_push($post_cats, $cat->cat_id); endforeach; ``` T...
7,266
<p>I'm trying to mark up my posts using their custom taxonomy slug as the div class so that they can be filtered...</p> <p>So far what I have displays the taxonomy name but what I need is the slug so I have a nice-space-free-name, I have the below so far outputting the name:</p> <pre><code> &lt;div class="box-item co...
[ { "answer_id": 7293, "author": "onetrickpony", "author_id": 1986, "author_profile": "https://wordpress.stackexchange.com/users/1986", "pm_score": 1, "selected": false, "text": "<p>taxonomy slug, or the taxonomy terms slug?\nI assume you mean the last:</p>\n\n<pre><code>&lt;div class=\"bo...
2011/01/19
[ "https://wordpress.stackexchange.com/questions/7266", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2595/" ]
I'm trying to mark up my posts using their custom taxonomy slug as the div class so that they can be filtered... So far what I have displays the taxonomy name but what I need is the slug so I have a nice-space-free-name, I have the below so far outputting the name: ``` <div class="box-item cocktails-box <?php $ter...
@Ambitious Amoeba's answer works. But have you looked into the `post_class` function? It'd do what you want, and save you a lot of trouble. Just use this as your div opener: ``` <div <?php post_class('box-item cocktails-box'); ?>> ``` where you pass the classes you want applied to all posts as a list or array, and l...
7,277
<p>WP makes a list of links, and helpfully applies a current_page class, but I'm concerned with the accessibility issues of a link to the page you're on.</p> <p>Normally I'd swap the <code>&lt;a href</code> etc with a <code>&lt;span</code>, How would you approach that with WordPress?</p> <p>(apart from manually creat...
[ { "answer_id": 7283, "author": "goldenapples", "author_id": 290, "author_profile": "https://wordpress.stackexchange.com/users/290", "pm_score": 2, "selected": false, "text": "<p>Rewriting the entire walker class is a big pain... much more work than is justified for the result. But you ca...
2011/01/19
[ "https://wordpress.stackexchange.com/questions/7277", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/263/" ]
WP makes a list of links, and helpfully applies a current\_page class, but I'm concerned with the accessibility issues of a link to the page you're on. Normally I'd swap the `<a href` etc with a `<span`, How would you approach that with WordPress? (apart from manually creating the list of pages!)
Rewriting the entire walker class is a big pain... much more work than is justified for the result. But you can use a bit of javascript to remove the link. If you're including jquery, something like this should work: ``` jquery(document).ready(function() { jquery('.current_page_item a').removeAttr( 'href' ); }...
7,278
<p>I'm building a plugin and I want to add bits of javascript in the admin head but only for certain admin pages. I don't mean pages as in a WordPress page that you create yourself but rather existing admin section pages like 'Your Profile', 'Users', etc. Is there a wp function specifically for this task? I've been loo...
[ { "answer_id": 7281, "author": "goldenapples", "author_id": 290, "author_profile": "https://wordpress.stackexchange.com/users/290", "pm_score": 6, "selected": false, "text": "<p>There is a global variable in wp-admin called <strong>$pagenow</strong> which holds name of the current page, ...
2011/01/19
[ "https://wordpress.stackexchange.com/questions/7278", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2123/" ]
I'm building a plugin and I want to add bits of javascript in the admin head but only for certain admin pages. I don't mean pages as in a WordPress page that you create yourself but rather existing admin section pages like 'Your Profile', 'Users', etc. Is there a wp function specifically for this task? I've been lookin...
The way to do this is to use the 'admin\_enqueue\_scripts' hook to en-queue the files you need. This hook will get passed a $hook\_suffix that relates to the current page that is loaded: ``` function my_admin_enqueue($hook_suffix) { if($hook_suffix == 'appearance_page_theme-options') { wp_enqueue_script('m...
7,285
<p>I need to modify the markup of the tag cloud widget.</p> <p>Can someone tell me how to go about doing this without modifying any of the files outside of the theme directory so my changes don't get overwritten when updating WordPress?</p>
[ { "answer_id": 7281, "author": "goldenapples", "author_id": 290, "author_profile": "https://wordpress.stackexchange.com/users/290", "pm_score": 6, "selected": false, "text": "<p>There is a global variable in wp-admin called <strong>$pagenow</strong> which holds name of the current page, ...
2011/01/19
[ "https://wordpress.stackexchange.com/questions/7285", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1462/" ]
I need to modify the markup of the tag cloud widget. Can someone tell me how to go about doing this without modifying any of the files outside of the theme directory so my changes don't get overwritten when updating WordPress?
The way to do this is to use the 'admin\_enqueue\_scripts' hook to en-queue the files you need. This hook will get passed a $hook\_suffix that relates to the current page that is loaded: ``` function my_admin_enqueue($hook_suffix) { if($hook_suffix == 'appearance_page_theme-options') { wp_enqueue_script('m...
7,290
<p>I've been researching this all day and haven't come up with much results.</p> <p>I want to restrict who can see my Custom Post Types by User Level (or some other way). So if the person logged in is not an 'administrator' the added Custom Post Types are not visible to them.</p> <p>Here is part of a Custom Post Type...
[ { "answer_id": 7300, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 0, "selected": false, "text": "<p>i don't know whats wrong with the code but whenever i need to limit menu items to users \ni use: \n<a href=\"h...
2011/01/19
[ "https://wordpress.stackexchange.com/questions/7290", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1114/" ]
I've been researching this all day and haven't come up with much results. I want to restrict who can see my Custom Post Types by User Level (or some other way). So if the person logged in is not an 'administrator' the added Custom Post Types are not visible to them. Here is part of a Custom Post Type that I have: ``...
[Codex - Register Post Type](http://codex.wordpress.org/Function_Reference/register_post_type) See the `capability_type` and `capabilities` arguments for `register_post_type`. You can pass the `capabilities` argument an array of capabilities to map to the necessary caps, here's an example of the args array with custom...
7,291
<p><strong>Possible Duplicate:</strong> <a href="https://wordpress.stackexchange.com/questions/3316/how-to-show-a-custom-meta-box-on-the-quick-edit-screen">How to show custom meta box on "Quick Edit" screen?</a></p> <p>I'm trying to edit the quick edit screen on my custom post type "visitor" so that I can add some opt...
[ { "answer_id": 8098, "author": "jaredwilli", "author_id": 1366, "author_profile": "https://wordpress.stackexchange.com/users/1366", "pm_score": 4, "selected": true, "text": "<p>I use this to add form fields to the quick edit. It's not entirely easy to do this in WP (yet) and it can be ve...
2011/01/19
[ "https://wordpress.stackexchange.com/questions/7291", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2322/" ]
**Possible Duplicate:** [How to show custom meta box on "Quick Edit" screen?](https://wordpress.stackexchange.com/questions/3316/how-to-show-a-custom-meta-box-on-the-quick-edit-screen) I'm trying to edit the quick edit screen on my custom post type "visitor" so that I can add some options for my end-users. My custom p...
I use this to add form fields to the quick edit. It's not entirely easy to do this in WP (yet) and it can be very difficult to find info on how to do it. You have to really dig through the source to find it too. Add Form fields to Quick Edit ``` <?php add_action('quick_edit_custom_box', 'quickedit_posts_custom_box', ...
7,292
<p>We developed the wordpress site here:</p> <p>wwww.kirschfamilycomputerservices.com/sam/wheresthefairness</p> <p>^^ URL does not exist now.</p> <p>When the website was done, we transferred the database &amp; theme over to a new host. </p> <p>The issue is odd and really critical. We have to present the website to ...
[ { "answer_id": 8098, "author": "jaredwilli", "author_id": 1366, "author_profile": "https://wordpress.stackexchange.com/users/1366", "pm_score": 4, "selected": true, "text": "<p>I use this to add form fields to the quick edit. It's not entirely easy to do this in WP (yet) and it can be ve...
2011/01/19
[ "https://wordpress.stackexchange.com/questions/7292", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2479/" ]
We developed the wordpress site here: wwww.kirschfamilycomputerservices.com/sam/wheresthefairness ^^ URL does not exist now. When the website was done, we transferred the database & theme over to a new host. The issue is odd and really critical. We have to present the website to the client tonight, and none of our...
I use this to add form fields to the quick edit. It's not entirely easy to do this in WP (yet) and it can be very difficult to find info on how to do it. You have to really dig through the source to find it too. Add Form fields to Quick Edit ``` <?php add_action('quick_edit_custom_box', 'quickedit_posts_custom_box', ...
7,304
<p>What's the best way to alter the query being run on the Posts Edit screen (edit.php)?</p> <p>The current method I'm using is by passing an argument to the global $wp_query like so:</p> <pre><code>$wp_query-&gt;query( array ('category__in' =&gt; array(14,9,2) ) ); </code></pre> <p>However, this doesn't really work...
[ { "answer_id": 7306, "author": "Michal Mau", "author_id": 2110, "author_profile": "https://wordpress.stackexchange.com/users/2110", "pm_score": 3, "selected": true, "text": "<p>Few days ago I wrote a quick solution using <a href=\"http://adambrown.info/p/wp_hooks/hook/pre_get_posts\" rel...
2011/01/20
[ "https://wordpress.stackexchange.com/questions/7304", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
What's the best way to alter the query being run on the Posts Edit screen (edit.php)? The current method I'm using is by passing an argument to the global $wp\_query like so: ``` $wp_query->query( array ('category__in' => array(14,9,2) ) ); ``` However, this doesn't really work as expected once the user pages back ...
Few days ago I wrote a quick solution using [pre\_get\_posts](http://adambrown.info/p/wp_hooks/hook/pre_get_posts) filter to hide some pages in admin area. Maybe you could use it as a good starting point for whatever you'd like to achieve. ``` if ( is_admin() ) add_filter('pre_get_posts', 'mau_filter_admin_pages');...
7,312
<p>There are several plugins that insert buttons to retweet and like into a post. You can see the count of retweets and likes at the top of single blog posts.</p> <p>What I want to do is show the retweets and likes in the blog home page, which has excerpts and thumbnails</p> <p>Like this</p> <p>Fabuous Post Title R...
[ { "answer_id": 7313, "author": "MirlitonMedia", "author_id": 2604, "author_profile": "https://wordpress.stackexchange.com/users/2604", "pm_score": 1, "selected": false, "text": "<p>While you could edit your theme, it seems that Wptricks.net is using the WP Socializer plugin.</p>\n\n<p><a...
2011/01/20
[ "https://wordpress.stackexchange.com/questions/7312", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
There are several plugins that insert buttons to retweet and like into a post. You can see the count of retweets and likes at the top of single blog posts. What I want to do is show the retweets and likes in the blog home page, which has excerpts and thumbnails Like this Fabuous Post Title Retweet (button) - 45 18 l...
Here is a short and simple plugin I wrote to add a re-tweet and Facebook like button to each post. This version of the Facebook like button uses the newer XFBML instead of the iframes but requires you to register an app id. To use the buttons just add the function call to your loop. ``` <?php /* Plugin Name: C3M Soci...
7,331
<p>Simple you will say?</p> <p>I have a first Custom post type called Country. I have a second Custom post type called Travellers. I need to make a drop down select list (multiple check) available when editing Countrywith content from Travellers. This will allow me to select travellers for each country.</p> <p>Help!<...
[ { "answer_id": 7363, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 1, "selected": false, "text": "<p>very simeler to the question here <a href=\"https://wordpress.stackexchange.com/questions/7349/display-list-of...
2011/01/20
[ "https://wordpress.stackexchange.com/questions/7331", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2597/" ]
Simple you will say? I have a first Custom post type called Country. I have a second Custom post type called Travellers. I need to make a drop down select list (multiple check) available when editing Countrywith content from Travellers. This will allow me to select travellers for each country. Help! thx in advance
very simeler to the question here [Display list of tags as drop down menu or radio buttons in a meta box?](https://wordpress.stackexchange.com/questions/7349/display-list-of-tags-as-drop-down-menu-or-radio-buttons-in-a-meta-box/7353#7353) but instead of list of tags you need to query the post list of your travellers p...
7,337
<p>I've got the following problem:</p> <p>each page of the site has its own image which needs to be placed within the footer div for correct, static placement. However each image is different so I can't just add a simple IMG tag to the footer.</p> <p>At the moment I've stripped the page.php of most of the content and...
[ { "answer_id": 7347, "author": "Pippin", "author_id": 2418, "author_profile": "https://wordpress.stackexchange.com/users/2418", "pm_score": 2, "selected": false, "text": "<p>You want to use the Featured Post Thumbnail:</p>\n\n<p><a href=\"http://wpcanyon.com/tutorials/how-to-use-the-post...
2011/01/20
[ "https://wordpress.stackexchange.com/questions/7337", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I've got the following problem: each page of the site has its own image which needs to be placed within the footer div for correct, static placement. However each image is different so I can't just add a simple IMG tag to the footer. At the moment I've stripped the page.php of most of the content and placed it into t...
You want to use the Featured Post Thumbnail: <http://wpcanyon.com/tutorials/how-to-use-the-post-thumbnail-feature-in-wordpress-2-9/> <http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/> <http://codex.wordpress.org/Function_Reference/the_post_thumbnail> In your functions.php, def...
7,349
<p>I would like to group posts of a custom post type based on tags, but the default functionality does not do for the project I am working on.</p> <p>I want the user to be able to select only one tag, not multiple tags, from a list of all the tags entered for that custom post type (drop down or radio buttons).</p> <p...
[ { "answer_id": 7353, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>In my last project i had the same issue and i just used this:</p>\n\n<p>first get the list of tags to a var usi...
2011/01/20
[ "https://wordpress.stackexchange.com/questions/7349", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2618/" ]
I would like to group posts of a custom post type based on tags, but the default functionality does not do for the project I am working on. I want the user to be able to select only one tag, not multiple tags, from a list of all the tags entered for that custom post type (drop down or radio buttons). The user can cre...
In my last project i had the same issue and i just used this: first get the list of tags to a var using the get\_categories function by passing the right taxonomy like this: ``` $args = array( 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, ...
7,365
<p>i'm working in a twenty ten child theme, i want to change the </p> <pre><code>load_theme_textdomain( 'twentyten', TEMPLATEPATH . '/languages' ); $locale = get_locale(); $locale_file = TEMPLATEPATH . "/languages/$locale.php"; if ( is_readable( $locale_file ) ) require_once( $locale_file ); </code></pre> <p>locat...
[ { "answer_id": 7371, "author": "MirlitonMedia", "author_id": 2604, "author_profile": "https://wordpress.stackexchange.com/users/2604", "pm_score": 2, "selected": false, "text": "<p>You will need to use the function <a href=\"http://wphit.com/lookup/2010/03/load_child_theme_textdomain/\" ...
2011/01/20
[ "https://wordpress.stackexchange.com/questions/7365", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
i'm working in a twenty ten child theme, i want to change the ``` load_theme_textdomain( 'twentyten', TEMPLATEPATH . '/languages' ); $locale = get_locale(); $locale_file = TEMPLATEPATH . "/languages/$locale.php"; if ( is_readable( $locale_file ) ) require_once( $locale_file ); ``` locate in the twentyten functio...
You will need to use the function [`load_child_theme_textdomain()`](http://wphit.com/lookup/2010/03/load_child_theme_textdomain/). Also, there is some [interesting discussion here](http://themeshaper.com/forums/topic/add-languages-files-to-child-theme).
7,373
<p>I'm (still) working on a custom post type plugin for my workplace and came across an easier method of marking Visitors (my custom post type) as either "Here" (aka checked-in) or "Not Here" (not checked-in).</p> <p>I've explored the <a href="http://wordpress.org/extend/plugins/edit-flow/" rel="nofollow noreferrer">E...
[ { "answer_id": 8116, "author": "jaredwilli", "author_id": 1366, "author_profile": "https://wordpress.stackexchange.com/users/1366", "pm_score": 2, "selected": false, "text": "<p>I have done something similar to what facebook does, like where you can post status updates. Similar to what y...
2011/01/20
[ "https://wordpress.stackexchange.com/questions/7373", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2322/" ]
I'm (still) working on a custom post type plugin for my workplace and came across an easier method of marking Visitors (my custom post type) as either "Here" (aka checked-in) or "Not Here" (not checked-in). I've explored the [Edit Flow](http://wordpress.org/extend/plugins/edit-flow/) plugin and, to be honest, I can't ...
Custom post statuses do exist in the core code of WordPress, so you can register them, but they are not yet properly implemented in the admin screens (e.g. they don't show in the dropdown list of statuses alongside Pending Review, Draft, Published). So essentially you can do very little with them at the moment. You ca...
7,379
<p>I am using a theme that uses posts for multiple pages, and the blog posts goes in a category called "blog", I am using the permalinks setting "/%postname%", and the blog menu url is "/category/blog", how can I rewrite that to "/blog" without breaking the rest of the wp url rewrites?, my htaccess is the normal from ...
[ { "answer_id": 7380, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>adding <code>RewriteRule ^blog$ /?cat=3 [NC,N]</code>\nSeems to do the job.</p>\n" }, { "answer_id": 7424, ...
2011/01/20
[ "https://wordpress.stackexchange.com/questions/7379", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I am using a theme that uses posts for multiple pages, and the blog posts goes in a category called "blog", I am using the permalinks setting "/%postname%", and the blog menu url is "/category/blog", how can I rewrite that to "/blog" without breaking the rest of the wp url rewrites?, my htaccess is the normal from wp: ...
You don't have to touch the Apache configuration for this, you can do this all from the WordPress rewrite system. But indeed, your general idea is correct: you should append `?cat=3` (or `category_name=blog` if you want to be even clearer). Remember that your blog archive can have multiple pages, maybe you want to hand...
7,381
<p>I need to add a "last" class to the last post that appears in loop.php.</p> <p>Can someone tell me how to accomplish this?</p>
[ { "answer_id": 7382, "author": "onetrickpony", "author_id": 1986, "author_profile": "https://wordpress.stackexchange.com/users/1986", "pm_score": 5, "selected": true, "text": "<p>assuming you're using <a href=\"http://codex.wordpress.org/Function_Reference/post_class\" rel=\"nofollow\"><...
2011/01/20
[ "https://wordpress.stackexchange.com/questions/7381", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1462/" ]
I need to add a "last" class to the last post that appears in loop.php. Can someone tell me how to accomplish this?
assuming you're using [`post_class()`](http://codex.wordpress.org/Function_Reference/post_class): ``` add_filter('post_class', function($classes){ global $wp_query; if(($wp_query->current_post + 1) == $wp_query->post_count) $classes[] = 'last'; return $classes; }); ```
7,384
<p>I need to display the "sticky" post in a section that is outside the "loop".</p> <p>Can someone tell me how to do this?</p>
[ { "answer_id": 7387, "author": "Martin-Al", "author_id": 1463, "author_profile": "https://wordpress.stackexchange.com/users/1463", "pm_score": 3, "selected": true, "text": "<p>I am using this query; </p>\n\n<pre><code>&lt;?php\n$sticky = get_option( 'sticky_posts' ); // Get all sticky po...
2011/01/20
[ "https://wordpress.stackexchange.com/questions/7384", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1462/" ]
I need to display the "sticky" post in a section that is outside the "loop". Can someone tell me how to do this?
I am using this query; ``` <?php $sticky = get_option( 'sticky_posts' ); // Get all sticky posts rsort( $sticky ); // Sort the stickies, latest first $sticky = array_slice( $sticky, 0, 1 ); // Number of stickies to show query_posts( array( 'post__in' => $sticky, 'caller_get_posts' => 1 ) ); // The query if (have_pos...
7,398
<p>My problem is when on the main plugin file I include a PHP file something like this:</p> <pre><code>include(WP_PLUGIN_URL . '/wordpress-group-buying/ipn/paypal-ipn.php'); // or include_once(WP_PLUGIN_URL . '/wordpress-group-buying/ipn/paypal-ipn.php'); // or require(WP_PLUGIN_URL . '/wordpress-group-buying/ipn/payp...
[ { "answer_id": 7401, "author": "mtekk", "author_id": 1078, "author_profile": "https://wordpress.stackexchange.com/users/1078", "pm_score": 3, "selected": false, "text": "<p>I end up forgoing the WordPress constructs for includes and use the following:</p>\n\n<pre><code>require_once(dirna...
2011/01/21
[ "https://wordpress.stackexchange.com/questions/7398", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2487/" ]
My problem is when on the main plugin file I include a PHP file something like this: ``` include(WP_PLUGIN_URL . '/wordpress-group-buying/ipn/paypal-ipn.php'); // or include_once(WP_PLUGIN_URL . '/wordpress-group-buying/ipn/paypal-ipn.php'); // or require(WP_PLUGIN_URL . '/wordpress-group-buying/ipn/paypal-ipn.php'); ...
First , thank you to everyone who answered, My problem was calling the included files with full url that way they don't go through WordPress. and that happened because as i stated on the question i was calling them from the main plugin file. so the fix ended up using: ``` include_once('/ipn/paypal-ipn.php'); ``` i ...
7,422
<p>I want create 5 pages when user active my theme. I found a code from <a href="http://wpcanyon.com/tipsandtricks/automatically-create-a-page-on-theme-activation/" rel="nofollow">wpcanyon</a> which can create one page only. From this code how do I create 5 pages without repeat it 5 times.</p> <pre><code>if (isset($_G...
[ { "answer_id": 7423, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 3, "selected": true, "text": "<p>Ehm, just repeat the page creation code several times, providing different content and such. Is there any issue with t...
2011/01/21
[ "https://wordpress.stackexchange.com/questions/7422", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2163/" ]
I want create 5 pages when user active my theme. I found a code from [wpcanyon](http://wpcanyon.com/tipsandtricks/automatically-create-a-page-on-theme-activation/) which can create one page only. From this code how do I create 5 pages without repeat it 5 times. ``` if (isset($_GET['activated']) && is_admin()){ $n...
Ehm, just repeat the page creation code several times, providing different content and such. Is there any issue with that?..
7,434
<p>I've created a CPT for a site I'm working on at the moment called "campaigns". I've created a page which displays some content as well a custom loop which displays the most recent Campaign.</p> <p>Everywhere else on the site I've used Disqus for commenting and I'd like to use Disqus here - but it doesn't seem to d...
[ { "answer_id": 8722, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>Are you registering your CPT with <code>comments</code> in <a href=\"http://codex.wordpress.org/Function_Reference/re...
2011/01/21
[ "https://wordpress.stackexchange.com/questions/7434", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2641/" ]
I've created a CPT for a site I'm working on at the moment called "campaigns". I've created a page which displays some content as well a custom loop which displays the most recent Campaign. Everywhere else on the site I've used Disqus for commenting and I'd like to use Disqus here - but it doesn't seem to display. I'v...
Are you registering your CPT with `comments` in [`supports` array of `register_post_type()`](http://codex.wordpress.org/Function_Reference/register_post_type#Arguments)? From brief look at Disqus plugin code there is [`dsq_comments_template()`](http://plugins.trac.wordpress.org/browser/disqus-comment-system/trunk/disq...
7,436
<p>I use this function to exclude from the query posts that are 30 days old,</p> <pre><code>function filter_where($where = '') { //posts in the last 30 days $where .= " AND post_date &gt; '" . date('Y-m-d', strtotime('-30 days')) . "'"; return $where; } // Register the filtering function add_filter('posts_where'...
[ { "answer_id": 7438, "author": "anu", "author_id": 490, "author_profile": "https://wordpress.stackexchange.com/users/490", "pm_score": 2, "selected": true, "text": "<p>I think you'll need to add a posts_join filter, to join the posts and postmeta tables.</p>\n\n<p>This link should be hel...
2011/01/21
[ "https://wordpress.stackexchange.com/questions/7436", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2048/" ]
I use this function to exclude from the query posts that are 30 days old, ``` function filter_where($where = '') { //posts in the last 30 days $where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'"; return $where; } // Register the filtering function add_filter('posts_where', 'filter_where')...
I think you'll need to add a posts\_join filter, to join the posts and postmeta tables. This link should be helpful: <http://codex.wordpress.org/Custom_Queries>, in particular this piece of example code: ``` add_filter('posts_join', 'geotag_search_join' ); add_filter('posts_where', 'geotag_search_where' ); function ...
7,437
<p>I'll preface this by saying that I'm ok with CSS and Wordpress, but very new to PHP. You all seem to be an enormously smart bunch, and I was wondering if someone could help me out?</p> <p>I am building a Wordpress site for a friend, and they are wanting to be able to post mixtapes. I have created two custom post ty...
[ { "answer_id": 7828, "author": "Fernando Briano", "author_id": 298, "author_profile": "https://wordpress.stackexchange.com/users/298", "pm_score": 1, "selected": false, "text": "<p>Haven't tried this, but if you look at the code, there's a query where the posts are retrieved from the dat...
2011/01/21
[ "https://wordpress.stackexchange.com/questions/7437", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I'll preface this by saying that I'm ok with CSS and Wordpress, but very new to PHP. You all seem to be an enormously smart bunch, and I was wondering if someone could help me out? I am building a Wordpress site for a friend, and they are wanting to be able to post mixtapes. I have created two custom post types: 'mixt...
Haven't tried this, but if you look at the code, there's a query where the posts are retrieved from the database: ``` $query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'post' AND post_status = 'publish') $where "; ``` As you can see, it's looking for `post_type = 'post'`. So this will only get the defaul...
7,441
<p>Where can I download the schema (or DTD) for the layout of the WordPress import/export file format? </p>
[ { "answer_id": 7448, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>As far as I know no one ever [publicly] documented it and all questions about that are met with \"it's like RSS, want...
2011/01/21
[ "https://wordpress.stackexchange.com/questions/7441", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2550/" ]
Where can I download the schema (or DTD) for the layout of the WordPress import/export file format?
It seems to be an RSS Feed <http://en.wikipedia.org/wiki/RSS> extended with some of WordPress's own extensions. Unfortunately, it applies only to posts and pages. I was thinking about using it to migrate data from PHP-Fusion to WordPress, but it would only be a partial solution. I tried some of the naemspaces below ...
7,443
<p>I am using the WP-Paginate plug-in and need to apply a class to the containing LIs for the next/previous links. Can someone tell me how to do this? If there's a better/easier way to do this other than using WP-Paginate, then I'm open to suggestions. Thanks!</p>
[ { "answer_id": 7458, "author": "Eric Martin", "author_id": 2651, "author_profile": "https://wordpress.stackexchange.com/users/2651", "pm_score": 1, "selected": false, "text": "<p>If I understand you correctly, you want to change:</p>\n\n<p><code>&lt;li&gt;&lt;a href=\"http://www.ericmmar...
2011/01/21
[ "https://wordpress.stackexchange.com/questions/7443", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1462/" ]
I am using the WP-Paginate plug-in and need to apply a class to the containing LIs for the next/previous links. Can someone tell me how to do this? If there's a better/easier way to do this other than using WP-Paginate, then I'm open to suggestions. Thanks!
Happy to say that it's not hard at all to achieve what you are looking for. As I understand it, [you have to add a call to `wp_paginate()` in *(one of)* your theme*(s)* template file*(s)*](http://svn.wp-plugins.org/wp-paginate/tags/1.2.2/readme.txt) when using this plugin, and that call looks something like this: ``...
7,445
<p>I use this function to get some information to the user columns,</p> <pre><code>function column_company( $defaults ) { $defaults['usercolumn-company'] = __('Company', 'user-column'); $defaults['usercolumn-myoffers'] = __('Applied Offers', 'user-column'); $defaults['usercolumn-totaloffers'] = __('Total O...
[ { "answer_id": 7458, "author": "Eric Martin", "author_id": 2651, "author_profile": "https://wordpress.stackexchange.com/users/2651", "pm_score": 1, "selected": false, "text": "<p>If I understand you correctly, you want to change:</p>\n\n<p><code>&lt;li&gt;&lt;a href=\"http://www.ericmmar...
2011/01/21
[ "https://wordpress.stackexchange.com/questions/7445", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2048/" ]
I use this function to get some information to the user columns, ``` function column_company( $defaults ) { $defaults['usercolumn-company'] = __('Company', 'user-column'); $defaults['usercolumn-myoffers'] = __('Applied Offers', 'user-column'); $defaults['usercolumn-totaloffers'] = __('Total Offers', 'user-...
Happy to say that it's not hard at all to achieve what you are looking for. As I understand it, [you have to add a call to `wp_paginate()` in *(one of)* your theme*(s)* template file*(s)*](http://svn.wp-plugins.org/wp-paginate/tags/1.2.2/readme.txt) when using this plugin, and that call looks something like this: ``...
7,453
<p>How can I <strong>add meta boxes</strong> to the <strong>front end post submission form</strong>? Similar to front end post submission that creates new posts, the form replies should go directly into the post meta boxes. </p> <p><strong>Meta Boxes Code Example for post</strong> from back-end to front-end </p> <pre...
[ { "answer_id": 7460, "author": "Philip", "author_id": 2048, "author_profile": "https://wordpress.stackexchange.com/users/2048", "pm_score": 0, "selected": false, "text": "<p>After your wp_insert_post code use: </p>\n\n<pre><code>add_post_meta($post_id, 'name-of-custom-field', $customFie...
2011/01/21
[ "https://wordpress.stackexchange.com/questions/7453", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2650/" ]
How can I **add meta boxes** to the **front end post submission form**? Similar to front end post submission that creates new posts, the form replies should go directly into the post meta boxes. **Meta Boxes Code Example for post** from back-end to front-end ``` <?php function admin_init(){ add_meta_box("mia_...
You can make a form that has an action of your form handling php script. In the php script, you can check if the form was submitted, and if there is an action, if so, then create variables for the form fields using the $\_POST var. Then create the $post = array() to set up the post meta array, and use the wp\_insert\_p...
7,456
<p>I'm working on a site that will make use of a few custom taxonomies (for custom post types). I've chosen to make some of the taxonomies hierarchical because the method of inputting values (checking boxes) is more desirable for this site than the free-form input of non-hierarchical taxonomies. However, what I would <...
[ { "answer_id": 7481, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 5, "selected": true, "text": "<p>Sure thing, just use CSS and the <code>'admin_head'</code> hook to make it disappear. I believe this is what you ...
2011/01/21
[ "https://wordpress.stackexchange.com/questions/7456", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/49/" ]
I'm working on a site that will make use of a few custom taxonomies (for custom post types). I've chosen to make some of the taxonomies hierarchical because the method of inputting values (checking boxes) is more desirable for this site than the free-form input of non-hierarchical taxonomies. However, what I would **re...
Sure thing, just use CSS and the `'admin_head'` hook to make it disappear. I believe this is what you are looking for? [![Hierarchical taxonomy entry on WordPress post page without the parent](https://i.stack.imgur.com/EJL1w.png)](https://i.stack.imgur.com/EJL1w.png) (source: [mikeschinkel.com](https://mikeschinkel...
7,462
<p>I am developing a church media center using custom post types.</p> <p>I have a custom post type called 'Series' and a custom post type called 'Sermons'.</p> <p>Each Series must have an Title, Image, and Description. Naturally, each Series will be a collection of Sermons (Which will have Audio, Video, and other met...
[ { "answer_id": 18892, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<p>Relationships between posts in WP are not currently available natively and are not viewed as feature important enoug...
2011/01/21
[ "https://wordpress.stackexchange.com/questions/7462", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I am developing a church media center using custom post types. I have a custom post type called 'Series' and a custom post type called 'Sermons'. Each Series must have an Title, Image, and Description. Naturally, each Series will be a collection of Sermons (Which will have Audio, Video, and other metadata). I need t...
I've written a couple of posts that can help you in this, I'm still writing the explanation to the final piece of this, but here we go. **First, an explanation on how to set up the post types:** *this you may not need...* <http://drewgourley.com/custom-post-types-for-wordpress/> **Second, an explanation on setting u...
7,463
<p>When one creates a custom post type you have the ability to define various elements related to that post type which essentially allow you to define things such as the menu title, "add new post" text and stuff like that.</p> <p>What I am trying to figure out is what code I need to add to my functions.php file so I c...
[ { "answer_id": 7480, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 4, "selected": true, "text": "<p>Another easy one! :)</p>\n\n<p>As you know I think very highly of WordPress in general, but the admin menu archit...
2011/01/21
[ "https://wordpress.stackexchange.com/questions/7463", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/479/" ]
When one creates a custom post type you have the ability to define various elements related to that post type which essentially allow you to define things such as the menu title, "add new post" text and stuff like that. What I am trying to figure out is what code I need to add to my functions.php file so I can set the...
Another easy one! :) As you know I think very highly of WordPress in general, but the admin menu architecture is *one of the nastiest hacks I think I've ever seen* in open-source software. What's only greater in magnitude is the core WordPress team's unwillingness to acknowledge how bad it is and their lack of willing...
7,464
<p>Personally I really dislike how wordpress shows all the "popular terms" in different sizes on the taxonomy add/edit screen in the admin area.</p> <p>Does anyone know of a way to either remove this entire area completely by adding code to your functions.php file</p> <p>and/or</p> <p>how to just change this specifi...
[ { "answer_id": 7478, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 3, "selected": true, "text": "<p>Oh, I love it when you give me an easy one. Starts to make up for all those harder ones... <em>(well, partly. ;-)...
2011/01/21
[ "https://wordpress.stackexchange.com/questions/7464", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/479/" ]
Personally I really dislike how wordpress shows all the "popular terms" in different sizes on the taxonomy add/edit screen in the admin area. Does anyone know of a way to either remove this entire area completely by adding code to your functions.php file and/or how to just change this specific area so that none of t...
Oh, I love it when you give me an easy one. Starts to make up for all those harder ones... *(well, partly. ;-)* So what you want is to replace this: [![WordPress Tag Cloud with mixed-sized fonts](https://i.stack.imgur.com/9ncNb.png)](https://i.stack.imgur.com/9ncNb.png) (source: [mikeschinkel.com](https://mikeschi...
7,467
<p>Is there a plugin that allowed me to add google map embed code by only supplying address?</p>
[ { "answer_id": 7469, "author": "Carson", "author_id": 2107, "author_profile": "https://wordpress.stackexchange.com/users/2107", "pm_score": 1, "selected": false, "text": "<p>Map Press would work, but you have to enter each address individually and then it generates a short code that you...
2011/01/21
[ "https://wordpress.stackexchange.com/questions/7467", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/127/" ]
Is there a plugin that allowed me to add google map embed code by only supplying address?
[5secGoogleMaps by WebFactory is a very promising one](http://codecanyon.net/item/5sec-google-maps/152372?ref=mordauk). You enter a map like this: ``` [gmap]your address[/gmap] ```
7,500
<p>I'm working on project, where I have different widgets on pages and also different order. Example - on About page I may have <strong>chat widget</strong>, then <strong>e-mail sign-up widget</strong>, then <strong>testimonials widget</strong>. On other page I may have <strong>testimonials widget</strong> only, follow...
[ { "answer_id": 7502, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 0, "selected": false, "text": "<p>look at <a href=\"http://wordpress.org/extend/plugins/custom-sidebars/\" rel=\"nofollow noreferrer\">Custom si...
2011/01/22
[ "https://wordpress.stackexchange.com/questions/7500", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I'm working on project, where I have different widgets on pages and also different order. Example - on About page I may have **chat widget**, then **e-mail sign-up widget**, then **testimonials widget**. On other page I may have **testimonials widget** only, followed by **chat widget**. I'm using this code to show widg...
I use [Widget Logic](http://wordpress.org/extend/plugins/widget-logic/) at my blog. It is not most convenient solution around, but definitely one of the most flexible. Widgets can be displayed/hidden based on arbitrary PHP condition. Works great with [conditional tags](http://codex.wordpress.org/Conditional_Tags) and w...
7,514
<p>I am trying to create a home page where it is a list of categories with an associated thumbnail for each. I would like it so it returns each category once and returns the associated thumbnail from the latest post, or even better does not require me to add a featured image to each post, but rather grabs the thumbnai...
[ { "answer_id": 7515, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>That hook contraption is kinda messy, why not just call <code>home_cats()</code> in template?</p>\n\n<p>Try this (not...
2011/01/22
[ "https://wordpress.stackexchange.com/questions/7514", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2661/" ]
I am trying to create a home page where it is a list of categories with an associated thumbnail for each. I would like it so it returns each category once and returns the associated thumbnail from the latest post, or even better does not require me to add a featured image to each post, but rather grabs the thumbnail fr...
*Normally* I like to shy away from recommending direct SQL, but in your use-case I think it is warranted. I've coded this up as a direct SQL query; as you may notice is a bit complex. You can copy the following code to your theme's `functions.php` file or add it to the `.php` file of a plugin you might be writing: `...
7,517
<p>I have a custom post type which is working fine, however the meta box does isn't saving.</p> <p>Long &amp; short, i'm stumped!</p> <pre><code>add_action('init', 'portfolio'); function portfolio() { $args = array( 'label' =&gt; __('Portfolio'), 'singular_label' =&gt; __('Portfolio'), 'public' =&gt; true, '...
[ { "answer_id": 7522, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 3, "selected": true, "text": "<p>Hi <strong>@George Wiscombe:</strong> </p>\n\n<p>So close, yet so far! <em>(I know the pain, I'm there often. :)<...
2011/01/22
[ "https://wordpress.stackexchange.com/questions/7517", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1298/" ]
I have a custom post type which is working fine, however the meta box does isn't saving. Long & short, i'm stumped! ``` add_action('init', 'portfolio'); function portfolio() { $args = array( 'label' => __('Portfolio'), 'singular_label' => __('Portfolio'), 'public' => true, 'show_ui' => true, 'menu_position...
Hi **@George Wiscombe:** So close, yet so far! *(I know the pain, I'm there often. :)* You almost had it but are using the wrong hook to do the post meta update. Use the `'wp_insert_post_data'` hook instead of the `'save_post'` hook: ``` <?php if (!class_exists('YourSite_Portfolio')) { class YourSite_Portfolio { ...
7,518
<p>I created a plugin but I just came across a bug that I don't really know how to solve.</p> <p>When you activate my plugin, it creates a file in the active theme directory and when you deactivate it, it deletes that file.</p> <p>The problem is, if you activate the plugin, and then switch the theme, the files won't ...
[ { "answer_id": 7519, "author": "prettyboymp", "author_id": 203, "author_profile": "https://wordpress.stackexchange.com/users/203", "pm_score": 4, "selected": true, "text": "<p>There is a 'switch_theme' action that runs right after the theme is switched.</p>\n<pre><code>function my_on_swi...
2011/01/22
[ "https://wordpress.stackexchange.com/questions/7518", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2415/" ]
I created a plugin but I just came across a bug that I don't really know how to solve. When you activate my plugin, it creates a file in the active theme directory and when you deactivate it, it deletes that file. The problem is, if you activate the plugin, and then switch the theme, the files won't exist in the new ...
There is a 'switch\_theme' action that runs right after the theme is switched. ``` function my_on_switch_theme($new_theme) { $current_themes = wp_get_themes(); /* Fixed deprecated function */ $new_theme_info = $current_themes[$new_theme]; /* $new_theme_info should now be an associative array with the f...
7,524
<p>I have a community blog at thelazy.info . All things are working except the category. When you click on any category it gives 404 Not found error. I tried searching out myself but couldn't come up with a plausible relation. Can anybody guess how can I go with this error.</p> <pre><code>&lt;IfModule mod_rewrite.c&gt...
[ { "answer_id": 7576, "author": "Satish Gandham", "author_id": 2193, "author_profile": "https://wordpress.stackexchange.com/users/2193", "pm_score": 1, "selected": false, "text": "<p>update your permalinks structure, make sure ur htaccess file is writable.</p>\n" }, { "answer_id":...
2011/01/23
[ "https://wordpress.stackexchange.com/questions/7524", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1926/" ]
I have a community blog at thelazy.info . All things are working except the category. When you click on any category it gives 404 Not found error. I tried searching out myself but couldn't come up with a plausible relation. Can anybody guess how can I go with this error. ``` <IfModule mod_rewrite.c> RewriteEngine On R...
In Permalink Settings I would try changing Category base to "category" and see if thelazy.info/category/behavior/ works or not.
7,531
<p>I have a div structure that looks like this...</p> <pre><code>&lt;div class="gallery_lightview"&gt; &lt;div id="lg_image"&gt; &lt;a href="http://www.website.com/?iframe=true&amp;width=100%&amp;height=100%" rel="prettyPhoto[iframes]" class="lightview_main" title="TITLE HERE"&gt; &lt;img class...
[ { "answer_id": 7533, "author": "Pippin", "author_id": 2418, "author_profile": "https://wordpress.stackexchange.com/users/2418", "pm_score": 0, "selected": false, "text": "<p>haven't tested, but try this:</p>\n\n<pre><code>\nvar cnt = $(\".lightview_main\").contents()\n$(\".lightview_main...
2011/01/23
[ "https://wordpress.stackexchange.com/questions/7531", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2675/" ]
I have a div structure that looks like this... ``` <div class="gallery_lightview"> <div id="lg_image"> <a href="http://www.website.com/?iframe=true&width=100%&height=100%" rel="prettyPhoto[iframes]" class="lightview_main" title="TITLE HERE"> <img class="alignnone" src="HEADER.jpg" alt="" /> ...
``` <script type="text/javascript"> function removeLink() { theAs = document.getElementById('lg_image').childNodes; // get all children of div#lg_image for( i = 0; i < theAs.length; i++ ) { // loop through the children if( theAs[i].nodeType != 3 ) { // if the child is not a whitespace, theI...
7,567
<p>I was looking for a decent robots.txt solution for my wordpress sites and after some searching I found Yoast's SEO plugin that provides a complete SEO solution including indexation. I set it up it to <strong>not</strong> index the following pages: search results, login and register pages, all admin pages, date-based...
[ { "answer_id": 7569, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 0, "selected": false, "text": "<p>If you don’t have a physical robots.txt WP will create one on the fly. The plugin will probably place its instructions ...
2011/01/23
[ "https://wordpress.stackexchange.com/questions/7567", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1567/" ]
I was looking for a decent robots.txt solution for my wordpress sites and after some searching I found Yoast's SEO plugin that provides a complete SEO solution including indexation. I set it up it to **not** index the following pages: search results, login and register pages, all admin pages, date-based archives and ta...
Writing a robots.txt is an easy process. Follow these simple steps: Open Notepad, Microsoft Word or any text editor and save the file as 'robots,' all lowercase, making sure to choose .txt as the file type extension (in Word, choose 'Plain Text' ). Next, add the following two lines of text to your file: ``` User-age...
7,594
<p>I'm using WP as a CMS. I've got multiple pages that share the same header.</p> <p>group 1 has header 1. group 2 has header 2. etc.</p> <p>I've looked at these two plugins for a quick way to insert a combination of html and shortcodes. <a href="http://wordpress.org/extend/plugins/wp-include-file/" rel="nofollow">ht...
[ { "answer_id": 7602, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 1, "selected": false, "text": "<p>I have done this before with <a href=\"http://wordpress.org/extend/plugins/wp-include-file/\" rel=\"nofollow\"...
2011/01/24
[ "https://wordpress.stackexchange.com/questions/7594", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/2469/" ]
I'm using WP as a CMS. I've got multiple pages that share the same header. group 1 has header 1. group 2 has header 2. etc. I've looked at these two plugins for a quick way to insert a combination of html and shortcodes. <http://wordpress.org/extend/plugins/wp-include-file/> http://wordpress.org/extend/plugins/post-s...
I have done this before with [wp-include-file](http://wordpress.org/extend/plugins/wp-include-file/) you need to edit the file called wp-include-file.php in the plugin`s directory look at line 144 and replace: ``` return $content; ``` with ``` return do_shortcode($content); ``` that`s it. hope this helps.
7,599
<p>The following code retrieves only custom post types with the custom taxonomy "Slider."</p> <p>I would like to change their order to ASC. </p> <p>The code:</p> <pre><code>&lt;?php // Retrive custom post type with a custom taxonomy assigned to it $posts = new WP_Query('post_type=page_content&amp;page_sections=Sli...
[ { "answer_id": 7601, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>Which order you want to achieve? Chronological? Alphabetical?</p>\n\n<p>In any case see <a href=\"http://codex.wordpr...
2011/01/24
[ "https://wordpress.stackexchange.com/questions/7599", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
The following code retrieves only custom post types with the custom taxonomy "Slider." I would like to change their order to ASC. The code: ``` <?php // Retrive custom post type with a custom taxonomy assigned to it $posts = new WP_Query('post_type=page_content&page_sections=Slider (Front Page)') ?> <?php while (...
just change this line in your code: ``` $posts = new WP_Query('post_type=page_content&page_sections=Slider (Front Page)') ?> ``` to this: ``` $posts = new WP_Query('post_type=page_content&page_sections=Slider (Front Page)&order=ASC') ?> ``` Basically it adds the order parameter witch can take two values (ASC,DE...
7,606
<p>Few days ago I asked a question about <a href="https://wordpress.stackexchange.com/questions/7492/how-to-show-the-taxonomy-assigned-to-a-post-in-the-table-where-all-the-posts-are">How to show a custom taxonomy in a custom post type column (and insert some 'default' terms to the custom taxonomy)</a>. </p> <p>Then I ...
[ { "answer_id": 7608, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 3, "selected": true, "text": "<p>So, you want this?</p>\n\n<p><a href=\"https://i.stack.imgur.com/d7dOL.png\" rel=\"nofollow noreferrer\"><img src...
2011/01/24
[ "https://wordpress.stackexchange.com/questions/7606", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/781/" ]
Few days ago I asked a question about [How to show a custom taxonomy in a custom post type column (and insert some 'default' terms to the custom taxonomy)](https://wordpress.stackexchange.com/questions/7492/how-to-show-the-taxonomy-assigned-to-a-post-in-the-table-where-all-the-posts-are). Then I saw an answer for [Ad...
So, you want this? [![WordPress Admin for Custom Post Types with Custom Filters and Custom Columns](https://i.stack.imgur.com/d7dOL.png)](https://i.stack.imgur.com/d7dOL.png) (source: [mikeschinkel.com](https://mikeschinkel.com/websnaps/Fullscreen-20110124-035055.png)) Alright, here ya go: ``` <?php /* Plugin n...
7,612
<p>I have function that check what is main top category of post. So i have category tree like this</p> <pre><code>Foo -bar --foobar cat2 </code></pre> <p>and if post is in foobar, my function post_is_in_descendant_category shows me "foo" and i can style that post with style-foo.css. What i want now is to make this s...
[ { "answer_id": 7615, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>If i understand right your \"post_is_in_descendant_category\" function checks if a post is descendant of a cate...
2011/01/24
[ "https://wordpress.stackexchange.com/questions/7612", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1853/" ]
I have function that check what is main top category of post. So i have category tree like this ``` Foo -bar --foobar cat2 ``` and if post is in foobar, my function post\_is\_in\_descendant\_category shows me "foo" and i can style that post with style-foo.css. What i want now is to make this same possible for stylin...
If i understand right your "post\_is\_in\_descendant\_category" function checks if a post is descendant of a category and you want to check if a category is descentand. If so the add this function to your functions.php ``` function is_desc_cat($cats, $_post = null) { foreach ((array)$cats as $cat) { if (in_categ...
7,613
<p>I was chatting with a non-techy friend who doesn't even use wordpress...she told me in some blogs, specially activism ones, there are some issues being repeatedly discussed, sometimes she likes to comment on the "issue" not on the post.</p> <p>"issues" are represented by tags usually or categories.</p> <p>so i was...
[ { "answer_id": 7615, "author": "Bainternet", "author_id": 2487, "author_profile": "https://wordpress.stackexchange.com/users/2487", "pm_score": 3, "selected": true, "text": "<p>If i understand right your \"post_is_in_descendant_category\" function checks if a post is descendant of a cate...
2011/01/24
[ "https://wordpress.stackexchange.com/questions/7613", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/692/" ]
I was chatting with a non-techy friend who doesn't even use wordpress...she told me in some blogs, specially activism ones, there are some issues being repeatedly discussed, sometimes she likes to comment on the "issue" not on the post. "issues" are represented by tags usually or categories. so i was wondering, is th...
If i understand right your "post\_is\_in\_descendant\_category" function checks if a post is descendant of a category and you want to check if a category is descentand. If so the add this function to your functions.php ``` function is_desc_cat($cats, $_post = null) { foreach ((array)$cats as $cat) { if (in_categ...
7,621
<p>I want to load head js first and then all enqueued scripts into it's function. Like so...</p> <pre><code>&lt;script src="&gt;/js/head.load.min.js" type="text/javascript" charset="UTF-8"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; head.js("/path/to/jquery.js", "/google/analytics.js", "/js/site.js", fun...
[ { "answer_id": 7622, "author": "Backie", "author_id": 2596, "author_profile": "https://wordpress.stackexchange.com/users/2596", "pm_score": 4, "selected": true, "text": "<p>You should be forewarned that not all plugins/themes use enqueue. When I first started dealing with all the JavaScr...
2011/01/24
[ "https://wordpress.stackexchange.com/questions/7621", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1925/" ]
I want to load head js first and then all enqueued scripts into it's function. Like so... ``` <script src=">/js/head.load.min.js" type="text/javascript" charset="UTF-8"></script> <script type="text/javascript"> head.js("/path/to/jquery.js", "/google/analytics.js", "/js/site.js", function() { // all done }); </sc...
You should be forewarned that not all plugins/themes use enqueue. When I first started dealing with all the JavaScripts and CSS files outputed I just hooked into the enqueued files. This resulted in me only getting 2 out of 10 JavaScript files and 1 out of 3 CSS files. Here is some quick PoCs. Neither tested but mean...