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
2,040
<p>I want to turn the comments off by default with pages and custom post-types</p> <p>Initially I simply used conditionals in the comments display function to avoid displaying the block on these pages, but I need the user to be able to turn the comments back on as required.</p>
[ { "answer_id": 2051, "author": "Travis Northcutt", "author_id": 49, "author_profile": "https://wordpress.stackexchange.com/users/49", "pm_score": 0, "selected": false, "text": "<p>According to <a href=\"http://wordpress.org/support/topic/turn-off-comments-on-pages-by-default\" rel=\"nofo...
2010/09/21
[ "https://wordpress.stackexchange.com/questions/2040", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/784/" ]
I want to turn the comments off by default with pages and custom post-types Initially I simply used conditionals in the comments display function to avoid displaying the block on these pages, but I need the user to be able to turn the comments back on as required.
From what I understand, you want to set pages and some custom post types to have commenting 'off' by default, while posts will still use the default option (i.e. commenting 'on'). If this is the case, the following function will do it. ``` function default_comments_off( $data ) { if( $data['post_type'] == 'page' &...
2,054
<p>I've a series of custom fields attached to certain pages. These fields are named slide1, slide2, side3, slide4, slide5, slide6. </p> <p>These are images which are going to be used as a slideshow (I'm using jflow slider for this - <a href="http://net.tutsplus.com/articles/news/using-the-wonderful-jflow-plugin-screen...
[ { "answer_id": 2048, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<ul>\n<li><p>Are there any known vulnerabilities, related to registration? Not currently and not for low privilege accou...
2010/09/21
[ "https://wordpress.stackexchange.com/questions/2054", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/394/" ]
I've a series of custom fields attached to certain pages. These fields are named slide1, slide2, side3, slide4, slide5, slide6. These are images which are going to be used as a slideshow (I'm using jflow slider for this - <http://net.tutsplus.com/articles/news/using-the-wonderful-jflow-plugin-screencast/> ) (I don't...
Spam bots will always try to register. They basically just input data into any form they can find in hopes it will pull their URL on to your page so they can build trackbacks and score higher in Google rankings. There are a couple of things you can do to prevent this: 1. If you don't need people to register for your ...
2,073
<p>I am creating a custom theme with a theme options page.</p> <p>I would like to style the options page and do not want to include inline styles. Is there any way to include an external stylesheet from say </p> <pre><code>TEMPLATEPATH . '/css/admin.css' </code></pre> <p>I have also found this chunk of code and it s...
[ { "answer_id": 2074, "author": "abrudtkuhl", "author_id": 496, "author_profile": "https://wordpress.stackexchange.com/users/496", "pm_score": 1, "selected": false, "text": "<p>Yea I am answering my own question ... but I did get it to work.</p>\n\n<p>Add this action to your theme's funct...
2010/09/22
[ "https://wordpress.stackexchange.com/questions/2073", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/496/" ]
I am creating a custom theme with a theme options page. I would like to style the options page and do not want to include inline styles. Is there any way to include an external stylesheet from say ``` TEMPLATEPATH . '/css/admin.css' ``` I have also found this chunk of code and it seems to work - [link](http://www....
If you [create an admin theme plugin](http://codex.wordpress.org/Creating_Admin_Themes) from the Codex steps, you will notice it says not to insert stylesheets as per above - although the above will work. If you place the following inside your admin theme file, it will serve the same purpose, but uses the [wp\_enqueu...
2,091
<p>I want to save some parameters in the widget options which are then passed into another page. The widget is a form which calls a webservice.</p> <p>The options I want to pass are the authentication for the webservice which is currently hard coded into the results page (done as a template). Therefore they should be ...
[ { "answer_id": 2092, "author": "Tom Wright", "author_id": 562, "author_profile": "https://wordpress.stackexchange.com/users/562", "pm_score": 2, "selected": false, "text": "<p>Not a noob question at all.</p>\n\n<p>You'll need to dip into MySQL (using PhpMyAdmin or similar) and get the na...
2010/09/22
[ "https://wordpress.stackexchange.com/questions/2091", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/970/" ]
I want to save some parameters in the widget options which are then passed into another page. The widget is a form which calls a webservice. The options I want to pass are the authentication for the webservice which is currently hard coded into the results page (done as a template). Therefore they should be hidden fro...
@JonathonByrd's answer is probably 'best' - certainly you should using `get_option` if at all possible, since there's no guarantee the option name will stay the same between WordPress versions. Similarly - @JonathonByrd also relies on using a global variable which may be removed/renamed (though perhaps very unlikely)....
2,100
<p>I have a problem with WordPress database synchronization between development and production and I am wondering how other people solving it. I am aware about <a href="https://wordpress.stackexchange.com/questions/119/easily-move-a-wordpress-install-from-development-to-production">this question</a> but it doesn't real...
[ { "answer_id": 2102, "author": "curtismchale", "author_id": 141, "author_profile": "https://wordpress.stackexchange.com/users/141", "pm_score": 2, "selected": false, "text": "<p>If it's just more of the exact same type of data (some new blog posts, new comments) I'm not sure why you need...
2010/09/22
[ "https://wordpress.stackexchange.com/questions/2100", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/977/" ]
I have a problem with WordPress database synchronization between development and production and I am wondering how other people solving it. I am aware about [this question](https://wordpress.stackexchange.com/questions/119/easily-move-a-wordpress-install-from-development-to-production) but it doesn't really cover the n...
There may be a better way that I am missing but I am going to give you 2 options: --------------------------------------------------------------------------------- ### 1.Use XML Export to export your new posts and comments. Then use the [WordPress Importer](http://wordpress.org/extend/plugins/wordpress-importer/) to i...
2,117
<p>I am using <code>query_posts( $args )</code> to filter the Loop. I want to filter posts based on their <code>meta_value</code> "vote", sometimes smaller than, sometimes equals and so on....</p> <p>I definitly want to use the <code>query_posts()</code> function and pass my filter through <code>$args</code>! I don't ...
[ { "answer_id": 2118, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 0, "selected": false, "text": "<p>I would recommend parsing your <code>$args</code> array and converting it to a string before passing it into <code>que...
2010/09/22
[ "https://wordpress.stackexchange.com/questions/2117", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I am using `query_posts( $args )` to filter the Loop. I want to filter posts based on their `meta_value` "vote", sometimes smaller than, sometimes equals and so on.... I definitly want to use the `query_posts()` function and pass my filter through `$args`! I don't want to use `add_filter('posts_where', 'filter_where')...
Since WP 3.1, you can cast the meta value to anything you want using the 'type' argument in 'meta\_query': ``` $args = array( 'meta_query'=> array( array( 'key' => 'vote', 'compare' => '>=', 'value' => 5, 'type' => 'numeric', ) ) 'posts_per_page' => 100 ) ); query_posts( $args );...
2,142
<p>I've searched for plugins but while some do halfway accomplish the task they are normally very complicated.</p> <p>I'd like to add option to the visibility menu when creating a page (and post, but page is more urgent).</p> <p><img src="https://i.stack.imgur.com/ZRqGY.png" alt="visibility menu wordpress"></p> <p>T...
[ { "answer_id": 2146, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 2, "selected": false, "text": "<p>I've actually done this before with a custom page template rather than with the visibility options ... because both lo...
2010/09/23
[ "https://wordpress.stackexchange.com/questions/2142", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/687/" ]
I've searched for plugins but while some do halfway accomplish the task they are normally very complicated. I'd like to add option to the visibility menu when creating a page (and post, but page is more urgent). ![visibility menu wordpress](https://i.stack.imgur.com/ZRqGY.png) These options need to be: *"Only visibl...
I've actually done this before with a custom page template rather than with the visibility options ... because both logged in and not logged in users ended up going to the same page. Here's some pseudo-code (i.e. do not actually use the code, but it will give you an idea) ``` $logged_in = is_user_logged_in(); switch(...
2,143
<p>Thanks to some help on here, I've managed to add a custom search box to my main menu... by adding this to my theme's functions.php</p> <pre><code>add_filter('wp_nav_menu_items','search_box_function'); function search_box_function ($nav){ return $nav."&lt;li class='menu-header-search'&gt;&lt;form action='http://...
[ { "answer_id": 2144, "author": "ampt", "author_id": 580, "author_profile": "https://wordpress.stackexchange.com/users/580", "pm_score": 7, "selected": true, "text": "<p>To only add the custom search box to the main menu you could pass the second parameter provided by the wp_nav_menu_item...
2010/09/23
[ "https://wordpress.stackexchange.com/questions/2143", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/394/" ]
Thanks to some help on here, I've managed to add a custom search box to my main menu... by adding this to my theme's functions.php ``` add_filter('wp_nav_menu_items','search_box_function'); function search_box_function ($nav){ return $nav."<li class='menu-header-search'><form action='http://example.com/' id='searc...
To only add the custom search box to the main menu you could pass the second parameter provided by the wp\_nav\_menu\_items filter and check if the theme\_location is the primary location ``` add_filter('wp_nav_menu_items','search_box_function', 10, 2); function search_box_function( $nav, $args ) { if( $args->them...
2,152
<p>I have PHP errors redirected to log file. Only for WP installation so this definitely doesn't come from somewhere else. This is what started to come up recently (this is all of them, not cut):</p> <pre><code>[22-Sep-2010 14:30:41] junk after document element at line 2, column 0 [22-Sep-2010 16:17:08] junk after doc...
[ { "answer_id": 2153, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 2, "selected": true, "text": "<p>A quick Google search confirmed your suspicion ... this is likely an XML parsing error. Furthermore, <a href=\"http://...
2010/09/23
[ "https://wordpress.stackexchange.com/questions/2152", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/847/" ]
I have PHP errors redirected to log file. Only for WP installation so this definitely doesn't come from somewhere else. This is what started to come up recently (this is all of them, not cut): ``` [22-Sep-2010 14:30:41] junk after document element at line 2, column 0 [22-Sep-2010 16:17:08] junk after document element ...
A quick Google search confirmed your suspicion ... this is likely an XML parsing error. Furthermore, [some discussion on the forums](http://wordpress.org/support/topic/junk-after-document-element-breaking-feed?replies=3) suggests it's caused by script insertion after a closing `</rss>` tag. If it is an inserted script...
2,182
<p>I've got a WordPress CPT that I've had running for a couple weeks. There weren't any problems with it.</p> <p>In the last couple days, it's been going haywire. Every few minutes, WordPress forgets that the page exists and returns a 404 error. This can be fixed by flushing the permalink rules in the admin panel, but...
[ { "answer_id": 2183, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 0, "selected": false, "text": "<p>My first instinct is that a plugin might be to blame. Many plugins that touch the WordPress rewrite engine will flush...
2010/09/24
[ "https://wordpress.stackexchange.com/questions/2182", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/245/" ]
I've got a WordPress CPT that I've had running for a couple weeks. There weren't any problems with it. In the last couple days, it's been going haywire. Every few minutes, WordPress forgets that the page exists and returns a 404 error. This can be fixed by flushing the permalink rules in the admin panel, but a few min...
I do not know the specific path layout on your webserver, but the entries from the error log do not look to me that it is specifically wordpress related: > > Invalid method in request \\n\\n > > > This error is caused by an invalid HTTP request. Each HTTP request has a method. Most certainly it was missing in the...
2,200
<p>A faculty member is having difficulties with a instructional wordpress install. Fixing individual permission problems has been hit and miss, and have become a perennial pain, so I'll ask here. What can I do to make WP Just Work? The kinds of errors they get:</p> <blockquote> <p>Installing Plugin: Lightbox 2 2.9.2...
[ { "answer_id": 2202, "author": "Chris_O", "author_id": 251, "author_profile": "https://wordpress.stackexchange.com/users/251", "pm_score": 4, "selected": true, "text": "<p><strong>@pwnguin,</strong></p>\n\n<p>I had the same problems running mod_php with WordPress and I finally figured it...
2010/09/24
[ "https://wordpress.stackexchange.com/questions/2200", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/937/" ]
A faculty member is having difficulties with a instructional wordpress install. Fixing individual permission problems has been hit and miss, and have become a perennial pain, so I'll ask here. What can I do to make WP Just Work? The kinds of errors they get: > > Installing Plugin: Lightbox 2 2.9.2 > Downloading inst...
**@pwnguin,** I had the same problems running mod\_php with WordPress and I finally figured it out. ``` # chown www-data:www-data /home/CIM140/public_html/wordpress/ -R ``` As long as YOU control the box this won't cause any security issues. --- EDIT: You might also need to change your umask to 022 so new direc...
2,255
<p>(<strong>Moderators note</strong>: Was originally titled <em>"How to get_posts of a custom post type that is in two custom taxonomies?"</em>)</p> <p>I have a custom post type that has two taxonomies which are separate, one called <em>"Project Type"</em> and one called <em>"Package"</em>. I need to get a list of pro...
[ { "answer_id": 2256, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>Old Q, but apparently comes up so here is current state — taxonomy queries got much improved in 3.1 and further since...
2010/09/27
[ "https://wordpress.stackexchange.com/questions/2255", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/112/" ]
(**Moderators note**: Was originally titled *"How to get\_posts of a custom post type that is in two custom taxonomies?"*) I have a custom post type that has two taxonomies which are separate, one called *"Project Type"* and one called *"Package"*. I need to get a list of projects which are of *"Project Type"* `A` **a...
As of v1.3, the [Query Multiple Taxonomies](http://wordpress.org/extend/plugins/query-multiple-taxonomies/) plugin works great with WP\_Query. Your original args work as is. ``` $args = array( 'post_type' => 'portfolio', 'numberposts' => -1, 'project_type' => 'A', 'package' => 'A' ); ``` Then make a new query and ch...
2,261
<p>The script below creates a listing of the categories in the site (excluding those in "uncategorized"). </p> <p>If possible, I'd like to modify it so that it only lists the top level categories (no child categories)...</p> <pre><code> $cat_args = array('orderby' =&gt; 'name', 'show_count' =&gt; $c, 'hierarchical...
[ { "answer_id": 2263, "author": "Philip Downer", "author_id": 947, "author_profile": "https://wordpress.stackexchange.com/users/947", "pm_score": 0, "selected": false, "text": "<pre><code>$cat_args = array('orderby' =&gt; 'name', 'show_count' =&gt; $c, 'hierarchical' =&gt; $h);\n$cat_args...
2010/09/27
[ "https://wordpress.stackexchange.com/questions/2261", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
The script below creates a listing of the categories in the site (excluding those in "uncategorized"). If possible, I'd like to modify it so that it only lists the top level categories (no child categories)... ``` $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h); $cat_args['ti...
After some trial and error, this is what it took to make it work... ``` $cat_args = array('orderby' => 'count'); $cat_args['title_li'] = ''; $cat_args['exclude_tree'] = 1; $cat_args['exclude'] = 1; $cat_args['depth'] = 1; wp_list_categories(apply_filters('widget_categories_args', $cat_args)); ...
2,266
<p>I was surprised to learn that custom taxonomies aren't added as body or post classes like categories and tags are.</p> <p>I'm sure this will be added in a future version of WordPress, but in the meantime I need to add a custom taxonomy to the post class so that I can style post in a certain category in that taxonom...
[ { "answer_id": 2267, "author": "Jan Fabry", "author_id": 8, "author_profile": "https://wordpress.stackexchange.com/users/8", "pm_score": 2, "selected": false, "text": "<p>Instead of <a href=\"http://codex.wordpress.org/Function_Reference/the_terms\" rel=\"nofollow\"><code>the_terms</code...
2010/09/27
[ "https://wordpress.stackexchange.com/questions/2266", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1059/" ]
I was surprised to learn that custom taxonomies aren't added as body or post classes like categories and tags are. I'm sure this will be added in a future version of WordPress, but in the meantime I need to add a custom taxonomy to the post class so that I can style post in a certain category in that taxonomy differen...
I found a snippet of code [courtesy of mfields](http://www.wptavern.com/forum/troubleshooting/1758-custom-taxonomy-css-class.html#post17182) that solved this problem for me, here's what I ended up using: ``` <?php // Add custom taxonomies to the post class add_filter( 'post_class', 'custom_taxonomy_post_class',...
2,273
<p>My plugin, <a href="http://plugins.trac.wordpress.org/browser/wp-coda-slider/trunk/wpcodaslider.php?rev=294163" rel="nofollow">WP Coda Slider</a>, uses a shortcode to <code>get_posts</code> and add them to the slider. If one of the posts contains shortcode the shortcode in that post will not work. </p> <pre><code...
[ { "answer_id": 2274, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>The issue is you are echoing raw <code>post_content</code> field from object. It isn't what usually gets to front-end...
2010/09/27
[ "https://wordpress.stackexchange.com/questions/2273", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/251/" ]
My plugin, [WP Coda Slider](http://plugins.trac.wordpress.org/browser/wp-coda-slider/trunk/wpcodaslider.php?rev=294163), uses a shortcode to `get_posts` and add them to the slider. If one of the posts contains shortcode the shortcode in that post will not work. ``` $my_wpcodaslider = new wpcodaslider(); class wpcodas...
The issue is you are echoing raw `post_content` field from object. It isn't what usually gets to front-end. Try: ``` apply_filters( 'the_content', $post->post_content ) ``` If you want to run shortcodes alone (without bunch of other filters) you can do: ``` do_shortcode( $post->post_content ) ``` **Edit** re-rea...
2,286
<p>I am working on a local business directory site that will use custom post types for the business entries. One of the fields will be "Zip Code." How can I set up a location based search? </p> <p>I'd like visitors to be able to enter their zip code and choose a category and show all the businesses withing a certain...
[ { "answer_id": 2567, "author": "gabrielk", "author_id": 839, "author_profile": "https://wordpress.stackexchange.com/users/839", "pm_score": 3, "selected": false, "text": "<p>First you need a table that looks something like this:</p>\n\n<pre><code>zip_code lat lon\n10001 40.7...
2010/09/27
[ "https://wordpress.stackexchange.com/questions/2286", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/765/" ]
I am working on a local business directory site that will use custom post types for the business entries. One of the fields will be "Zip Code." How can I set up a location based search? I'd like visitors to be able to enter their zip code and choose a category and show all the businesses withing a certain radius, or ...
First you need a table that looks something like this: ``` zip_code lat lon 10001 40.77 73.98 ``` ...populated for each zip code. You can expand on this by adding city and state fields if you want to look up that way. Then each store can be given a zip code, and when you need to calculate distance y...
2,295
<p>By looking at the source of any of the WordPress pages on my site, I can see there is this stylesheet link:</p> <pre><code>&lt;link rel='stylesheet' id='adoptStyles-css' href='http://mydomain.com/wp-content/plugins//adopt_styles.css?ver=2.9.1' type='text/css' media='all' /&gt; </code></pre> <p>The link is broken...
[ { "answer_id": 2296, "author": "sorich87", "author_id": 473, "author_profile": "https://wordpress.stackexchange.com/users/473", "pm_score": 0, "selected": false, "text": "<p>It sould be added by a plugin or your theme. Try disabling them one by one to determine the one which is adding it...
2010/09/28
[ "https://wordpress.stackexchange.com/questions/2295", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/155/" ]
By looking at the source of any of the WordPress pages on my site, I can see there is this stylesheet link: ``` <link rel='stylesheet' id='adoptStyles-css' href='http://mydomain.com/wp-content/plugins//adopt_styles.css?ver=2.9.1' type='text/css' media='all' /> ``` The link is broken - the URL is not served by my W...
File with this name comes up in search as part of Adsense Optimizer plugin ([SVN](https://plugins.svn.wordpress.org/adsenseoptimizer/trunk/)). Curiously I don't see stylesheet actually being queued in code... Are you using this plugin? Up to date version?
2,302
<p>I needed a way to filter a page/posts content before it was loaded so I could add scripts to the header if a specific shortcode was present. After much searching I came across this on <a href="http://wpengineer.com">http://wpengineer.com</a></p> <pre><code>function has_my_shortcode($posts) { if ( empty($posts)...
[ { "answer_id": 2304, "author": "sorich87", "author_id": 473, "author_profile": "https://wordpress.stackexchange.com/users/473", "pm_score": 5, "selected": true, "text": "<p>You can use the function <a href=\"http://codex.wordpress.org/Function_Reference/is_active_widget\">is_active_widge...
2010/09/28
[ "https://wordpress.stackexchange.com/questions/2302", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120/" ]
I needed a way to filter a page/posts content before it was loaded so I could add scripts to the header if a specific shortcode was present. After much searching I came across this on <http://wpengineer.com> ``` function has_my_shortcode($posts) { if ( empty($posts) ) return $posts; $found = false; ...
You can use the function [is\_active\_widget](http://codex.wordpress.org/Function_Reference/is_active_widget) . E.g.: ``` function check_widget() { if( is_active_widget( '', '', 'search' ) ) { // check if search widget is used wp_enqueue_script('my-script'); } } add_action( 'init', 'check_widget' ); ...
2,303
<p>Most of my WordPress sites to date have been blog content, along with a 1 or 2 level page hierarchy. </p> <p>I'm now looking at developing a site with the customer site map suggests that a hierarchy of 4 levels of page content is required. In terms of WordPress the hierarchy is easy to create, but I'm looking at t...
[ { "answer_id": 2394, "author": "PaulAdamDavis", "author_id": 1095, "author_profile": "https://wordpress.stackexchange.com/users/1095", "pm_score": 0, "selected": false, "text": "<p>Do you mean you want a bread-crumb type nav? Or list all the pages that are children of the current page Wh...
2010/09/28
[ "https://wordpress.stackexchange.com/questions/2303", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/956/" ]
Most of my WordPress sites to date have been blog content, along with a 1 or 2 level page hierarchy. I'm now looking at developing a site with the customer site map suggests that a hierarchy of 4 levels of page content is required. In terms of WordPress the hierarchy is easy to create, but I'm looking at the ways of ...
menu with non dynamic content ============================= 1. if the menu structure is fixed then you can create a fixed menu using the "new" wp menu system (quadrillion weblog postings on that) menu with dynamic content ========================= 1. if the menu structure is not fixed you can: a. ask the users to m...
2,326
<p>The code below is contained in a plugin file. It just seeks to execute an update query against the wp database. However, its generating a fatal error. </p> <pre><code>Fatal error: Cannot redeclare ce3_cleanup() </code></pre> <p>Do I need to load a config file to get acess to $wpdb->query?</p> <pre><code>function ...
[ { "answer_id": 2327, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 2, "selected": false, "text": "<p>No, <code>Cannot redeclare...</code> means that you already have a function named <code>ce3_cleanup()</code> somewhere...
2010/09/28
[ "https://wordpress.stackexchange.com/questions/2326", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
The code below is contained in a plugin file. It just seeks to execute an update query against the wp database. However, its generating a fatal error. ``` Fatal error: Cannot redeclare ce3_cleanup() ``` Do I need to load a config file to get acess to $wpdb->query? ``` function ce3_cleanup() { $wpdb->query("upd...
The recommended way to write that function would be: ``` function ce3_cleanup() { global $wpdb; $wpdb->query( "update $wpdb->postmeta set meta_key=replace(meta_key,'cb2_customHeader','_cb2_customHeader') where meta_key like 'cb2_customHeader'" ); $wpdb->query( "update $wpdb->postmeta set meta_key=replace(...
2,331
<p>On a related note to "<a href="https://wordpress.stackexchange.com/questions/1216/changing-the-order-of-admin-menu-sections">Changing the Order of Admin Menu Sections?</a>", I'm looking for a way to alphabetically sort the entries in each sub-section of WordPress's admin area.</p> <p>Currently, whenever a new plugi...
[ { "answer_id": 2347, "author": "NetConstructor.com", "author_id": 479, "author_profile": "https://wordpress.stackexchange.com/users/479", "pm_score": 2, "selected": false, "text": "<p>I was looking for the same thing and figured I would copy code provide by Mike below which he claims is ...
2010/09/28
[ "https://wordpress.stackexchange.com/questions/2331", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/166/" ]
On a related note to "[Changing the Order of Admin Menu Sections?](https://wordpress.stackexchange.com/questions/1216/changing-the-order-of-admin-menu-sections)", I'm looking for a way to alphabetically sort the entries in each sub-section of WordPress's admin area. Currently, whenever a new plugin is added, its entry...
I was looking for the same thing and figured I would copy code provide by Mike below which he claims is still very much in alpha since its only been him that has been using it. I have tested it and it seems to work well for me. I'm sure there are use-cases they do not yet handle. Maybe Mike will comment in here and p...
2,333
<p>Several months ago, I was browsing around the Internet and came across a WordPress site that had updates on the posts enclosed in <code>[edit]...[/edit]</code>. Obviously this was a function provided by a plugin that was no longer active.</p> <p>I searched Google and the WordPress plugin directory for a plugin that...
[ { "answer_id": 2347, "author": "NetConstructor.com", "author_id": 479, "author_profile": "https://wordpress.stackexchange.com/users/479", "pm_score": 2, "selected": false, "text": "<p>I was looking for the same thing and figured I would copy code provide by Mike below which he claims is ...
2010/09/28
[ "https://wordpress.stackexchange.com/questions/2333", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/166/" ]
Several months ago, I was browsing around the Internet and came across a WordPress site that had updates on the posts enclosed in `[edit]...[/edit]`. Obviously this was a function provided by a plugin that was no longer active. I searched Google and the WordPress plugin directory for a plugin that provided this shortc...
I was looking for the same thing and figured I would copy code provide by Mike below which he claims is still very much in alpha since its only been him that has been using it. I have tested it and it seems to work well for me. I'm sure there are use-cases they do not yet handle. Maybe Mike will comment in here and p...
2,336
<p>I've created a custom post type called <code>video</code> and I'm using a plugin called <code>Playlist_Order</code> (which changes the <code>menu_order</code> field) to allow the user to use a drag and drop interface to order their videos in a playlist.</p> <p>However, when adding a new post the video appears at th...
[ { "answer_id": 2338, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 4, "selected": true, "text": "<p>Hi <strong>@fxfuture</strong>:</p>\n\n<p>I think what you are looking for is the <code>wp_insert_post_data</code>...
2010/09/29
[ "https://wordpress.stackexchange.com/questions/2336", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1063/" ]
I've created a custom post type called `video` and I'm using a plugin called `Playlist_Order` (which changes the `menu_order` field) to allow the user to use a drag and drop interface to order their videos in a playlist. However, when adding a new post the video appears at the top of the playlist because it's given a ...
Hi **@fxfuture**: I think what you are looking for is the `wp_insert_post_data` hook. You can add this code to the bottom of your theme's `functions.php` file and/or you can add it to a plugin: ``` add_filter('wp_insert_post_data','my_wp_insert_post_data',10,2); function my_wp_insert_post_data($data, $postarr) { $p...
2,348
<p>Our team has run in to a problem working with wordpress 3 multiblog. We usually work with a local copy of the site (localhost/testsite) but with the same database to keep all changes up to date. </p> <p>This works fine in a single install because you can override the database configs from php with:</p> <pre><code...
[ { "answer_id": 4145, "author": "hakre", "author_id": 178, "author_profile": "https://wordpress.stackexchange.com/users/178", "pm_score": 2, "selected": false, "text": "<p>Well if you want to do this right, you would have one database for development, one for staging and then the live dat...
2010/09/29
[ "https://wordpress.stackexchange.com/questions/2348", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1082/" ]
Our team has run in to a problem working with wordpress 3 multiblog. We usually work with a local copy of the site (localhost/testsite) but with the same database to keep all changes up to date. This works fine in a single install because you can override the database configs from php with: ``` define('URL',$path); ...
Well if you want to do this right, you would have one database for development, one for staging and then the live database. It's just that Wordpress is not designed to live with such commons in software engineering. The component I still see publicly missing is a complete migration script that is able to convert all w...
2,361
<p>I have defined a custom post type that uses a meta field to store dates.</p> <p>In my functions.php I have the following code which saves the start date. The format of the date that is sent in the <code>startdate</code> form parameter is <code>2010/12/01 9:00 AM</code></p> <pre><code>add_action('save_post', 'save_de...
[ { "answer_id": 2362, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 3, "selected": true, "text": "<p>You store date as formatted string, but <code>time()</code> function you take for comparison returns numeric timestamp...
2010/09/29
[ "https://wordpress.stackexchange.com/questions/2361", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/193/" ]
I have defined a custom post type that uses a meta field to store dates. In my functions.php I have the following code which saves the start date. The format of the date that is sent in the `startdate` form parameter is `2010/12/01 9:00 AM` ``` add_action('save_post', 'save_details'); function save_details(){ gl...
You store date as formatted string, but `time()` function you take for comparison returns numeric timestamp. So you are trying to make comparison between too completely different formats and it's unlikely WP is smart enough to get that.
2,370
<p>For one of my custom post types I want a specific user to be able to edit existing posts created by admin but not be able to Add New posts.</p> <p>How can this be done?</p> <p>If I define the user role as not being able to Publish it still allows them to add a new post and submit for review.</p>
[ { "answer_id": 2374, "author": "sorich87", "author_id": 473, "author_profile": "https://wordpress.stackexchange.com/users/473", "pm_score": 3, "selected": true, "text": "<p>You will have to do something like this:</p>\n\n<pre><code>function hide_buttons() {\n global $current_screen;\n...
2010/09/29
[ "https://wordpress.stackexchange.com/questions/2370", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1063/" ]
For one of my custom post types I want a specific user to be able to edit existing posts created by admin but not be able to Add New posts. How can this be done? If I define the user role as not being able to Publish it still allows them to add a new post and submit for review.
You will have to do something like this: ``` function hide_buttons() { global $current_screen; if($current_screen->id == 'edit-post' && !current_user_can('publish_posts')) { echo '<style>.add-new-h2{display: none;}</style>'; } } add_action('admin_head','hide_buttons'); ``` See: <http://erisds....
2,375
<p>How can I change the page that the 'view' action links to on the list post screen for a custom post type?</p> <p><strong>Update</strong></p> <p>I've got it to work with normal post types using the below code but where do I define the custom post type?</p> <pre><code>function change_link($post_url,$post) { ret...
[ { "answer_id": 2376, "author": "scribu", "author_id": 205, "author_profile": "https://wordpress.stackexchange.com/users/205", "pm_score": 3, "selected": true, "text": "<p>By adding a filter to <a href=\"http://adambrown.info/p/wp_hooks/hook/post_link\" rel=\"nofollow\">the <code>'post_li...
2010/09/29
[ "https://wordpress.stackexchange.com/questions/2375", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1063/" ]
How can I change the page that the 'view' action links to on the list post screen for a custom post type? **Update** I've got it to work with normal post types using the below code but where do I define the custom post type? ``` function change_link($post_url,$post) { return '/video?id='.$post->ID; } add_filter(...
By adding a filter to [the `'post_link'` hook](http://adambrown.info/p/wp_hooks/hook/post_link). See the [`get_permalink()`](http://codex.wordpress.org/Function_Reference/get_permalink) function for more info. For custom post types, you can use [the `'post_type_link'` hook](http://adambrown.info/p/wp_hooks/hook/post_l...
2,384
<p>I am looking for a way to remove all the unessesary text from default worpdress metaboxes.</p> <p>Preferably I would like to ensure that the content is not just hidden through CSS but actually removed from the HTML so it does not even show up in the source.</p> <p>The areas I am interested in removing include:</p>...
[ { "answer_id": 2385, "author": "Marjorie Roswell", "author_id": 1079, "author_profile": "https://wordpress.stackexchange.com/users/1079", "pm_score": 2, "selected": false, "text": "<p>Jake Goldman's excellent talk at WordCamp Mid-Atlantic provides an excellent guide: <a href=\"http://www...
2010/09/30
[ "https://wordpress.stackexchange.com/questions/2384", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/479/" ]
I am looking for a way to remove all the unessesary text from default worpdress metaboxes. Preferably I would like to ensure that the content is not just hidden through CSS but actually removed from the HTML so it does not even show up in the source. The areas I am interested in removing include: 1. The HELP button ...
Here's an answer to question #1. Not enough time right now to do the rest. 1.) Removing Admin Help Link Button ----------------------------------- Unfortunately WordPress doesn't provide a hook to let you affect the Help Button on the top right of the admin, but you can use a *somewhat dirty hack* to achieve what you...
2,389
<p>On creation of a custom post type I'm trying to define capabilities but it's not working. What's wrong with this code?</p> <pre><code>$args = array( 'labels' =&gt; $labels, 'public' =&gt; true, 'publicly_queryable' =&gt; true, 'show_ui' =&gt; true, 'query_var' =&gt; true, 'rewrite' =&gt; true, 'hierar...
[ { "answer_id": 2391, "author": "sorich87", "author_id": 473, "author_profile": "https://wordpress.stackexchange.com/users/473", "pm_score": 4, "selected": true, "text": "<p>You code seems to be correct. Try the following instead.</p>\n\n<pre><code>$args = array(\n 'labels' =&gt; $labe...
2010/09/30
[ "https://wordpress.stackexchange.com/questions/2389", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1063/" ]
On creation of a custom post type I'm trying to define capabilities but it's not working. What's wrong with this code? ``` $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => true, 'hierarchical' => false, 'menu_positi...
You code seems to be correct. Try the following instead. ``` $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => true, 'hierarchical' => false, 'menu_position' => null, 'supports' => array('title'),...
2,393
<p>I would like to change the markup created by [gallery] from what is it as standard (dl) to a unordered-list with a difference. Below is the desired markup:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="/path/to/image.jpg"&gt;&lt;img src="/path/to/image.jpg" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href=...
[ { "answer_id": 2395, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>Output of items in <code>gallery_shortcode()</code> function is not filtered, so no opportunity to change it there. M...
2010/09/30
[ "https://wordpress.stackexchange.com/questions/2393", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1095/" ]
I would like to change the markup created by [gallery] from what is it as standard (dl) to a unordered-list with a difference. Below is the desired markup: ``` <ul> <li><a href="/path/to/image.jpg"><img src="/path/to/image.jpg" /></a></li> <li><a href="/path/to/image2.jpg"><img src="/path/to/image2.jpg" /></a>...
Thanks for your replies, Jan & Rarst. They pointed me in the right direction. Here's what I ended up with. This disables shortcodes in the content. Perfect for this site & the function gets attached images & spits them out as a list. (I found the function somewhere & slimmed it down a little) ``` // Removed shortcode...
2,399
<p>I am building a site in WordPress. It has multiple subpages, many of which require different sidebars. So, I have a widgetized theme and I have also created a few sidebar widgets.</p> <p>I have written a conditional statement to show different sidebars on different pages. However, one widgetized sidebar displays on...
[ { "answer_id": 2457, "author": "John P Bloch", "author_id": 11, "author_profile": "https://wordpress.stackexchange.com/users/11", "pm_score": 2, "selected": false, "text": "<p>I don't know why anybody checks whether <code>dynamic_sidebar</code> exists. It's been around for 9 major releas...
2010/09/30
[ "https://wordpress.stackexchange.com/questions/2399", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1097/" ]
I am building a site in WordPress. It has multiple subpages, many of which require different sidebars. So, I have a widgetized theme and I have also created a few sidebar widgets. I have written a conditional statement to show different sidebars on different pages. However, one widgetized sidebar displays on almost al...
More easy & elegant (higher maintainability): ``` <?php // Your sidebar should have the wp_meta action hook wp_meta(); // in ex. your functions.php function my_sidebar_content() { // "About" Page if ( is_page('about') ) { // If some widget is added via Admin > Design > Widgets if ( is_active...
2,405
<p>I'm able to easily include my custom post types into my main loop by making small adjustments with <code>query_posts()</code>, but I'm not sure how I would go about including custom post types in the "Recent Posts" sidebar widget (or any of the other widgets, for that matter).</p> <p>How should I go about expanding...
[ { "answer_id": 2408, "author": "sorich87", "author_id": 473, "author_profile": "https://wordpress.stackexchange.com/users/473", "pm_score": 1, "selected": false, "text": "<p>You can copy the widget code (see /wp-includes/default-widgets.php) and modify the query line.</p>\n" }, { ...
2010/09/30
[ "https://wordpress.stackexchange.com/questions/2405", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/92/" ]
I'm able to easily include my custom post types into my main loop by making small adjustments with `query_posts()`, but I'm not sure how I would go about including custom post types in the "Recent Posts" sidebar widget (or any of the other widgets, for that matter). How should I go about expanding "Recent Posts" scope...
You'll have to edit the code for the *Recent Posts* widget or create your own version based on the default. The code is in the `wp-includes/default-widgets.php` file around line 513. But since you should never make modifications to core, my recommendation would be to copy the code to create your own *My Custom Recent P...
2,416
<p>I have a function that returns an array os posts ids.</p> <p>At the moment, everytime i have a query i have to to this:</p> <p>$ids = agendados();<br> query_posts(array('post__not_in' => $ids );</p> <p>Is there a way to maintain the array by calling that on header.php and use this array everytime a do a query_pos...
[ { "answer_id": 2417, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 1, "selected": false, "text": "<p>I would actually recommend a different approach:</p>\n\n<p>Create a special category for this set of posts (for exampl...
2010/09/30
[ "https://wordpress.stackexchange.com/questions/2416", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/433/" ]
I have a function that returns an array os posts ids. At the moment, everytime i have a query i have to to this: $ids = agendados(); query\_posts(array('post\_\_not\_in' => $ids ); Is there a way to maintain the array by calling that on header.php and use this array everytime a do a query\_posts? I think that do...
I don't like using categories for this, as they are supposed to be semantic terms. I do, however, like the idea of the global array. Instead of creating a new query directly, I will filter it through a function that will add the results to a global array and return the results: I add this to functions.php: ``` functi...
2,423
<p>I admit, I still think in Drupal. (In choosing between developing in WordPress and Drupal, I still tend to favor Drupal, because I haven't yet figured out a few things on the WordPress side.) </p> <p><strong>Can you help to figure out how to achieve in WordPress at least some of the Views functionality I know and l...
[ { "answer_id": 2471, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 1, "selected": false, "text": "<p>lol, i think you still need to invest more on wordpress codex\nfunction: get_post_meta\ncheck this on wordpress cod...
2010/09/30
[ "https://wordpress.stackexchange.com/questions/2423", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1079/" ]
I admit, I still think in Drupal. (In choosing between developing in WordPress and Drupal, I still tend to favor Drupal, because I haven't yet figured out a few things on the WordPress side.) **Can you help to figure out how to achieve in WordPress at least some of the Views functionality I know and love?** I can se...
1. display custom fields in columns and rows: [get\_post\_meta](http://codex.wordpress.org/Function_Reference/get_post_meta) to display them in your theme, and [add\_meta\_box](http://codex.wordpress.org/Function_Reference/add_meta_box) to customize the admin 2. Expose filters, that is, create drop-downs at the top, to...
2,441
<p>I'm trying to include the post title in a custom post type edit screen. For example if the post is called Biography, I want the edit page title to be 'Edit Biography'. I'm using the below code:</p> <pre><code>function my_post_register() { $mypagetitle = $post-&gt;post_title; $labels = array( 'edit_item' =&gt; _...
[ { "answer_id": 2445, "author": "keranm", "author_id": 1107, "author_profile": "https://wordpress.stackexchange.com/users/1107", "pm_score": 0, "selected": false, "text": "<p>two things I'd suggest. First try adding global $post as the first line in your function</p>\n\n<pre><code>global ...
2010/10/01
[ "https://wordpress.stackexchange.com/questions/2441", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1063/" ]
I'm trying to include the post title in a custom post type edit screen. For example if the post is called Biography, I want the edit page title to be 'Edit Biography'. I'm using the below code: ``` function my_post_register() { $mypagetitle = $post->post_title; $labels = array( 'edit_item' => __('Edit '.$mypagetit...
This will do it: ``` function edit_screen_title() { global $post, $title, $action, $current_screen; if( isset( $current_screen->post_type ) && $current_screen->post_type == 'post' && $action == 'edit' ) $title = 'Edit ' . $post->post_title; } add_action( 'admin_head', 'edit_screen_title' ); ```
2,446
<p>I've decided, that some second level pages I have, should really be blog articles. I want to copy and paste the title and body to an article and then delete the page (is there a better way of doing this?).</p> <p>Now I'm worrying about already existing links to the pages. I don't want them to break ...</p> <p>can ...
[ { "answer_id": 2447, "author": "sgelob", "author_id": 1017, "author_profile": "https://wordpress.stackexchange.com/users/1017", "pm_score": 1, "selected": false, "text": "<p>You can edit in your database \"wp_posts\" table the row \"post_type\", simply change \"page\" to \"post\". Then s...
2010/10/01
[ "https://wordpress.stackexchange.com/questions/2446", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/154/" ]
I've decided, that some second level pages I have, should really be blog articles. I want to copy and paste the title and body to an article and then delete the page (is there a better way of doing this?). Now I'm worrying about already existing links to the pages. I don't want them to break ... can I somehow enter t...
Use the [Vice Versa plugin](http://wordpress.org/extend/plugins/vice-versa/) to change the post type. Redirect the URL per .htaccess: ``` Redirect permanent /old-url /new-url ```
2,452
<p>I visit <a href="http://ltty.wordpress.com/" rel="nofollow">http://ltty.wordpress.com/</a> and want to know the theme name (so that I can use :) for my blog). How can I get it?</p>
[ { "answer_id": 2453, "author": "Marjorie Roswell", "author_id": 1079, "author_profile": "https://wordpress.stackexchange.com/users/1079", "pm_score": 4, "selected": true, "text": "<p>This method isn't always fireproof, but you can often look at the source code (right click on white space...
2010/10/01
[ "https://wordpress.stackexchange.com/questions/2452", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/992/" ]
I visit <http://ltty.wordpress.com/> and want to know the theme name (so that I can use :) for my blog). How can I get it?
This method isn't always fireproof, but you can often look at the source code (right click on white space in the blog), and look for the word "themes." For instance, in the case of ltty.wordpress.com, this line appears: ``` <link rel="stylesheet" href="http://s2.wp.com/wp-content/themes/pub/inove/style.css?m=128572159...
2,474
<p>Anyone know how to disable this functionality so the meta boxes can't be repositioned?</p>
[ { "answer_id": 2495, "author": "bueltge", "author_id": 170, "author_profile": "https://wordpress.stackexchange.com/users/170", "pm_score": 2, "selected": false, "text": "<p>The fastest way is deactivate the JS for this function. But i think, it is better when you also deregister the styl...
2010/10/01
[ "https://wordpress.stackexchange.com/questions/2474", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1063/" ]
Anyone know how to disable this functionality so the meta boxes can't be repositioned?
I had the same problem, and Google lead me here. Unfortunately none of these answers helped, but I ultimately figured out the answer, and it's quite easy! 1. First, enqueue a JavaScript file (I won't rehash this process; there are many tutorials that can describe this process better than I). I hooked into `admin_enque...
2,475
<p>I am working on a theme where I would like users to be able to select pages to show in the theme options page much like Thesis.</p> <p>I've been Googling / reverse engineering Thesis for a couple hours but haven't found a great solution. I am wondering if anyone has done this or has seen a tutorial.</p> <p><img sr...
[ { "answer_id": 2495, "author": "bueltge", "author_id": 170, "author_profile": "https://wordpress.stackexchange.com/users/170", "pm_score": 2, "selected": false, "text": "<p>The fastest way is deactivate the JS for this function. But i think, it is better when you also deregister the styl...
2010/10/01
[ "https://wordpress.stackexchange.com/questions/2475", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/496/" ]
I am working on a theme where I would like users to be able to select pages to show in the theme options page much like Thesis. I've been Googling / reverse engineering Thesis for a couple hours but haven't found a great solution. I am wondering if anyone has done this or has seen a tutorial. ![alt text](https://i.st...
I had the same problem, and Google lead me here. Unfortunately none of these answers helped, but I ultimately figured out the answer, and it's quite easy! 1. First, enqueue a JavaScript file (I won't rehash this process; there are many tutorials that can describe this process better than I). I hooked into `admin_enque...
2,529
<p>I've got a custom template page called <code>'shop'</code>, which is found at the URL <code>http://mysite.com/shop/</code>. This page lays out all the posts of post_type <code>'product'</code> like this:</p> <pre><code>&lt;div class="product"&gt; &lt;a name="product-name"&gt;&lt;/a&gt; &lt;img src="path/to/image....
[ { "answer_id": 2532, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 3, "selected": true, "text": "<p>Dumb question, but had you tried:</p>\n\n<pre><code>&lt;a href=\"/shop/#product-name\"&gt;Buy this product!&lt;/a&gt;\...
2010/10/04
[ "https://wordpress.stackexchange.com/questions/2529", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/355/" ]
I've got a custom template page called `'shop'`, which is found at the URL `http://mysite.com/shop/`. This page lays out all the posts of post\_type `'product'` like this: ``` <div class="product"> <a name="product-name"></a> <img src="path/to/image.jpg" /> <h4>Product name</h4>` <p>A description of the product....
Dumb question, but had you tried: ``` <a href="/shop/#product-name">Buy this product!</a> ```
2,547
<p>I want to embed links to the archive pages with specific search criteria. i.e Links to specific categories, links to specific authors etc etc</p> <p>At the moment I am adding the links using anchor tags, but these will fail if the permalinks change</p>
[ { "answer_id": 2550, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": true, "text": "<p>WordPress can generate these, so you can too. You would need to use the same function that WordPress does.</p>\n\n<p>...
2010/10/04
[ "https://wordpress.stackexchange.com/questions/2547", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/784/" ]
I want to embed links to the archive pages with specific search criteria. i.e Links to specific categories, links to specific authors etc etc At the moment I am adding the links using anchor tags, but these will fail if the permalinks change
WordPress can generate these, so you can too. You would need to use the same function that WordPress does. For category it would be something like: ``` $category = get_category_by_slug( 'example' ); $link = get_category_link( $category->term_id ); ``` Similarly there is `get_tag_link()` and on deeper level they al...
2,565
<p>I want to add both custom html that advanced text widgets can't support and the standard sidebar widgets in the same sidebar. However, when I put a sidebar widget into the theme, it removes all the custom html and just displays the widgets in the sidebar. It shouldn't be a tough fix, but I am pretty big php noob who...
[ { "answer_id": 2566, "author": "sorich87", "author_id": 473, "author_profile": "https://wordpress.stackexchange.com/users/473", "pm_score": 3, "selected": true, "text": "<p>I suppose you are doing something like this:</p>\n\n<pre><code>&lt;?php if ( ! dynamic_sidebar( 'widget-area' ) ) :...
2010/10/04
[ "https://wordpress.stackexchange.com/questions/2565", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/919/" ]
I want to add both custom html that advanced text widgets can't support and the standard sidebar widgets in the same sidebar. However, when I put a sidebar widget into the theme, it removes all the custom html and just displays the widgets in the sidebar. It shouldn't be a tough fix, but I am pretty big php noob who le...
I suppose you are doing something like this: ``` <?php if ( ! dynamic_sidebar( 'widget-area' ) ) : ?> Your sidebar code goes here. <?php endif; ?> ``` If yes, do this instead: ``` Your sidebar code goes here. <?php dynamic_sidebar( 'widget-area' ); ?> ```
2,569
<p>I have a variable containing some post ID´s. I´d like to output the posts in that variable using the standard wordpress loop. How can I do that?</p> <p>Thanks!</p> <p>Added:</p> <pre><code>&lt;?php /* Template Name: Favorites page */ $favorites = wpfp_get_users_favorites($user = ''); $favorites_query = new WP_Q...
[ { "answer_id": 2570, "author": "sorich87", "author_id": 473, "author_profile": "https://wordpress.stackexchange.com/users/473", "pm_score": 3, "selected": true, "text": "<p>An example:</p>\n\n<pre><code>$posts_ids = array(2,56,87,23,5); // this is an array of posts IDs\n\n&lt;?php $my_qu...
2010/10/04
[ "https://wordpress.stackexchange.com/questions/2569", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I have a variable containing some post ID´s. I´d like to output the posts in that variable using the standard wordpress loop. How can I do that? Thanks! Added: ``` <?php /* Template Name: Favorites page */ $favorites = wpfp_get_users_favorites($user = ''); $favorites_query = new WP_Query('post__in' => $favorites);...
An example: ``` $posts_ids = array(2,56,87,23,5); // this is an array of posts IDs <?php $my_query = new WP_Query(array('post__in'=>$posts_ids)); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <!-- Do stuff... --> <?php endwhile; ?> ```
2,572
<p>So i've installed a plug-in which allows me to enable two-factor authentication for my users. The problem is that to enable the plug-in i have to log in as that user and enable it via their profile page (wp-admin).</p> <p>This isn't a problem except for the fact that there's nothing stopping the users from logging ...
[ { "answer_id": 2576, "author": "John P Bloch", "author_id": 11, "author_profile": "https://wordpress.stackexchange.com/users/11", "pm_score": 3, "selected": true, "text": "<p>You could make it a mu-plugin ('Must Use' plugin). Any PHP file you put into /wp-content/mu-plugins/ will automat...
2010/10/05
[ "https://wordpress.stackexchange.com/questions/2572", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1144/" ]
So i've installed a plug-in which allows me to enable two-factor authentication for my users. The problem is that to enable the plug-in i have to log in as that user and enable it via their profile page (wp-admin). This isn't a problem except for the fact that there's nothing stopping the users from logging in and dis...
You could make it a mu-plugin ('Must Use' plugin). Any PHP file you put into /wp-content/mu-plugins/ will automatically get included in WordPress. You can't deactivate the plugin (unless you have ftp access to the server). If you go with a mu-plugin, make sure to put the functionality into a subdirectory and bootstrap ...
2,574
<p>I am using the new menu system of Wordpress, and here is the result of wp_nav_menu()</p> <pre><code> &lt;div class="menu-main-menu-container"&gt; &lt;ul id="menu-main-menu" class="menu"&gt; &lt;li id="menu-item-28" class="menu-item menu-item-type-post_type current-menu-item page_item page-item-21 current_p...
[ { "answer_id": 2577, "author": "John P Bloch", "author_id": 11, "author_profile": "https://wordpress.stackexchange.com/users/11", "pm_score": 6, "selected": true, "text": "<p>The wrapping div is easy. When you use <code>wp_nav_menu()</code>, add this argument: <code>'container' =&gt; fal...
2010/10/05
[ "https://wordpress.stackexchange.com/questions/2574", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I am using the new menu system of Wordpress, and here is the result of wp\_nav\_menu() ``` <div class="menu-main-menu-container"> <ul id="menu-main-menu" class="menu"> <li id="menu-item-28" class="menu-item menu-item-type-post_type current-menu-item page_item page-item-21 current_page_item menu-item-28"><a h...
The wrapping div is easy. When you use `wp_nav_menu()`, add this argument: `'container' => false` For the `<ul>` element, there's an argument called `'items_wrap'`. See [woodchucky's answer](https://wordpress.stackexchange.com/questions/2574/remove-wrapping-div-and-ul-from-output-of-wp-nav-menu/13347#13347) for more i...
2,593
<p>I have 3 different custom post types: 1.) <code>"events"</code>, 2.) <code>"winners"</code> and 3.) <code>"offers"</code>. How would I go about retrieving the first (latest) post in each of these post types on a single web page (i.e a home page).</p> <p>Would I use <code>get_posts()</code> or would I have to manipu...
[ { "answer_id": 2608, "author": "sorich87", "author_id": 473, "author_profile": "https://wordpress.stackexchange.com/users/473", "pm_score": 3, "selected": true, "text": "<p>Yes, <a href=\"http://codex.wordpress.org/Function_Reference/get_posts\" rel=\"nofollow noreferrer\">get_posts</a> ...
2010/10/05
[ "https://wordpress.stackexchange.com/questions/2593", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/376/" ]
I have 3 different custom post types: 1.) `"events"`, 2.) `"winners"` and 3.) `"offers"`. How would I go about retrieving the first (latest) post in each of these post types on a single web page (i.e a home page). Would I use `get_posts()` or would I have to manipulate `the_loop()`?
Yes, [get\_posts](http://codex.wordpress.org/Function_Reference/get_posts) is the safest way to use multiple loops. It does not mess up with the original query. Another way would be to create new WP\_Query objects: ``` $my_query = new WP_Query($args); while ($my_query->have_posts()) : $my_query->the_post(); ``` Not...
2,614
<p>I need to rewrite some URLs to custom templates. For example, I have a page at domain.com/page, and when a user clicks 'remove' on an element, it goes to domain.com/page/?remove=54. I'd like it to rewrite to domain.com/page/remove/54.</p> <p>Help is appreciated, thank you in advance!</p>
[ { "answer_id": 3841, "author": "hakre", "author_id": 178, "author_profile": "https://wordpress.stackexchange.com/users/178", "pm_score": 0, "selected": false, "text": "<p>This is totally simple. In you PHP script where you output the <code>?remove=54</code> just output <code>remove/54</c...
2010/10/05
[ "https://wordpress.stackexchange.com/questions/2614", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1099/" ]
I need to rewrite some URLs to custom templates. For example, I have a page at domain.com/page, and when a user clicks 'remove' on an element, it goes to domain.com/page/?remove=54. I'd like it to rewrite to domain.com/page/remove/54. Help is appreciated, thank you in advance!
Since you want to add something to the end of every post/page rewrite rule, you probably can just add a *rewrite endpoint*. These are regexes of the form `/[endpoint_name](/[optional_extra_stuff])?` that are appended to the already generated rules for pages, posts, archives, ... You define on which structures you want...
2,623
<p>I have two custom taxonomies applied to two custom post types. the terms list on the sidebar just fine and will list all posts associated with it. However, if you search one of the terms in specific, it doesn't bring up a post with that term.</p> <p>Example: <a href="http://dev.andrewnorcross.com/das/all-case-studi...
[ { "answer_id": 2700, "author": "Jan Fabry", "author_id": 8, "author_profile": "https://wordpress.stackexchange.com/users/8", "pm_score": 3, "selected": false, "text": "<p>Is this the standard WordPress search? Because that <a href=\"http://core.trac.wordpress.org/browser/branches/3.0/wp-...
2010/10/06
[ "https://wordpress.stackexchange.com/questions/2623", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/403/" ]
I have two custom taxonomies applied to two custom post types. the terms list on the sidebar just fine and will list all posts associated with it. However, if you search one of the terms in specific, it doesn't bring up a post with that term. Example: <http://dev.andrewnorcross.com/das/all-case-studies/> Search for te...
I would recommend the **Search Everything** plugin too, but if you want to implement this using WP's search function, here's the code I'm using in my Atom theme: ``` // search all taxonomies, based on: http://projects.jesseheap.com/all-projects/wordpress-plugin-tag-search-in-wordpress-23 function atom_search_where($w...
2,624
<p>I am trying to set up Wordpress for a client who uses XO Communications as a host. However, getting Wordpress set up is driving me nuts. I keep getting this error message <em>(wrapping message for clarity)</em>:</p> <pre><code>Warning: main(./wordpress/wp-blog-header.php) [function.main]: failed to open stream: ...
[ { "answer_id": 2627, "author": "bangbambang", "author_id": 1121, "author_profile": "https://wordpress.stackexchange.com/users/1121", "pm_score": 0, "selected": false, "text": "<p>what's this for?</p>\n\n<pre><code>require('./wordpress/wp-blog-header.php');\n</code></pre>\n\n<p>and if you...
2010/10/06
[ "https://wordpress.stackexchange.com/questions/2624", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1097/" ]
I am trying to set up Wordpress for a client who uses XO Communications as a host. However, getting Wordpress set up is driving me nuts. I keep getting this error message *(wrapping message for clarity)*: ``` Warning: main(./wordpress/wp-blog-header.php) [function.main]: failed to open stream: No such file or direct...
Did you get clean copy of WordPress for reinstall (like went and downloaded from wordpres.org)? That line should be following ([SVN](http://core.svn.wordpress.org/trunk/index.php)) ``` require('./wp-blog-header.php'); ``` And it absolutely should not be edited since it is part of WordPress core.
2,638
<p>My pagination is only linking to the same posts that are on my front page.</p> <p>I have 3 posts on my front page, when I press next it goes to /page/2 but only shows the same 3 posts, with no previous button. The next button is still there, but still goes to page/1</p> <p>Here is the full query.</p> <pre><code>&...
[ { "answer_id": 2639, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>Pagination functions are meant to be used with main Loop. They are relying on global variables <code>$paged</code> an...
2010/10/06
[ "https://wordpress.stackexchange.com/questions/2638", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/784/" ]
My pagination is only linking to the same posts that are on my front page. I have 3 posts on my front page, when I press next it goes to /page/2 but only shows the same 3 posts, with no previous button. The next button is still there, but still goes to page/1 Here is the full query. ``` <?php query_post...
Building off of what Rarst has said, I'm pretty sure the query string will retain 'paged' queries even if `WP_Query` strips it out as irrelevant. You could try replacing your query posts line with this: ``` global $query_string; parse_str( $query_string, $my_query_array ); $paged = ( isset( $my_query_array['paged'] ) ...
2,642
<p>Does anybody know of any good publicly-available Wordpress training materials (videos, manuals, etc.) that could be used to give content editors a basic overview of Wordpress. We have a a handful of blogs on a Wordpress server and I'd really like to be able to automate training some more.</p>
[ { "answer_id": 2639, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 1, "selected": false, "text": "<p>Pagination functions are meant to be used with main Loop. They are relying on global variables <code>$paged</code> an...
2010/10/06
[ "https://wordpress.stackexchange.com/questions/2642", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1162/" ]
Does anybody know of any good publicly-available Wordpress training materials (videos, manuals, etc.) that could be used to give content editors a basic overview of Wordpress. We have a a handful of blogs on a Wordpress server and I'd really like to be able to automate training some more.
Building off of what Rarst has said, I'm pretty sure the query string will retain 'paged' queries even if `WP_Query` strips it out as irrelevant. You could try replacing your query posts line with this: ``` global $query_string; parse_str( $query_string, $my_query_array ); $paged = ( isset( $my_query_array['paged'] ) ...
2,649
<p>I have a custom post type for musician's profiles, and a taxonomy for their location (categorised hierachically into Countries and then Cities). On the musician's individual profile pages I need to display a list of musicians in the same city (i.e. the child taxonomy). It'd also be good to display posts in the same ...
[ { "answer_id": 2650, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 2, "selected": false, "text": "<p>Check out <a href=\"http://codex.wordpress.org/Function_Reference/wp_get_object_terms\" rel=\"nofollow\"><code>wp_get...
2010/10/06
[ "https://wordpress.stackexchange.com/questions/2649", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/895/" ]
I have a custom post type for musician's profiles, and a taxonomy for their location (categorised hierachically into Countries and then Cities). On the musician's individual profile pages I need to display a list of musicians in the same city (i.e. the child taxonomy). It'd also be good to display posts in the same cou...
Hi **@George**: Depending on how many musicians you expect to have in your database you could either go the full API route *(which is generally preferred, whenever it is vialable)* if you are going to have a large number of them (thousands?) you could go with some custom SQL to pull exactly the records you need. ###...
2,662
<p>Google Webmaster Tools can see it, but I can't find it. Any idea on how it's generated or where it is the file structure? I don't see the file in my root. My website is at <a href="http://mikewills.me">http://mikewills.me</a> and the robots.txt file URL is <a href="http://mikewills.me/robots.txt">http://mikewills.me...
[ { "answer_id": 2664, "author": "user1167", "author_id": 1167, "author_profile": "https://wordpress.stackexchange.com/users/1167", "pm_score": 2, "selected": false, "text": "<p>robots.txt is dynamically created. There is no robots.txt file. Install a robot.txt plugin will solve your probl...
2010/10/06
[ "https://wordpress.stackexchange.com/questions/2662", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/104/" ]
Google Webmaster Tools can see it, but I can't find it. Any idea on how it's generated or where it is the file structure? I don't see the file in my root. My website is at <http://mikewills.me> and the robots.txt file URL is <http://mikewills.me/robots.txt>. In the end, Google isn't indexing my site and I am trying to...
It's dynamically generated by the function [`do_robots()`](http://core.trac.wordpress.org/browser/tags/3.0.1/wp-includes/functions.php#L1779), which has both an action (`do_robotstxt`) and a filter (`robots_txt`). If you create a `robots.txt` file in your WordPress root, it will (probably) be served up when `/robots.tx...
2,666
<p>Does anyone know how to add an admin menu separator? I found <a href="http://lab.yukei.net/wp-code/nav.html?wp-admin/menu.php.source.html" rel="noreferrer">this</a> but it did not help. </p> <p>Any ideas?</p>
[ { "answer_id": 2670, "author": "dgw", "author_id": 166, "author_profile": "https://wordpress.stackexchange.com/users/166", "pm_score": 0, "selected": false, "text": "<p>It's a little hard to determine what you're trying to do, but I think you're looking to add a top-level entry in the Wo...
2010/10/06
[ "https://wordpress.stackexchange.com/questions/2666", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1147/" ]
Does anyone know how to add an admin menu separator? I found [this](http://lab.yukei.net/wp-code/nav.html?wp-admin/menu.php.source.html) but it did not help. Any ideas?
Here's a quick and dirty way to get what you want. Background ---------- WordPress stores admin menu sections in a global array called `$menu`. To add a separator you add an element to the `$menu` array using an index that is between the indexes of the options that you want to separate. Using the `add_admin_menu_se...
2,679
<p>I'm trying to create a custom post type that I can associate with parent posts (they are posts not pages). Wordpress is version 3.0.1. I was hoping to see a list of posts in a parent post drop-down under Page-Attributes but all I get its an 'Order' field. Have I missed something vital?</p> <pre><code>register_post_...
[ { "answer_id": 2688, "author": "Jan Fabry", "author_id": 8, "author_profile": "https://wordpress.stackexchange.com/users/8", "pm_score": 4, "selected": true, "text": "<p>This works for me. <a href=\"http://core.trac.wordpress.org/browser/branches/3.0/wp-admin/includes/meta-boxes.php#L535...
2010/10/07
[ "https://wordpress.stackexchange.com/questions/2679", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/500/" ]
I'm trying to create a custom post type that I can associate with parent posts (they are posts not pages). Wordpress is version 3.0.1. I was hoping to see a list of posts in a parent post drop-down under Page-Attributes but all I get its an 'Order' field. Have I missed something vital? ``` register_post_type( 'mytest_...
This works for me. [Looking at the code](http://core.trac.wordpress.org/browser/branches/3.0/wp-admin/includes/meta-boxes.php#L535), the dropdown only appears if the post type is hierarchical (which is true in your case), and if there are other posts **of the same type** in the database. So a post can not be a child of...
2,680
<p>Currently, I use CSS specificity to override plugin styles. I prefer this for editing the plugin as it makes less headaches when you update.</p> <p>It would be nice if my style sheet loaded after the plugins, so that I only have to be as specific, not more. This would make my stylesheets much prettier.</p>
[ { "answer_id": 2681, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 4, "selected": false, "text": "<p>There are several ways plugins can handle CSS.</p>\n\n<ul>\n<li>best case: plugin queues CSS and provides option to d...
2010/10/07
[ "https://wordpress.stackexchange.com/questions/2680", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/784/" ]
Currently, I use CSS specificity to override plugin styles. I prefer this for editing the plugin as it makes less headaches when you update. It would be nice if my style sheet loaded after the plugins, so that I only have to be as specific, not more. This would make my stylesheets much prettier.
As you suggest, the most elegant approach is when your CSS overrides are loaded after the CSS injected by the plugins. This is quite easy to achieve - you just need to make sure that your `header.php` calls `wp_head()` before it references your style sheet: ``` <head> <!-- all the usual preamble stuff goes here --...
2,683
<p>There is plenty of information on how to make the Read More function display different text in the Codex but what kind of filter would need to be used to make it display <code>&lt;button class="readmorebtn" onclick(permalink)&gt;Read More&lt;/button&gt;</code>?</p>
[ { "answer_id": 2685, "author": "Jan Fabry", "author_id": 8, "author_profile": "https://wordpress.stackexchange.com/users/8", "pm_score": 3, "selected": true, "text": "<p>The \"(more...)\" link gets filtered through <a href=\"http://core.trac.wordpress.org/browser/branches/3.0/wp-includes...
2010/10/07
[ "https://wordpress.stackexchange.com/questions/2683", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1057/" ]
There is plenty of information on how to make the Read More function display different text in the Codex but what kind of filter would need to be used to make it display `<button class="readmorebtn" onclick(permalink)>Read More</button>`?
The "(more...)" link gets filtered through [`the_content_more_link` in `get_the_content()`](http://core.trac.wordpress.org/browser/branches/3.0/wp-includes/post-template.php#L222). You can hook into this function and let it return whatever you want. ``` add_filter('the_content_more_link', 'more_button'); function more...
2,686
<p>I want to have the authors listed like usual from <code>wp_list_authors()</code> but I know there are a couple of ones I would like to exclude from the list as well. Is there a way to do that?</p> <p>Thanks</p>
[ { "answer_id": 2687, "author": "Jan Fabry", "author_id": 8, "author_profile": "https://wordpress.stackexchange.com/users/8", "pm_score": 2, "selected": false, "text": "<p>It seems <a href=\"http://core.trac.wordpress.org/browser/branches/3.0/wp-includes/author-template.php#L269\" rel=\"n...
2010/10/07
[ "https://wordpress.stackexchange.com/questions/2686", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/151/" ]
I want to have the authors listed like usual from `wp_list_authors()` but I know there are a couple of ones I would like to exclude from the list as well. Is there a way to do that? Thanks
`wp_list_authors()` now does have an `exclude` parameter. So you can exclude the authors you want by their user ID. It accepts: > > An array, comma-, or space-separated list of author IDs to include. Default empty. > > > Examples: ``` // exclude just the author with the ID 4 wp_list_authors([ 'exclude' => 4 ])...
2,742
<p>I have started a new site (<a href="http://www.forex-bloggers.com/" rel="nofollow">here</a>), I want to add the theme a RSS icon/logo on the top right of the theme (like in <a href="http://www.r-bloggers.com/" rel="nofollow">this theme</a>).</p> <p>What is the best way for doing that? (PHP/CSS wise)</p>
[ { "answer_id": 2744, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<p>It depends. There is number of ways theme can be customized:</p>\n\n<ul>\n<li>it can include ready-made widget areas ...
2010/10/09
[ "https://wordpress.stackexchange.com/questions/2742", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/161/" ]
I have started a new site ([here](http://www.forex-bloggers.com/)), I want to add the theme a RSS icon/logo on the top right of the theme (like in [this theme](http://www.r-bloggers.com/)). What is the best way for doing that? (PHP/CSS wise)
You want some code to be added to the `#title` element. You can do this, [as Sorich said](https://wordpress.stackexchange.com/questions/2742/how-to-add-an-rss-logo-to-my-blogs-header/2745#2745), by copying the `header.php` file and just adding it there, but you could also try to add it in the footer and then using Java...
2,751
<p>I have a hosted Wordpress blog running on my own domain. I've recently considered trying to build a custom URL shortener (a la bit.ly) that I manage and control using a very short domain. I'm wondering how I can achieve this.</p> <p>For example:</p> <p>I want this: <a href="http://nerdgap.com/some-made-up-post-her...
[ { "answer_id": 2744, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<p>It depends. There is number of ways theme can be customized:</p>\n\n<ul>\n<li>it can include ready-made widget areas ...
2010/10/09
[ "https://wordpress.stackexchange.com/questions/2751", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/954/" ]
I have a hosted Wordpress blog running on my own domain. I've recently considered trying to build a custom URL shortener (a la bit.ly) that I manage and control using a very short domain. I'm wondering how I can achieve this. For example: I want this: <http://nerdgap.com/some-made-up-post-here/> To shorten to this: ...
You want some code to be added to the `#title` element. You can do this, [as Sorich said](https://wordpress.stackexchange.com/questions/2742/how-to-add-an-rss-logo-to-my-blogs-header/2745#2745), by copying the `header.php` file and just adding it there, but you could also try to add it in the footer and then using Java...
2,765
<p><em>(<strong>Moderators note:</strong> Title was originally "How can I add the "Page Attributes" and/or "Page Attributes > Template" selector to POSTS editor")</em></p> <p>WP currently only allows the assignment of a "template" to Pages (i.e. <code>post_type=='page'</code>.) I'd like to extend this functionality to...
[ { "answer_id": 2769, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 5, "selected": true, "text": "<p>Hate to be the bearer of bad news but <strong>WordPress hardcodes the Page Template functionality to the <em>\"pa...
2010/10/10
[ "https://wordpress.stackexchange.com/questions/2765", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
*(**Moderators note:** Title was originally "How can I add the "Page Attributes" and/or "Page Attributes > Template" selector to POSTS editor")* WP currently only allows the assignment of a "template" to Pages (i.e. `post_type=='page'`.) I'd like to extend this functionality to Posts as well (i.e. `post_type=='post'`....
Hate to be the bearer of bad news but **WordPress hardcodes the Page Template functionality to the *"page"* post type**, at least in v3.0 *(that might change in future versions but there's not a specific initiative I'm aware of to change it yet. So this is one of the very few times I'm struggling to figure out how to g...
2,770
<p>Although I am very thankful to the wordpress core team that they have finally integrated native menu management capabilities I get frustrated with some key elements which I would like to change.</p> <p>I need a way of showing pages which is hierarchical in the same way hierarchical categories are displayed instead ...
[ { "answer_id": 4318, "author": "Community", "author_id": -1, "author_profile": "https://wordpress.stackexchange.com/users/-1", "pm_score": 1, "selected": false, "text": "<p>This is something that should be put into a ticket on WordPress Trac for the UI group to go over. <a href=\"http://...
2010/10/11
[ "https://wordpress.stackexchange.com/questions/2770", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/479/" ]
Although I am very thankful to the wordpress core team that they have finally integrated native menu management capabilities I get frustrated with some key elements which I would like to change. I need a way of showing pages which is hierarchical in the same way hierarchical categories are displayed instead of being i...
I succeeded in this, but it is a mess. Basically, the walker should have the following parameters: ``` $this->db_fields['parent'] = 'post_parent'; $this->db_fields['id'] = 'ID'; ``` But, to get that in place, you need to rip out the existing metabox callback, copy it, change one line so you get an extra filter, and ...
2,802
<p>I have a menu defined in WP Admin that looks like this:</p> <p><img src="https://i.stack.imgur.com/XnmMh.png" alt="alt text"></p> <p>I want to be able to display all the child links on the sidebar whenever I am at a parent page. For example, if the user is on my "About Us" page, I want a list of the 4 links highli...
[ { "answer_id": 2808, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 4, "selected": false, "text": "<p>Hi <strong>@jessegavin</strong>:</p>\n\n<p>Nav Menus are stored in a combination of custom post types and custom...
2010/10/11
[ "https://wordpress.stackexchange.com/questions/2802", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/193/" ]
I have a menu defined in WP Admin that looks like this: ![alt text](https://i.stack.imgur.com/XnmMh.png) I want to be able to display all the child links on the sidebar whenever I am at a parent page. For example, if the user is on my "About Us" page, I want a list of the 4 links highlighted in green to appear on the...
This was still on my mind so I revisited it and put together this solution, that does not rely on context that much: ``` add_filter( 'wp_nav_menu_objects', 'submenu_limit', 10, 2 ); function submenu_limit( $items, $args ) { if ( empty( $args->submenu ) ) { return $items; } $ids = wp_filter...
2,813
<p>I have a form ( method post ) which makes it possible to filter my posts by specific criterias e.g. "Most Recent", "This week", "Last week", ...</p> <p>It works fine but of course the URL is the same for each request. I dont want to change the send method to GET and change the URL with that trick. I'm looking for ...
[ { "answer_id": 2815, "author": "John P Bloch", "author_id": 11, "author_profile": "https://wordpress.stackexchange.com/users/11", "pm_score": 1, "selected": false, "text": "<p>I imagine that wouldn't be too difficult. Assuming the number of custom 'dynamic' urls is known, this should do ...
2010/10/12
[ "https://wordpress.stackexchange.com/questions/2813", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1217/" ]
I have a form ( method post ) which makes it possible to filter my posts by specific criterias e.g. "Most Recent", "This week", "Last week", ... It works fine but of course the URL is the same for each request. I dont want to change the send method to GET and change the URL with that trick. I'm looking for a solution ...
I imagine that wouldn't be too difficult. Assuming the number of custom 'dynamic' urls is known, this should do the trick: ``` foreach ( array( 'most-recent','last-week','category-1/most-recent','category-1/last-week') as $page ) add_rewrite_rule( "$page/?$", 'index.php', 'top' ); ``` What this does is tells WordP...
2,816
<p>So I wanted to play with some Linux-only PHP performance tools and installed Ubuntu Server 10.10 in VirtualBox (for the record I have little clue about Linux, never used it extensively).</p> <p>Turned out Ubuntu (Debian) has <a href="http://packages.ubuntu.com/maverick/wordpress" rel="nofollow">WordPress package</a...
[ { "answer_id": 2818, "author": "nobody", "author_id": 25, "author_profile": "https://wordpress.stackexchange.com/users/25", "pm_score": 2, "selected": false, "text": "<p>By the looks of it loads the config file from the <code>/etc/wordpress</code> directory instead of from <code>/usr/sha...
2010/10/12
[ "https://wordpress.stackexchange.com/questions/2816", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/847/" ]
So I wanted to play with some Linux-only PHP performance tools and installed Ubuntu Server 10.10 in VirtualBox (for the record I have little clue about Linux, never used it extensively). Turned out Ubuntu (Debian) has [WordPress package](http://packages.ubuntu.com/maverick/wordpress) that does some things differently ...
The code you posted is to have multiple wp-config.php-style wordpress configuration files with one codebase. the configuration is then based on the domain name. imagine the localserver is listening on `http://localhost.localdomain/` (no idea which one is the default with ubuntu), then the configuration file would be: ...
2,823
<p>How can I change the Maximum upload file size? I would like to be able to upload 10Mb at a time.</p> <p><img src="https://i.stack.imgur.com/9PZ7Q.png" alt="alt text"></p>
[ { "answer_id": 2824, "author": "Dillie-O", "author_id": 1165, "author_profile": "https://wordpress.stackexchange.com/users/1165", "pm_score": 5, "selected": true, "text": "<p>This is due to the PHP limitations on file size uploads. If you have access to your php.ini file, you can modify ...
2010/10/12
[ "https://wordpress.stackexchange.com/questions/2823", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/193/" ]
How can I change the Maximum upload file size? I would like to be able to upload 10Mb at a time. ![alt text](https://i.stack.imgur.com/9PZ7Q.png)
This is due to the PHP limitations on file size uploads. If you have access to your php.ini file, you can modify the following lines: ``` upload_max_filesize = 10M post_max_size = 10M max_execution_time = 300 ``` If you don't have access to the php.ini file (such as a hosting situation), you may need to contact your...
2,830
<p>I was wondering if anyone could give me some suggestions on how best I could streamline the following;</p> <p>I have a WordPress blog (privately hosted) which I update daily (well, I normally schedule a load of updates at once) with pictures which I upload, tag and write a very brief comment on.</p> <p>I was origi...
[ { "answer_id": 2834, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 2, "selected": false, "text": "<p>I would actually recommend using the built-in post by email functionality instead. You set up a private email address...
2010/10/12
[ "https://wordpress.stackexchange.com/questions/2830", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1213/" ]
I was wondering if anyone could give me some suggestions on how best I could streamline the following; I have a WordPress blog (privately hosted) which I update daily (well, I normally schedule a load of updates at once) with pictures which I upload, tag and write a very brief comment on. I was originally considering...
There are **lots of ways to accomplish a daily picture blog** so I'll just give you how I'd approach it. If I wanted to set up a photoblog on WordPress I'd start with a [**Flickr**](http://www.flickr.com) account and leverage it *(or if you don't like Flickr for some reason you can also look at [PhotoBucket](http://p...
2,838
<p>I have strange situation which just started which I seem to be unable to resolved. I am not sure what this might be related to but I think I remember reading somewhere that this has happened to someone else.</p> <p>Upon logging into WordPress then going into the menu management area, then clicking on "screen option...
[ { "answer_id": 2871, "author": "NetConstructor.com", "author_id": 479, "author_profile": "https://wordpress.stackexchange.com/users/479", "pm_score": 3, "selected": true, "text": "<p>I just figured out my own issue which I am hoping might help others if they get stuck in this situation.<...
2010/10/13
[ "https://wordpress.stackexchange.com/questions/2838", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/479/" ]
I have strange situation which just started which I seem to be unable to resolved. I am not sure what this might be related to but I think I remember reading somewhere that this has happened to someone else. Upon logging into WordPress then going into the menu management area, then clicking on "screen options" and ena...
I just figured out my own issue which I am hoping might help others if they get stuck in this situation. Essentially the problem seemed to be that modsecurity caused the 500 Internal Server error because for some reason (which I have yet to understand) the menu page was sending a bunch of data in the response body. T...
2,839
<p>I have moved into WordPress for a few days and was quite impressed by all the available features, plugins and polished themes. I have spent quite some times reading documentation about themes and custom types. So far so good... Now that I'm trying to do real things, it seems (but I maybe missing something) that WP h...
[ { "answer_id": 2842, "author": "bobdiaes", "author_id": 1222, "author_profile": "https://wordpress.stackexchange.com/users/1222", "pm_score": 0, "selected": false, "text": "<p>I think you need to hook on the get_permalink() function. This article I've saved in my custom post type notes m...
2010/10/13
[ "https://wordpress.stackexchange.com/questions/2839", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1228/" ]
I have moved into WordPress for a few days and was quite impressed by all the available features, plugins and polished themes. I have spent quite some times reading documentation about themes and custom types. So far so good... Now that I'm trying to do real things, it seems (but I maybe missing something) that WP has ...
When planning more complex Wordpress sites, I try to think of the page/url hierarchy in terms of the default [WordPress Database Schema](http://codex.wordpress.org/Database_Description). Then determine the best [URL rewrite](http://codex.wordpress.org/Function_Reference/WP_Rewrite) scheme and data structure. Very gener...
2,847
<p>Can somebody please assist as to why I am getting the following special character � in my WordPress content pages.</p> <p>Not sure how it got in there.</p> <p>You can see this special character at this url:</p> <p><a href="http://www.ppsservice.com.au/pool-and-spa-maintenance" rel="nofollow">PPS Victoria</a></p> ...
[ { "answer_id": 2848, "author": "John P Bloch", "author_id": 11, "author_profile": "https://wordpress.stackexchange.com/users/11", "pm_score": 2, "selected": false, "text": "<p>My guess is that you pasted something from a Windows environment and that's the <code>CR</code> (carriage return...
2010/10/13
[ "https://wordpress.stackexchange.com/questions/2847", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1053/" ]
Can somebody please assist as to why I am getting the following special character � in my WordPress content pages. Not sure how it got in there. You can see this special character at this url: [PPS Victoria](http://www.ppsservice.com.au/pool-and-spa-maintenance) and then just scroll down to "Restoration and Recover...
My guess is that you pasted something from a Windows environment and that's the `CR` (carriage return, I think) character. I'd go into the editor and just remove those line breaks. That should fix the problem. Also, you might look into standardizing the content type meta tag. You've got ``` <meta charset="UTF-8" /> `...
2,850
<p>I get 404 status when fetching images, and the http still contains that image. Image shows up in a browser, but the 404 code breaks some applications.</p> <p>calls to wp-content/uploads/ are redirected in .htaccess:</p> <pre><code>&lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase / RewriteRule ^index\.ph...
[ { "answer_id": 2917, "author": "naugtur", "author_id": 255, "author_profile": "https://wordpress.stackexchange.com/users/255", "pm_score": 4, "selected": true, "text": "<p>Problem solved. </p>\n\n<p>The plugin \"User Access Manager\" was found guilty of inserting a .htaccess file into <c...
2010/10/13
[ "https://wordpress.stackexchange.com/questions/2850", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/255/" ]
I get 404 status when fetching images, and the http still contains that image. Image shows up in a browser, but the 404 code breaks some applications. calls to wp-content/uploads/ are redirected in .htaccess: ``` <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteRule (.*) /...
Problem solved. The plugin "User Access Manager" was found guilty of inserting a .htaccess file into `wp-content/uploads/` and not handling calls properly afterwards. I don't know how UAM plugin could be fixed, but It's ok to remove the .htaccess file. Nothing else depends on it. (at least in my case)
2,866
<p>I am in the process of cleaning up a site after migrating it from a single install of WP to a multi-site install of WP. I have noticed many, many duplicate custom fields for each post. I assume this is from older versions of plugins that didn't check for the field before adding another. In the migration I am droppin...
[ { "answer_id": 2867, "author": "John P Bloch", "author_id": 11, "author_profile": "https://wordpress.stackexchange.com/users/11", "pm_score": 4, "selected": true, "text": "<p>If you're not going to use those plugins, have at it. No reason to keep them around. Direct SQL query should be f...
2010/10/13
[ "https://wordpress.stackexchange.com/questions/2866", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/104/" ]
I am in the process of cleaning up a site after migrating it from a single install of WP to a multi-site install of WP. I have noticed many, many duplicate custom fields for each post. I assume this is from older versions of plugins that didn't check for the field before adding another. In the migration I am dropping t...
If you're not going to use those plugins, have at it. No reason to keep them around. Direct SQL query should be fine. Related: `add_post_meta()` has a nifty argument to prevent this very problem. The fourth argument is a boolean, declaring whether the meta should be singular: ``` add_post_meta( $post->ID, 'my_foo_bar...
2,880
<p>Interesting situation i just ran into.</p> <p>I have a site I am developing in which I have defined specific image sizes I want created whenever a new image is uploaded. Currently lets just say that I defined a specific thumbnail size of 75x75 and a medium sized image of 150x150 pixels.</p> <p>Assuming we proceed ...
[ { "answer_id": 2907, "author": "hakre", "author_id": 178, "author_profile": "https://wordpress.stackexchange.com/users/178", "pm_score": 4, "selected": true, "text": "<p>No, wordpress can not resize BMP files. Beware that it does not make sense to use BMP files in a website because a bro...
2010/10/13
[ "https://wordpress.stackexchange.com/questions/2880", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/479/" ]
Interesting situation i just ran into. I have a site I am developing in which I have defined specific image sizes I want created whenever a new image is uploaded. Currently lets just say that I defined a specific thumbnail size of 75x75 and a medium sized image of 150x150 pixels. Assuming we proceed to upload a new i...
No, wordpress can not resize BMP files. Beware that it does not make sense to use BMP files in a website because a broad number of webbrowsers is not able to display them. Filetypes that are supported by Wordpress and which are widely supported by internet browsers are: GIF, JPG and PNG. Those formats are optimized f...
2,885
<p>(<strong>Moderators note:</strong> Was originally titled: <em>"Custom post type problem?"</em>)</p> <p>I'm having some problems with custom post types where everything is working great except for the sidebars.</p> <p>Here is some code from my <code>sidebar.php</code>:</p> <pre><code>&lt;?php if (is_home()) { ...
[ { "answer_id": 2886, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 4, "selected": true, "text": "<p>If I understand your question correctly then use are asking why <code>is_home()</code> is <code>false</code> when...
2010/10/14
[ "https://wordpress.stackexchange.com/questions/2885", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1147/" ]
(**Moderators note:** Was originally titled: *"Custom post type problem?"*) I'm having some problems with custom post types where everything is working great except for the sidebars. Here is some code from my `sidebar.php`: ``` <?php if (is_home()) { dynamic_sidebar('frontpage-sidebar'); } if (is_single())...
If I understand your question correctly then use are asking why `is_home()` is `false` when you are viewing the URL `/tools/example-tool/`? If I understand your question the answer is simply that is\_home() is not `true` for Custom Post Types. Actually `is_home()` should never be `true` except for 1.) when on the home...
2,895
<p>I know that jQuery is loaded, because I can switch out the <code>$</code> for 'jQuery' and everything behaves as expected, but this will be a messy script if I can't fix this</p> <p>This script:</p> <pre class="lang-js prettyprint-override"><code>jQuery(document).ready(function(){ $("ul.vimeo_desc_feed li a")....
[ { "answer_id": 2896, "author": "nobody", "author_id": 25, "author_profile": "https://wordpress.stackexchange.com/users/25", "pm_score": 7, "selected": true, "text": "<p>You can wrap your javascript inside a self-invoking function, then pass <code>jQuery</code> as an argument to it, using...
2010/10/14
[ "https://wordpress.stackexchange.com/questions/2895", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/784/" ]
I know that jQuery is loaded, because I can switch out the `$` for 'jQuery' and everything behaves as expected, but this will be a messy script if I can't fix this This script: ```js jQuery(document).ready(function(){ $("ul.vimeo_desc_feed li a").click(function(){ alert($(this).attr('href')); retu...
You can wrap your javascript inside a self-invoking function, then pass `jQuery` as an argument to it, using `$` as the local variable name. For example: ``` (function($) { $(document).ready(function(){ $("ul.vimeo_desc_feed li a").click(function(){ alert($(this).attr('href')); return false; }) ...
2,913
<p>I don't know why the proper classes for menu item are not generated - all the elements in the tree which has subtree get only <code>menu-item menu-item-type-post_type</code>. The elements, which don't have children, get proper classes after being clicked (active).</p> <p>Link: <a href="http://lichens.ie/" rel="nofo...
[ { "answer_id": 2915, "author": "goldenapples", "author_id": 290, "author_profile": "https://wordpress.stackexchange.com/users/290", "pm_score": 1, "selected": false, "text": "<p>I don't know why its not working in your case... Like you say, the active page should be getting 'current_menu...
2010/10/14
[ "https://wordpress.stackexchange.com/questions/2913", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1244/" ]
I don't know why the proper classes for menu item are not generated - all the elements in the tree which has subtree get only `menu-item menu-item-type-post_type`. The elements, which don't have children, get proper classes after being clicked (active). Link: <http://lichens.ie/> Part of the menu structure: [http://i...
This is part of code in `_wp_menu_item_classes_by_context()` that handles current class for pages: ``` // if the menu item corresponds to the currently-queried post or taxonomy object } elseif ( $menu_item->object_id == $queried_object_id && ( ( ! empty( $home_page_id ) && 'post_type' == $menu_item->ty...
2,929
<p>I'm developing a WP site that lists expensive properties (villas, penthouses, etc) for rent. My client has an agreement with certain schools to list some cheap properties exclusively for their students, and he has previously (in his hard-coded-by-hand html site) had a set username+password that he gives to the schoo...
[ { "answer_id": 2931, "author": "somatic", "author_id": 838, "author_profile": "https://wordpress.stackexchange.com/users/838", "pm_score": 2, "selected": true, "text": "<p>This solution is purely cosmetic, in that it simply hides via jQuery the fields on the user profile page, but that e...
2010/10/15
[ "https://wordpress.stackexchange.com/questions/2929", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1118/" ]
I'm developing a WP site that lists expensive properties (villas, penthouses, etc) for rent. My client has an agreement with certain schools to list some cheap properties exclusively for their students, and he has previously (in his hard-coded-by-hand html site) had a set username+password that he gives to the schools,...
This solution is purely cosmetic, in that it simply hides via jQuery the fields on the user profile page, but that effectively removes the ability for the user to change the password (admin will still see the fields, and can change any time). Add this to your theme's functions.php file, and you're done. ``` add_action...
2,940
<p>Ubuntu Server, LAMP stack, freshly self-installed WordPress.</p> <p>Apparently I can't use <code>direct</code> filesystem access method because files are owned by different owners (WP core unpacked by me and files WP creates by <code>www-data</code>).</p> <p>I tried my credentials for <code>ftp</code> method, but ...
[ { "answer_id": 2959, "author": "Denis de Bernardy", "author_id": 1208, "author_profile": "https://wordpress.stackexchange.com/users/1208", "pm_score": 3, "selected": true, "text": "<p>Ideally, you install php-suexec, so that the php script runs as the file's owner. This allows the direct...
2010/10/16
[ "https://wordpress.stackexchange.com/questions/2940", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/847/" ]
Ubuntu Server, LAMP stack, freshly self-installed WordPress. Apparently I can't use `direct` filesystem access method because files are owned by different owners (WP core unpacked by me and files WP creates by `www-data`). I tried my credentials for `ftp` method, but either something goes wrong or there is simply no ...
Ideally, you install php-suexec, so that the php script runs as the file's owner. This allows the direct method to be used without requiring any permission changes.
2,961
<p><em>(<strong>Moderator's note:</strong> Was originally titled "Wordpress for a static corporate website?")</em></p> <p>I am looking for a WordPress solution that will give me:</p> <ul> <li>a static website, with menu and a few pages,</li> <li>does not look like a blog, looks like a corporate website</li> <li>a ver...
[ { "answer_id": 2964, "author": "Andrew", "author_id": 375, "author_profile": "https://wordpress.stackexchange.com/users/375", "pm_score": 1, "selected": false, "text": "<p>My recommendation.</p>\n\n<p>Build a template for the site in HTML/CSS, then convert that to a theme.</p>\n\n<p>You...
2010/10/17
[ "https://wordpress.stackexchange.com/questions/2961", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1224/" ]
*(**Moderator's note:** Was originally titled "Wordpress for a static corporate website?")* I am looking for a WordPress solution that will give me: * a static website, with menu and a few pages, * does not look like a blog, looks like a corporate website * a very basic look and feel: white background, almost only te...
The rachatdecredit theme is almost certainly a custom theme, you can tell from the URL for the stylesheet. Most of the time if a theme is in a directory with the same name as the site it is custom, or at least a child theme: ``` http://www.rachatdecredit.net/wp-content/themes/rachatdecredit/style.css ``` Since you w...
2,988
<p>It seems to me both of these afford the opportunity for the end user to modify a theme without actually editing the themes files (via child themes).</p> <p>My question is, is one method preferred over the other.</p> <p>For example take a theme I am workig on now. I am trying to decide whether to go with template p...
[ { "answer_id": 2989, "author": "Mild Fuzz", "author_id": 784, "author_profile": "https://wordpress.stackexchange.com/users/784", "pm_score": 3, "selected": false, "text": "<p>I would say that the main difference is readability. If you see several, well named, template parts, you can gras...
2010/10/18
[ "https://wordpress.stackexchange.com/questions/2988", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/120/" ]
It seems to me both of these afford the opportunity for the end user to modify a theme without actually editing the themes files (via child themes). My question is, is one method preferred over the other. For example take a theme I am workig on now. I am trying to decide whether to go with template parts of hooks. `...
I would say that the main difference is readability. If you see several, well named, template parts, you can grasp what is happening easily. If you just see a hook, you will need to search through the rest of the theme to establish what is attached to the hook.
2,993
<p>I am trying to use the <code>orderby</code> parameter in the <code>get_children</code> function as below:</p> <pre><code>$navigation = get_children(array( 'post_parent' =&gt; $parent-&gt;ID, 'orderby' =&gt; 'menu_order' )); </code></pre> <p>But it is having no effect on the result; it is still ordering by the ...
[ { "answer_id": 2996, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 5, "selected": true, "text": "<p>Are you sure you need this specific function? Documentation (both Codex and inline) is verrry confusing. And it suppos...
2010/10/18
[ "https://wordpress.stackexchange.com/questions/2993", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1299/" ]
I am trying to use the `orderby` parameter in the `get_children` function as below: ``` $navigation = get_children(array( 'post_parent' => $parent->ID, 'orderby' => 'menu_order' )); ``` But it is having no effect on the result; it is still ordering by the default creation date. Any ideas?
Are you sure you need this specific function? Documentation (both Codex and inline) is verrry confusing. And it supposedly fetches things like attachments, which probably aren't relevant for navigation... Try this: ``` get_posts( array( 'post_type' => 'page', 'post_parent' => $parent->ID, 'orderby' => 'me...
2,998
<p>I have created dynamic sidebars. They are working fine and appear in the Widgets area.</p> <p>However, I would like to customize the name that appears on each sidebar. </p> <p>So, right now each sidebar is named "Sidebar 1", "Sidebar 2", etc.</p> <p>Instead, I would like them to say something like "About Sidebar"...
[ { "answer_id": 2999, "author": "sorich87", "author_id": 473, "author_profile": "https://wordpress.stackexchange.com/users/473", "pm_score": 4, "selected": true, "text": "<p>Use the 'Name' parameter in your register_sidebar call. E.g., see the following code in the default Twenty Ten them...
2010/10/18
[ "https://wordpress.stackexchange.com/questions/2998", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1097/" ]
I have created dynamic sidebars. They are working fine and appear in the Widgets area. However, I would like to customize the name that appears on each sidebar. So, right now each sidebar is named "Sidebar 1", "Sidebar 2", etc. Instead, I would like them to say something like "About Sidebar", "Toolkit Sidebar". T...
Use the 'Name' parameter in your register\_sidebar call. E.g., see the following code in the default Twenty Ten theme, line 351. ``` function twentyten_widgets_init() { // Area 1, located at the top of the sidebar. register_sidebar( array( 'name' => __( 'Primary Widget Area', 'twentyten' ), 'id...
3,001
<p>Please at first let me explain my question. I use wordpress to create web sites for flash games, so I don't have certain page for post's. I add each game by <code>post-new.php?post_type=game</code> and u can see it's not the regular post for wordpress. I try to use this code from codex:</p> <pre><code>&lt;?php if (...
[ { "answer_id": 3004, "author": "sorich87", "author_id": 473, "author_profile": "https://wordpress.stackexchange.com/users/473", "pm_score": 2, "selected": true, "text": "<p>Add the 'post_type' parameter in your query args (<code>'post_type' =&gt; 'game'</code>):</p>\n\n<pre><code>&lt;?ph...
2010/10/18
[ "https://wordpress.stackexchange.com/questions/3001", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1301/" ]
Please at first let me explain my question. I use wordpress to create web sites for flash games, so I don't have certain page for post's. I add each game by `post-new.php?post_type=game` and u can see it's not the regular post for wordpress. I try to use this code from codex: ``` <?php if (is_page() ) { $category = ge...
Add the 'post\_type' parameter in your query args (`'post_type' => 'game'`): ``` <?php if (is_page() ) { $category = get_post_meta($posts[0]->ID, 'category', true); } if ($category) { $cat = get_cat_ID($category); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $post_per_page = 4; // -1 shows all...
3,002
<p>I have multiple "sidebars", but not all of them are the same size. Not all widgets fit in all sidebars (for example, I have a "footer sidebar" where the client can place custom widgets, but they are wide, and don't fit at all in the "real" sidebar). I want to give an indication when a widget is placed in a sidebar w...
[ { "answer_id": 3007, "author": "Denis de Bernardy", "author_id": 1208, "author_profile": "https://wordpress.stackexchange.com/users/1208", "pm_score": 2, "selected": false, "text": "<p>There is a widget_display_callback hook, which you can use to override the widget based on the sidebar ...
2010/10/18
[ "https://wordpress.stackexchange.com/questions/3002", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8/" ]
I have multiple "sidebars", but not all of them are the same size. Not all widgets fit in all sidebars (for example, I have a "footer sidebar" where the client can place custom widgets, but they are wide, and don't fit at all in the "real" sidebar). I want to give an indication when a widget is placed in a sidebar wher...
I solved it using some CSS, similar to my trick to [highlight my own widgets](https://wordpress.stackexchange.com/questions/3003/highlight-custom-widgets-in-the-admin-area). The sidebar drop areas are `div`'s with the class `widgets-sortable` and they have the `id` of your sidebar. Your widgets are `div`'s with class `...
3,014
<p><em>(<strong>Moderators note:</strong> Was originally titled "wp_nav_menu Ancestor class without children in navigation structure")</em></p> <p>I have a <code>wp_nav_menu</code> in my header which had three pages in it. When I am on one of those pages, the <code>li</code> containing that page in the menu gets the c...
[ { "answer_id": 3034, "author": "somatic", "author_id": 838, "author_profile": "https://wordpress.stackexchange.com/users/838", "pm_score": 6, "selected": true, "text": "<p>There's a simpler solution. Forget creating pages for each post type just so you can have nav items, because as you ...
2010/10/18
[ "https://wordpress.stackexchange.com/questions/3014", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1099/" ]
*(**Moderators note:** Was originally titled "wp\_nav\_menu Ancestor class without children in navigation structure")* I have a `wp_nav_menu` in my header which had three pages in it. When I am on one of those pages, the `li` containing that page in the menu gets the class `.current_page_item`. These three pages have ...
There's a simpler solution. Forget creating pages for each post type just so you can have nav items, because as you have learned, WP has no way of recognizing that the custom types you are browsing are related to that page. Instead, create a custom link in Appearance->Menus. Just put the URL that will return your cust...
3,015
<p>Is it a problem to have a custom taxonomy and a custom post type use the same rewrite structure?</p> <p>I have a custom taxonomy <code>people</code> and a custom post type <code>people_bio</code>. The idea is that you get a list of posts about a person with a short biography on top of the page. I combine them in my...
[ { "answer_id": 3034, "author": "somatic", "author_id": 838, "author_profile": "https://wordpress.stackexchange.com/users/838", "pm_score": 6, "selected": true, "text": "<p>There's a simpler solution. Forget creating pages for each post type just so you can have nav items, because as you ...
2010/10/18
[ "https://wordpress.stackexchange.com/questions/3015", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/8/" ]
Is it a problem to have a custom taxonomy and a custom post type use the same rewrite structure? I have a custom taxonomy `people` and a custom post type `people_bio`. The idea is that you get a list of posts about a person with a short biography on top of the page. I combine them in my `taxonomy-people.php` template ...
There's a simpler solution. Forget creating pages for each post type just so you can have nav items, because as you have learned, WP has no way of recognizing that the custom types you are browsing are related to that page. Instead, create a custom link in Appearance->Menus. Just put the URL that will return your cust...
3,020
<p>I want to use the latest jQuery (and jQuery UI) versions on my admin interface (editing a specific post type that I created).</p> <p>I tried this:</p> <pre><code>// jQuery 1.x wp_register_script('jquery1x', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js', false, null, true); // jQuery UI 1.8.4 PTBR ...
[ { "answer_id": 3022, "author": "Evan", "author_id": 1308, "author_profile": "https://wordpress.stackexchange.com/users/1308", "pm_score": 1, "selected": false, "text": "<p>If you have it working for your custom post type pages and thats all you want, you could just put in a conditional t...
2010/10/18
[ "https://wordpress.stackexchange.com/questions/3020", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1306/" ]
I want to use the latest jQuery (and jQuery UI) versions on my admin interface (editing a specific post type that I created). I tried this: ``` // jQuery 1.x wp_register_script('jquery1x', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js', false, null, true); // jQuery UI 1.8.4 PTBR wp_register_script('j...
Starting with version 3.6 WordPress *actively* discourages from deregistering "critical" scripts in admin at all. For posed scope (loading newer jQuery in specific part of admin) it would make more sense to load custom copy of jQuery normally and use `noConflict()` on it right away to isolate it in own variable to be ...
3,029
<p>Given a Vimeo ID, I can retrieve a thumbnail from the video via Vimeo Simple API. Rather than call the API every time my page loads I want to set the image as the post thumbnail using the <code>save_post</code> hook (similar to <a href="https://wordpress.stackexchange.com/questions/784/automatically-import-image-int...
[ { "answer_id": 3033, "author": "MikeSchinkel", "author_id": 89, "author_profile": "https://wordpress.stackexchange.com/users/89", "pm_score": 2, "selected": false, "text": "<p>Hi <strong>@David John Smith</strong>:</p>\n\n<p>1.) If you are in WordPress, (almost) always use <code>WP_Http<...
2010/10/19
[ "https://wordpress.stackexchange.com/questions/3029", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1309/" ]
Given a Vimeo ID, I can retrieve a thumbnail from the video via Vimeo Simple API. Rather than call the API every time my page loads I want to set the image as the post thumbnail using the `save_post` hook (similar to [this question](https://wordpress.stackexchange.com/questions/784/automatically-import-image-into-posts...
My favorite way of handling this problem has been to use a little documented function I discovered on another stack post: [`media_sideload_image`](https://wordpress.stackexchange.com/questions/19637/media-sideload-image-generates-blank) It works by fetching an image url to the WordPress upload dir and then associating...
3,032
<p>I am so happy that I found this site =)</p> <p>Well, here is my problem:</p> <p>I want to display the wp comments right after the post, but before the plugins content.</p> <p>What I have tried so far:</p> <p>in single-products.php file, the original code is:</p> <pre><code>&lt;?php the_content(); ?&gt; &lt;?php...
[ { "answer_id": 3036, "author": "Rarst", "author_id": 847, "author_profile": "https://wordpress.stackexchange.com/users/847", "pm_score": 0, "selected": false, "text": "<p>As I understand <em>plugins</em> you refer to add their output to the output of <code>the_content()</code> function. ...
2010/10/19
[ "https://wordpress.stackexchange.com/questions/3032", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
I am so happy that I found this site =) Well, here is my problem: I want to display the wp comments right after the post, but before the plugins content. What I have tried so far: in single-products.php file, the original code is: ``` <?php the_content(); ?> <?php wp_link_pages(array('before' => '<p><strong>'.__('...
For [Five Star Rating](http://wordpress.org/extend/plugins/five-star-rating/), [the FAQ tells me](http://wordpress.org/extend/plugins/five-star-rating/faq/) you can leave out the shortcode from your articles (you added these to each article?), and then use `echo five_star_rating_func('star')` somewhere in your template...
3,038
<p>this question has been answered on stackoverflow. here is a link <a href="https://stackoverflow.com/questions/4321914/wp-insert-post-with-a-form/4321975#4321975">https://stackoverflow.com/questions/4321914/wp-insert-post-with-a-form/4321975#4321975</a></p> <p>i'm trying to let users post to my site by using the <co...
[ { "answer_id": 3052, "author": "Denis de Bernardy", "author_id": 1208, "author_profile": "https://wordpress.stackexchange.com/users/1208", "pm_score": 2, "selected": false, "text": "<p>wp_insert_post() makes use of the current user at several points, if memory serves.</p>\n\n<p>So, you'd...
2010/10/19
[ "https://wordpress.stackexchange.com/questions/3038", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1043/" ]
this question has been answered on stackoverflow. here is a link <https://stackoverflow.com/questions/4321914/wp-insert-post-with-a-form/4321975#4321975> i'm trying to let users post to my site by using the `wp_insert_post()` function.. ``` <?php $postTitle = $_POST['post_title']; $post = $_POST['post']; $sub...
wp\_insert\_post() makes use of the current user at several points, if memory serves. So, you'd want to use wp\_set\_current\_user() to switch that to some shared author user, and then switch it back to its original value when you're done. Alternatively, require users to be logged in and allow all groups to create dr...
3,041
<p>I have a blog that I often need to insert iframes into posts for various reasons (don't ask why just trust me!)</p> <p>When I use the "visual" view to edit my posts the WYSIWYG constatantly strips out my iframes ...</p> <p>I know I can keep the iframes in the post if I use the "html" view and only view/save from t...
[ { "answer_id": 3067, "author": "bueltge", "author_id": 170, "author_profile": "https://wordpress.stackexchange.com/users/170", "pm_score": 5, "selected": false, "text": "<p>You can customize the filter of TinyMCE, see the following example for <code>&lt;iframe&gt;</code>s and other tags ...
2010/10/19
[ "https://wordpress.stackexchange.com/questions/3041", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1312/" ]
I have a blog that I often need to insert iframes into posts for various reasons (don't ask why just trust me!) When I use the "visual" view to edit my posts the WYSIWYG constatantly strips out my iframes ... I know I can keep the iframes in the post if I use the "html" view and only view/save from the "html" view .....
If you don't want to write your own code there is a plugin to allow embedding an `<iframe>`: * [**Embed IFrame Plugin for WordPress**](http://wordpress.org/extend/plugins/embed-iframe/other_notes/) Then just use the [shortcode](http://www.smashingmagazine.com/2009/02/02/mastering-wordpress-shortcodes/) like this: ``...
3,061
<p>I'd like to be able to add a template for a page that will present pages with similar data in the same style. For example, I want to be able to create a "Person Profile" template so that all personal profile pages have the same look and feel.</p> <p>Currently, the way I might do that is copy and paste a set of <co...
[ { "answer_id": 3062, "author": "Jan Fabry", "author_id": 8, "author_profile": "https://wordpress.stackexchange.com/users/8", "pm_score": 3, "selected": false, "text": "<p>If it is a strict structure, you might be better off creating a custom post type. You would then store the name in th...
2010/10/19
[ "https://wordpress.stackexchange.com/questions/3061", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/927/" ]
I'd like to be able to add a template for a page that will present pages with similar data in the same style. For example, I want to be able to create a "Person Profile" template so that all personal profile pages have the same look and feel. Currently, the way I might do that is copy and paste a set of `<div>` tags i...
If it is a strict structure, you might be better off creating a custom post type. You would then store the name in the title field, the image as the featured image, and the "About" would be the main content. If you need extra information, you can use custom fields (with [a plugin to style them](http://wordpress.org/ext...
3,068
<p>Is it at all possible to detect the list of plugins used on a WP site. </p> <p>Also, beyond my initial hunch, how can confirm for fact that a blog is indeed powered by WP?</p>
[ { "answer_id": 3070, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 3, "selected": false, "text": "<p>Usually, you can detect WordPress itself by looking at the site's source code for the WordPress generator meta tag:</p...
2010/10/19
[ "https://wordpress.stackexchange.com/questions/3068", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/-1/" ]
Is it at all possible to detect the list of plugins used on a WP site. Also, beyond my initial hunch, how can confirm for fact that a blog is indeed powered by WP?
Usually, you can detect WordPress itself by looking at the site's source code for the WordPress generator meta tag: ``` <meta name="generator" content="WordPress 3.0.1" /> ``` However, some sites remove this tag to [hide the fact](https://wordpress.stackexchange.com/questions/1507/steps-to-take-to-hide-the-fact-a-si...
3,072
<p>I have some PHP code that I would like to pull out of an existing page of a template, and put into a widget so I can move it around.</p> <p>What is the quickest way to create a widget?</p>
[ { "answer_id": 3073, "author": "EAMann", "author_id": 46, "author_profile": "https://wordpress.stackexchange.com/users/46", "pm_score": 5, "selected": true, "text": "<p>The <a href=\"http://codex.wordpress.org/Widgets_API#Developing_Widgets_on_2.8.2B\" rel=\"nofollow\">Widgets API</a> is...
2010/10/20
[ "https://wordpress.stackexchange.com/questions/3072", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1269/" ]
I have some PHP code that I would like to pull out of an existing page of a template, and put into a widget so I can move it around. What is the quickest way to create a widget?
The [Widgets API](http://codex.wordpress.org/Widgets_API#Developing_Widgets_on_2.8.2B) is the quickest way to make a widget that's reusable. Example use: ``` class My_Widget extends WP_Widget { /** * PHP4 constructor */ function My_Widget() { My_Widget::__construct(); } /** ...
3,074
<p>I need to know if the 'Shopp' e-commerce plugin can be modified to display radio buttons instead of drop down menus for the product options. I don't need you to tell me how this can be done (though that would certainly be welcome), just if it is possible. I don't want to invest in Shopp unless it is something that h...
[ { "answer_id": 3114, "author": "Roswell Balentien", "author_id": 706, "author_profile": "https://wordpress.stackexchange.com/users/706", "pm_score": 3, "selected": true, "text": "<p>This example highlights the versatility of interface options you can create by using radio inputs to selec...
2010/10/20
[ "https://wordpress.stackexchange.com/questions/3074", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1294/" ]
I need to know if the 'Shopp' e-commerce plugin can be modified to display radio buttons instead of drop down menus for the product options. I don't need you to tell me how this can be done (though that would certainly be welcome), just if it is possible. I don't want to invest in Shopp unless it is something that has ...
This example highlights the versatility of interface options you can create by using radio inputs to select a product variation rather than the default menus. This section of code could be used in place of the variations code block in either the product.php template file or the category.php template file (if you want ...
3,089
<p>Im using a wfcart in my WordPress site but for some reason on certain pages WordPress drops the session I'm wondering if there is a way to enable sessions in WordPress 3?</p>
[ { "answer_id": 3090, "author": "somatic", "author_id": 838, "author_profile": "https://wordpress.stackexchange.com/users/838", "pm_score": 3, "selected": true, "text": "<p>If you need to manually enable the session globally, use this in your functions.php (I included a line for manually ...
2010/10/20
[ "https://wordpress.stackexchange.com/questions/3089", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1327/" ]
Im using a wfcart in my WordPress site but for some reason on certain pages WordPress drops the session I'm wondering if there is a way to enable sessions in WordPress 3?
If you need to manually enable the session globally, use this in your functions.php (I included a line for manually setting a session variable as an example, not required): ``` add_action('init', 'session_manager'); function session_manager() { if (!session_id()) { session_start(); } $_SESSION['foo...
3,092
<p>A bit of a noob PHP question coming up.</p> <p>I am trying to create a generic archive style view for my custom post types. Ideally I want to create one generic template that can be used for all post-types.</p> <p>Currently I use this as my have_posts query to bring in all posts of 'custom-post-type' </p> <pre><c...
[ { "answer_id": 3167, "author": "jeffbyrnes", "author_id": 3831, "author_profile": "https://wordpress.stackexchange.com/users/3831", "pm_score": 0, "selected": false, "text": "<p>It's not quite what you're looking for, but I use Shaun Inman's Lessn as my shortener, and on the WordPress si...
2010/10/20
[ "https://wordpress.stackexchange.com/questions/3092", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1298/" ]
A bit of a noob PHP question coming up. I am trying to create a generic archive style view for my custom post types. Ideally I want to create one generic template that can be used for all post-types. Currently I use this as my have\_posts query to bring in all posts of 'custom-post-type' ``` <?php $args=array( ...
I've set up YOURLS for and have been extremely pleased. With the wordpress plugin, it will automatically create a short url for you if there isn't one. And with the Admin of YOURLS you can create your own custom short url's to anything you want, granted it isn't in WP Admin. I don't believe you can set your own custom...
3,097
<p>For example...</p> <pre><code>add_action('init', 'reg_tax'); function reg_tax() { register_taxonomy_for_object_type('category', 'attachment'); } </code></pre> <p>Adds a "Category" input field to the media manager and attachments editor. I'd like to know if its possible to alter this function to capture a "link ...
[ { "answer_id": 3108, "author": "fuxia", "author_id": 73, "author_profile": "https://wordpress.stackexchange.com/users/73", "pm_score": 5, "selected": true, "text": "<p>I use a <strong>very rough</strong> plugin to add information about the artist and a URL to media files. It needs some t...
2010/10/20
[ "https://wordpress.stackexchange.com/questions/3097", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/366/" ]
For example... ``` add_action('init', 'reg_tax'); function reg_tax() { register_taxonomy_for_object_type('category', 'attachment'); } ``` Adds a "Category" input field to the media manager and attachments editor. I'd like to know if its possible to alter this function to capture a "link destination" URL instead. ...
I use a **very rough** plugin to add information about the artist and a URL to media files. It needs some tweaking (and I need the time), but it works and may demonstrate how add the extra fields and how to use them in your theme: ``` <?php /* Plugin Name: Media Artist Field Description: Adds two field to attachments ...
3,125
<p>Flushing rules is clearly an important part of creating themes with custom post types. See <a href="http://wpengineer.com/2044/custom-post-type-and-permalink/" rel="nofollow noreferrer">here</a> and <a href="https://wordpress.stackexchange.com/questions/3122/wordpress-custom-post-types-breaks-permalink-on-theme-rein...
[ { "answer_id": 3130, "author": "bangbambang", "author_id": 1121, "author_profile": "https://wordpress.stackexchange.com/users/1121", "pm_score": 2, "selected": false, "text": "<p>this code (taken from <a href=\"http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html\" rel...
2010/10/21
[ "https://wordpress.stackexchange.com/questions/3125", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1341/" ]
Flushing rules is clearly an important part of creating themes with custom post types. See [here](http://wpengineer.com/2044/custom-post-type-and-permalink/) and [here](https://wordpress.stackexchange.com/questions/3122/wordpress-custom-post-types-breaks-permalink-on-theme-reinstall). Does anyone have any example code...
While the solutions provided here do still work, WordPress has evolved since and does now (since 3.3, I believe) provide direct hooks for theme activation. [`after_switch_theme`](http://codex.wordpress.org/Plugin_API/Action_Reference/after_switch_theme) will fire on theme activation and [`switch_theme`](http://codex.w...
3,131
<p>According with <a href="https://wordpress.stackexchange.com/questions/3001/wordpress-category-page-not-for-posts">Wordpress: category page not for post's</a>. I use wordpress to create web sites for flash games, so I don't have certain page for post's. I add each game by post-new.php?post_type=game and u can see it'...
[ { "answer_id": 3138, "author": "bangbambang", "author_id": 1121, "author_profile": "https://wordpress.stackexchange.com/users/1121", "pm_score": 0, "selected": false, "text": "<p><code>category__in</code> is a category parameters. use <code>tag__in</code> instead:</p>\n\n<pre><code>$args...
2010/10/21
[ "https://wordpress.stackexchange.com/questions/3131", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/1301/" ]
According with [Wordpress: category page not for post's](https://wordpress.stackexchange.com/questions/3001/wordpress-category-page-not-for-posts). I use wordpress to create web sites for flash games, so I don't have certain page for post's. I add each game by post-new.php?post\_type=game and u can see it's not the reg...
I've solved my task! 'begin\_roundblock' and 'end\_roundblock' are my functions for making blocks to games. 'cols' and 'rows' are number columns rows and rows for games. ``` if ($tag) { $cols = 9; $rows = 5; $paged = (('paged')) ? get_query_var('paged') : 1; $post_per_page = $cols * $rows; // -1 shows ...