If I consider changing my WordPress DB tables to InnoDB, will it have an effect on the way WordPress works?

I found a superb post here about optimising WordPress for large installs. One of the steps refers to `lighthttpd` which sounds excellent but isn't currently supported by DirectAdmin. Last time I messed about with a non-DA installation I managed to break my server and had to pay a professional to get it fixed... One of its other steps is to `ALTER` all of my MySQL tables to use the InnoDB engine instead of MyISAM. This appeals to me because it would appear to fix some of the major problems I've been having - i.e. table locks. The following is an example of my MySQL's `SHOW PROCESSLIST;` including SQL statements:               | 17181 | my_db | localhost | my_db | Query   | 35117 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'boraras-brigittae' AND wp_po |     | 17182 | my_db | localhost | my_db | Query   | 35118 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17183 | my_db | localhost | my_db | Query   | 35117 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'boraras-brigittae' AND wp_po |     | 17184 | my_db | localhost | my_db | Query   | 35117 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'boraras-brigittae' AND wp_po |     | 17185 | my_db | localhost | my_db | Query   | 35041 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'akysis-vespa' AND wp_posts.p |     | 17186 | my_db | localhost | my_db | Query   | 35050 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('images','profiledotline-gif') A |     | 17187 | my_db | localhost | my_db | Query   | 35050 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('images','picarrow-gif') AND (po |     | 17188 | my_db | localhost | my_db | Query   | 35043 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17189 | my_db | localhost | my_db | Query   | 35041 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('m','marginal') AND (post_type = |     | 17190 | my_db | localhost | my_db | Query   | 34989 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17191 | my_db | localhost | my_db | Query   | 34989 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('w','wet-dry-filter') AND (post_ |     | 17192 | my_db | localhost | my_db | Query   | 34990 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17193 | my_db | localhost | my_db | Query   | 34954 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'corydoras-sterbai' AND wp_po |     | 17194 | my_db | localhost | my_db | Query   | 34954 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17195 | my_db | localhost | my_db | Query   | 34955 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17196 | my_db | localhost | my_db | Query   | 34954 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17197 | my_db | localhost | my_db | Query   | 34897 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17198 | my_db | localhost | my_db | Query   | 34955 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17199 | my_db | localhost | my_db | Query   | 34898 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17200 | my_db | localhost | my_db | Query   | 34897 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17201 | my_db | localhost | my_db | Query   | 34898 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums','lofiversion','index-ph |     | 17202 | my_db | localhost | my_db | Query   | 34897 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums') AND (post_type = 'page |     | 17204 | my_db | localhost | my_db | Query   | 34897 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17205 | my_db | localhost | my_db | Query   | 34897 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'sawbwa-resplendens' AND wp_p |     | 17206 | my_db | localhost | my_db | Query   | 34897 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'badis-sp-buxar' AND wp_posts |     | 17207 | my_db | localhost | my_db | Query   | 34898 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'melanotaenia-boesemani' AND  |     | 17208 | my_db | localhost | my_db | Query   | 34898 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'betta-prima' AND wp_posts.po |     | 17209 | my_db | localhost | my_db | Query   | 34865 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums') AND (post_type = 'page |     | 17210 | my_db | localhost | my_db | Query   | 34897 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17211 | my_db | localhost | my_db | Query   | 34898 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17213 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17214 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17215 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('knowledge-base') AND (post_type |     | 17216 | my_db | localhost | my_db | Query   | 34865 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17217 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17218 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'badis-sp-buxar' AND wp_posts |     | 17219 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums','lofiversion','index-ph |     | 17220 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'betta-prima' AND wp_posts.po |     | 17221 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17222 | my_db | localhost | my_db | Query   | 34865 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17223 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17224 | my_db | localhost | my_db | Query   | 34865 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'hemichromis-lifalili' AND wp |     | 17225 | my_db | localhost | my_db | Query   | 34864 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17226 | my_db | localhost | my_db | Query   | 34862 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'apistogramma-borellii' AND w |     | 17227 | my_db | localhost | my_db | Query   | 34863 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'melanotaenia-lacustris' AND  |     | 17228 | my_db | localhost | my_db | Query   | 34862 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'melanotaenia-lacustris' AND  |     | 17229 | my_db | localhost | my_db | Query   | 34861 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'mikrogeophagus-altispinosus' |     | 17230 | my_db | localhost | my_db | Query   | 34861 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.ID = 25503 AND wp_posts.post_type = 'atta |     | 17231 | my_db | localhost | my_db | Query   | 34803 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'piaractus-brachypomus' AND w |     | 17232 | my_db | localhost | my_db | Query   | 34803 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17233 | my_db | localhost | my_db | Query   | 34803 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('knowledge-base') AND (post_type |     | 17234 | my_db | localhost | my_db | Query   | 34803 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17235 | my_db | localhost | my_db | Query   | 34803 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums') AND (post_type = 'page |     | 17236 | my_db | localhost | my_db | Query   | 34803 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17237 | my_db | localhost | my_db | Query   | 34803 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums') AND (post_type = 'page |     | 17238 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('m','migrate') AND (post_type =  |     | 17239 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'hemichromis-lifalili' AND wp |     | 17240 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17241 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums') AND (post_type = 'page |     | 17242 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17243 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17244 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums','lofiversion','index-ph |     | 17245 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17246 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT post_modified_gmt FROM wp_posts WHERE post_status = 'publish' AND post_type IN ('post', 'page |     | 17247 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums') AND (post_type = 'page |     | 17248 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'geophagus-brokopondo' AND wp |     | 17249 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'hyphessobrycon-amandae' AND  |     | 17253 | my_db | localhost | my_db | Query   | 34788 | Waiting for table level lock | SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AN |     | 17255 | my_db | localhost | my_db | Query   | 34786 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('knowledge-base') AND (post_type |     | 17260 | my_db | localhost | my_db | Query   | 34786 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('s','silver-sand') AND (post_typ |     | 17262 | my_db | localhost | my_db | Query   | 34786 | Waiting for table level lock | SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name IN ('forums') AND (post_type = 'page |     | 25505 | root      | localhost | NULL      | Query   |     2 | NULL                         | SHOW PROCESSLIST         I've enabled the `slow-query-log` and the output (having been run through an analysis script) can be found here. However, as I've attempted to `ALTER` my tables, the following error has occurred on `wp_posts`: `ERROR 1214 (HY000) at line 14: The used table type doesn't support FULLTEXT indexes` So, my questions are kinda three-fold, but kinda just one:   * Can I use InnoDB and keep the FULL-TEXT INDEXES that WordPress appears to use?   * Will using InnoDB help to alleviate the problems I've been having with table-locks?   * Can I use InnoDB without having an adverse effect on my WordPress installation?* *I have myriad plugins including W3 Total Cache, Simple Forums, AdRotate and many more.


wp_redirect to file:// location results in blank page/cannot be displayed page

I have a CPT that is justed used for linking to resources on a local drive. I have this code in single-resource.php:               <?php     global $post;     the_post();     $location = get_post_meta($post->ID, 'sc_stace_resource_location', true);     $count = (int) get_post_meta($post->ID, 'sc_stace_view_count', true);     $count++;     update_post_meta($post->ID, 'sc_stace_view_count', $count);     wp_redirect($location);     die();     ?>      Basically the user clicks the resource, the resource counter is incremented and then the user should get taken to the file location. An example file location is:               file://S:/_%20Transfer/Scott/wfw_christmas_041111.pdf      Now if I put this in the address bar of any browser the file is loaded fine. but when I navigate with the above code I get a blank page on webkit browsers and a page cannot be displayed in IE browsers. Not sure if this is a PHP issue or a WordPress issue. Anyone know why this isn't working? _UPDATE_ It appears that the reason why this isn't working is because of security in the browser. The only solution I can think of is to link directly to the file but if I do this I lose the ability to track the number of downloads. Any solutions?


and custom post_types to custom menu

managed to create a custom menu area in the admin but now want to place 2 post types to it. They already exist - questions & answers, but can't find a way to put their menu links into the custom menu.               add_action('admin_menu', 'mt_add_pages');          function mt_add_pages() {              add_menu_page(__('Competition','comp'), __('Competition','comp'), 'manage_options', 'mt-top-level-handle', 'test_func', '', 5 );         add_submenu_page('mt-top-level-handle', __('Answers','comp-answers'),  __('Answers','comp-answers'), 'manage_options', 'sub-page', 'test_func2');          }          function test_func(){         echo 1; // question post_type links     }          function test_func2(){         echo 2; // answer post_type links     }      any help appreciated!


How to Add a .js file Only in one specific Page Dynamically to Head

I need to add some scrips for Google Maps only in my contact page and I do not want to populate it on all pages. I am not willing to create a custom header as well so I was thinking is there any way to populate the js file only on contact page? currently I am using this code to add javascript to theme               //Load Scripts     function load_scripts(){         wp_deregister_script('jquery'); // De-register Existing jquery         wp_enqueue_script('jquery', 'http://code.jquery.com/jquery.js', '', '', true);         wp_enqueue_script('bootstrap-jquery', get_template_directory_uri().'/assets/js/bootstrap.js', '', '', true);     }      but as I said I have another file called **googlemap.js** can you please let me know if I can add it to ONLY contact page from this code? the other Point is Wordpress is adding this code at the end of body (before tag) which honestly **I do not know how and why**! but in my specific case I need to add the code into ! can you please let me know how I can do this Thanks


Query posts: how to exclude results if post is in multiple categories

Say I have 3 categories: A, B, C, and another category D that posts in A,B,C can also be assigned to. D is to denote the featured post for the category, and theoretically only one post for each (A, B, C) will also be assigned D. I can find the featured post for each category fine using category__and . I have a need to make a list of the rest of the category minus the featured post to the right of the featured post on the home page. So for example I want to get a list of category A but I want to exclude the featured post that would be marked category A and category D. I tried using "category_ _in" followed by "category_ _not_in" thinking it would accomplish this but the "category__not_in" seems to override and just find everything in every category except for the excluded category. If I have things structured wrong please let me know. I am trying to make things simple for the site owner by not having to remember to enter text for a tag (featured post). I'd rather them just check the check boxes in the category list. Summarizing, my code needs to do two things. For example: Find the "featured post": FIND A and D . This is done. Find everything in the category EXCEPT featured post: Find A, exclude (A and D). Any help would be greatly appreciated. I'm new to Wordpress but not coding. Just trying to get acquainted with the functionality.


Variables declared in header not available in other includes

I have a var set in my header.php file:               $myBool = false;      and in page.php, I try to echo it:               echo $myBool;      But the variable is never set. This doesn't help either:               global $myBool;     echo $myBool;      Does anyone know what the problem is? Note: I'm using a custom theme based on the blank theme ( http://digwp.com/2010/02/blank-wordpress-theme/ ) but the same behaviour is evident when using twentyten / eleven so the theme seems to have nothing to do with this


WXR slicing script

I have a massive WXR file im trying to import into wordpress. I run out of memory when i try to import as one file, so I'm thinking of how i can split the big file into smaller files programatically and if anyone had a script to do this


Multi-language permalink in qtranslate

I am using qtranslate plugin for my WordPress site to make it a multi-language site. Now I have got a requirement like For English the url should look like www.sitename.com/contact-en For French the url should look like www.sitename.com/fr/contact-fr How can I accomplish this? (qTranslate is the plugin used) Note: There should not be any post id coming in-between As per the post in Multilingual permalinks (qtranslate) I tried http://www.3dolab.net/en/qtranslateslug-plugin-widget but 'page not found' errors are occurring. It looks like the author has stopped improving that plugin as per the 29th comment in that page.


WordPress menu to change page title

I am using `wp_list_pages`. I am unable to change page title For eg:- I made a page with name `lorem ipsum` and want to show in content area the same name i.e `lorem ipsum`. But in menu, I want to show the name `lorem`. How to do this.


How to display list of results

I need to display a list of results which will include a name, time, etc. They will be in this format: results. I have looked at using tables, but short of writing a script to parse the text file, it wouldn't work. I think the best option is to make them appear in a monospaced font but I cannot find a way to do this that would not require code written on each post. Cheers, Will.


Automatically Import WordPress Blog to Facebook Page

I managed to import wordpress post to Facebook with this: http://www.insidefacebook.com/2009/02/22/how-to-import-your-blog-into- facebook/ When i create new post, Facebook doesn't **show any new posts** after the importation. Anyone have a idea how to keep showing the post created in Wordpress to Facebook after the importation ? Note: Sorry, not pretty good in English :/


Is it possible ( or advisable) to allow open access to the new theme customizer for potential clients?

I've been using the new theme customizer and it really has me thinking how awesome it would be to allow potential theme buyers/clients etc to play with the customizer for a demo theme (without being logged in). The customizer is located at : `..wp-admin/customize.php`. So what it would take would be to somehow allow open access to this URL **but** nothing else in the back end. I suppose there is probably a security issue with this but I thought I'd get a discussion going on it here in case it's possible to do this safely as I'm sure other people might have the same idea. So the question is : is there any safe way to allow open access to a single page of the admin?


Search - Only search for post meta field

I know there are a lot of good plugins which extend the wordpress search but I want to do the opposite. I want the search only to return posts which have a certain value in a certain post meta field.   How do I do that?


Creating a mobile site by adding a new class to the body tag from functions.php

Essentially is there a way to use a function in functions.php to turn the `<body>` tag into `<body class="mobile">`? I have code that recognizes mobile devices but right now it's set up to load a mobile.php page `include(STYLESHEETPATH."/mobile.php");`, which isn't quite what I want. I've tried all sorts of mobile site plugins like WP mobile, mobify, etc. None of them work the way I want and I'd rather not mess with that anymore. Please don't suggest that. I know this is kind of a newbie question but I can't find any info on it anywhere. Thanks for your time.


What are the current recommended best-practices for comments.php?

I'm getting ready to submit a theme to the .Org repo and wanted to make sure that everything is in ordnung. One of the biggest holes left in my design is the comments template. I've taken a look at comments.php in a few themes, Twenty Ten chief among them and have come away more confused than when I started. It seems as though (based upon tutorials from Otto, WP Engineer, etc.) the comments template has been simplified, yet when I look at the source to most themes' comments.php, they are still as convoluted as in the Christian-Montoya-derived days of old. So help me out -- what's the best way to set up a comments template that will capture the state-of-the art functionality as of WP 3.0/3.1 and yet maintain code simplicity?


PHP stylesheet cannot use standard WP functions

I am including a particular PHP file as a style sheet using               <link href="<? echo THEME_CSS;?>/styles.php" media="screen" rel="stylesheet" type="text/css">      Recently I reached the point where I needed to use TEMPLATEPATH and various built-in WordPress functions. Alas I am getting > "Warning: require_once(TEMPLATEPATH/framework/theme.php) [function.require- > once]: " and similar errors indicating that this file is not taking > advantage of the WordPress environment in general. If WordPress was even working correctly here, `TEMPLATEPATH` should be the actual template path. In addition, other functions such as `get_bloginfo()`, etc.. are not found. Is there someway I can initialize WordPress explicitly to let me pull options from the admin panels?


Updating WordPress

I have just update my WordPress page and I can't see it. A lot of plugins are giving errors, so I activate DEBUG. Then I have try to desactivate all plugins in the database. To make this I erase the option_value of active_plugins, but now I can only see a blank page when I enter my website, neither the errors!!


Displayling list of Custom Post Type Posts

I am creating 2 custom post types, and with the one displaying a list of the posts in #2. I am 90% of the way there, have the select showing but can't get it populated with the custom post types posts from #2. I am using get_posts to create the array, and then echoing into the select.               $option_list = get_pages( array( 'post_type' => 'Partners' ) );     echo '<select name="activitymeta_sel" id="activitymeta_sel">';       foreach ($option_list as $option) {        echo '<option value="' . $option . '">' . $option . '</option>';       }       echo '</select>';      I must be missing something. Can anyone spread some light on my quest. edit: The new code is below but still not getting the list of the post types, I know I am going wrong somewhere but not sure where.               echo '<select name="activitymeta_sel" id="activitymeta_sel">';      echo '<option value="">Select Partners</option> ';       $pages = get_pages('post_type=Partners');        foreach ( $pages as $pagg ) {        $option = '<option value="' . $pagg->post_title . '">';        $option .= $pagg->post_title;        $option .= '</option>';        echo $option;       }      echo '</select>';      Thanks In Advance


How do you check if a WordPress template file exist?

Is there a native function to check if a theme a template file. For instance, if a theme is not using the 'home.php' file, then execute some code...


Network Sites in Word press is missing a site

Not not sure if this has been asked before. I inherited a site, and its a WP network site. I change the admin user/password to mine just by using MYSQL update in Linux with id=1. I was then able to lo-gin to the site and see all the sites, i realized as an admin I can't see one out of the 5 sites? did I forgot to grant access or did I do something wrong?


Build Array from Input Fields question

I have a series of input fields sets:               <input type="text" name="people[name]" />     <input type="text" name="people[lastname]" />     <input type="text" name="people[email]" />          <input type="text" name="people[name]" />     <input type="text" name="people[lastname]" />     <input type="text" name="people[email]" />          ...      and I am looking for a way of storing the values as an array like the one following               { people: { name: xxx , lastname: yyy, email: zzz },                { name: xxx , lastname: yyy, email: zzz },               { name: xxx , lastname: yyy, email: zzz },               ...     }      I will use update_post_meta(); to save the values. Thank you for your help. EDIT               // CALLBACK     <?php     function show_people_box($post){     $metas = json_decode(get_post_meta($post->ID,'people',true));     ?>     <?php      $hiterms = get_terms('people', array('orderby' => 'slug', 'parent' => 0, 'hide_empty' =>false));           ?>     <?php foreach($hiterms as $key => $hiterm) { ?>
<?php echo $hiterm->name; ?>

     <?php     $args = array(         'post_type'=>'people',         'orderby' => 'menu_order',         'post_parent' => 0,         'tax_query' => array(array(         'taxonomy' => 'people',         'field' => 'id',         'terms' => $hiterm->term_id     )));     ?>     <?php      $query = new WP_Query($args);     while($query->have_posts()){     $query->the_post();     ?>     <?php      $children = get_children(array('post_type' => 'people', 'post_parent' => get_the_ID() ));     if($children) {     ?>
         <input name="people[name]" type="text" />	         <input name="people[lastname]" type="text" />	         <input name="people[email]" type="text" />
     <?php          $args_2 = array( 'post_type'=>'people','post_parent' => get_the_ID() );     $query_2 = new WP_Query($args_2);     while($query_2->have_posts()){     $query_2->the_post();     ?>
         <input name="people[name]" type="text" />	         <input name="people[lastname]" type="text" />	         <input name="people[email]" type="text" />
     <?php     }     } else {          ?>
         <input name="people[name]" type="text" />	         <input name="people[lastname]" type="text" />	         <input name="people[email]" type="text" />
     <?php      }     ?>     <?php     } wp_reset_postdata();      ?>
     <?php } ?>     <?php     }          // SAVE     add_action( 'save_post', 'save_people_box' );     function save_people_box(){          foreach($_POST['people'] as $key => $value){     $peoples[$key] = $value;     }          global $post;     update_post_meta( $post->ID, 'people', json_encode($peoples) );          }      I hope it helps, in my attempt to simplify my question I removed some html tags. Thanks for all your help again.


What is the proper way implement a global $wp_rewrite?

The below code works correctly, but I don't know if it is proper coding. Can anyone confirm or comment on the code?               add_action('init', 'news_rewrite');     function news_rewrite() {         global $wp_rewrite;         add_permastruct('news', 'news/%year%/%postname%/', true, 1);         add_rewrite_rule('news/([0-9]{4})/(.+)/?$', 'index.php?news=$matches[2]', 'top');         add_rewrite_rule('^news/([0-9]{4})/?','index.php?post_type=news&year=$matches[1]','top');     }


Is it possible Embed flexviewer in wordpress and how?

I have a flex viewer application and need to embed it in my WordPress site. I try so many ways to make it happen without luck. I try used a plugin called **swfobj** , by put simple code as follow : `[swfobj src= "index.swf" width ="100%" height ="550"]`, but still get an error notification as follow : _WidgetManager #error2036_.. Is it because wordpress prevent to denied flex viewer application or what?


Simple form that saves to database

I am using a 3rd party service that does a scrub of my database for new entries within a specific table. However I am been unable to find a simple form plugin that submits data to the wordpress database inside of a table that won't affect any of the wordpress functionality. The reason is my hosting provider only allows me one database. I need to use a form in my wordpress that:   1. Captures name, phone, email submitted by end user   2. Save to the database   3. Redirect user to confirmation page.  Nothing elaborate really and although it would be great to see the results in the wordpress administration it is not necessarily required since I can just use myphpadmin. In summary: I need a simple html/php form, where I can just paste the form html onto a page via the wordpress administration via the html/code view for pages. When a user submits the form, it saves it to the wordpress database and then redirects the user to a "thank you" page.


Wordpress always display the first menu

I try to display multiple menus but Wordpress keep always display the first one I created... Here is all the code about the menus: **functions.php**               <?php function custom_init(){            register_nav_menus(         array(           'header_quick_links' => __( 'Liens rapides du header' ),           'header_menu'        => __( 'Menu du header' )         )       );          }          add_action('init', 'custom_init');      **header.php**               <?php wp_nav_menu(array(       'menu'       => 'header_quick_links',       'items_wrap' => '
%3$s
',       'container'  => '',       'menu_class' => 'header_quick_list'     )); ?>     ...     <?php wp_nav_menu(array(       'menu'       => 'header_menu',       'items_wrap' => '
%3$s
',       'container'  => '',       'menu_class' => 'header_menu_list'     )); ?>      And in the admin, each menu is correctly assign to the good location... Any idea ?


Prevent Duplicate Instagram Posts using Instagram API

Below is the code I am using to fetch every hour (using WP CRON) Instagram posts using the Instagram API, but more often than not I am getting duplicate, triple, and even quadruple identical posts and it's driving me crazy that I can't fix the issue. I thought I was giving plenty of checks on the meta_key and value "instagram_id", but it seems like when finding an Instagram post, it created a WP post, hangs there and creates 4 more before moving on to finding more Instagram post. Ideally I want it to always check if a post with same Instagram ID exists before creating another post! It's very sporadic, sometimes I can run the API 5 times and there are no duplicates, other times all I get are duplicates. HELP!               // Get recent media for the tag going back 20 pages.     $recent_media = $i->tagRecent($tag, 20);          // Loop the recent media.         foreach($recent_media as $media) {             // debug             global $api_debug;             $found = false;             echo "+ Checking Media № {$media->id}.
\n";                  // Query WordPress for the media before doing API calls.             $check = new WP_Query(                     array(                         'post_type' => 'instagram_api_feed',                         'meta_key' => 'instagram_id',                         'meta_value' => $media->id,                         'cache_results' => false,                         'update_post_meta_cache' => false,                         'update_post_term_cache' => false,                         'post_status' => array('pending', 'draft', 'future', 'publish', 'private')                     )                 );                 // log                 if($api_debug) {                 write_log("Number of Posts found: " . $check->found_posts . " for ID " . $media->id);                 }             // If Existing Wordpress Post Not Found, we need to see about adding it.             if(!$check->found_posts) {                 // log                 if($api_debug) {                     write_log("Instagram ID Not Found..." . $media->id);                 }                 echo "+ Likes Check For Media № {$media->id}.
\n";                      // See if any user has liked the media in the limited list of likes.                 foreach($media->likes->data as $like) {                     foreach($cur_users as $user) {                         if($like->username == $user) {                             $found = true;                             break;                         }                     }                 }                      // If we haven't found one yet, we should look deeper.                 if(!$found) {                     // log                     if($api_debug) {                     write_log("Instagram ID Still Not Found, extend the check..." . $media->id);                     }                     echo "+ Extended Likes Check For Media № {$media->id}.
\n";                     foreach($cur_users as $user) {                         set_time_limit(120);                         // See if the user is in the extended list of likes.                         if($i->userHasLikedMediaLight($user, $media->id)) {                             $found = true;                             break;                         }                     }                 }                      // We have a match for this tag...                 if($found) {                     // log                     if($api_debug) {                     write_log("Instagram ID Found but let's double check ID " . $media->id . " for duplicates...");                     }                     // ...but check again for an existing post to avoid duplicates! - JFLAY                     $doubleCheck = new WP_Query(                         array(                             'post_type' => 'instagram_api_feed',                             'meta_key' => 'instagram_id',                             'meta_value' => $media->id                         )                     );                     if(!$doubleCheck->found_posts) {                         // log                         if($api_debug) {                         write_log("No Duplicates! Let's Add " . $media->id);                         }                         echo "+ {$media->user->username}'s photo № {$media->id} has been liked under #{$tag}
\n";                              echo "  + Copying Media № {$media->id}.
\n";                              // Media details.                         $thumb = $media->images->standard_resolution->url;                         $width = $media->images->standard_resolution->width;                         $height = $media->images->standard_resolution->height;                         $media_type = $media->type;                              // Modify some things based on the media type.                         if($media_type === 'video') {                             $media_url = $media->videos->standard_resolution->url;                             $media_poster = $thumb;                         } else {                             $media_url = $thumb;                         }                              // Thumbnail info.                         $thumb_filename = pathinfo($thumb, PATHINFO_BASENAME);                         $tmp_thumb_filename = $thumb_filename;                         $count = 1;                              // Find a unique name for the media.                         while(file_exists($upload_folder . $tmp_thumb_filename)) {                             $tmp_thumb_filename = $count . '-' . $thumb_filename;                             $count++;                         }                         $thumb_filename = $tmp_thumb_filename;                         $copied = copy($thumb, $upload_folder . $thumb_filename);                              if($copied) {                             echo "  + Creating Post.
\n";                                  $post_content = '
' . $media->caption->text;                             // log                             if($api_debug) {                             write_log("Creating Post Content... " . $post_content . ' Line:' . __LINE__);                             }                             // Add the post.                             $ID = wp_insert_post(                                     array(                                         'post_type' => 'instagram_api_feed',                                         'post_title' => $media->user->username,                                         'post_date' => date('Y-m-d H:i:s', $media->created_time),                                         'post_content' => $post_content,                                         'post_status' => 'publish',                                         'post_author' => 1,                                         'guid' => $media->link                                     )                                 );                                  // The post was inserted.                             if($ID) {                                 // log                                 if($api_debug) {                                 write_log("Inserted Post ID $ID Insta_ID: " . $media->id);                                 }                                 // Update various meta info.                                 update_post_meta($ID, 'instagram_media_type', $media_type);                                 update_post_meta($ID, 'instagram_media_url', $media_url);                                 update_post_meta($ID, 'instagram_media_poster', $media_poster);                                 update_post_meta($ID, 'instagram_id', $media->id);                                 update_post_meta($ID, 'instagram_contents', json_encode($media));                                 update_post_meta($ID, 'instagram_link', $media->link);                                 update_post_meta($ID, 'instagram_hashtag', $tag);                                 update_post_meta($ID, 'import_id', $running);                                      echo "  + Attaching image.
\n";                                      // Attach the image.                                 $wp_filetype = wp_check_filetype($thumb_filename, null);                                 $attachment = array(                                             'post_title' => $thumb_filename,                                             'post_content' => '',                                             'post_mime_type' => $wp_filetype['type'],                                             'post_status' => 'inherit'                                         );                                      $attach_id = wp_insert_attachment($attachment, $upload_folder . $thumb_filename, $ID);                                 $attach_data = wp_generate_attachment_metadata($attach_id, $upload_folder . $thumb_filename);                                 wp_update_attachment_metadata( $attach_id,  $attach_data);                                 set_post_thumbnail($ID, $attach_id);                                  } else {                                 echo "  + Failed to Create Post for Media № {$media->id}.
\n";                             }                         } else {                             echo "  + Failed to Copy Media № {$media->id}.
\n";                         }                     } else {                         // log                         if($api_debug) {                         write_log("Ok, there was already a post here, how did this happen?");                         }                     }                    } else {                     echo "+ No likes for  Media № {$media->id}.
\n";                 }                  // Found.  Update comments.             } else {                 $ID = $check->posts[0]->ID;                 echo "+ Already In WP as Post ID $ID.
\n";                 // log                 if($api_debug) {                     write_log("Already In WP as Post ID $ID");                 }             }             // If we have an ID, it's because it was created or found. So, update comments.             if($ID) {                 echo "  + Updating comments.
\n";                 update_post_meta($ID, 'instagram_caption', $media->caption->text);                 update_post_meta($ID, 'instagram_comments', json_encode($i->mediaComments($media->id)));                 wp_set_post_terms($ID, $tag, 'instagram_tags', true);             }                  echo "
\n";         }


Rewrite a specific Post Format to URL slug

I'll cut to the chase. I am using Post Formats on my WordPress 3.6 site, specifically 'Video', which I want to include in the URL slug. I'm pretty well verse in WordPress plugin writing etc, but cannot seem to find a way to ONLY rewrite URLs for this post format. The rough PSEUDO CODE logic would be               if (post_format == 'Video') {     // DO CLEVER REWRITING STUFF     }      Would greatly appreciate the help/advice anyone can offer.


Get posts by term slug only

What I'm looking to do is build a shortcode to that will display a list of posts based on the taxonomy slugs passed to it. But as far as I can tell, you can't use just a term's slug to pull posts in without having to also specify the taxonomy it's in. Is it possible to get posts or other taxonomy based data (term meta, name, etc) with just the terms slug, and without the specific taxonomy it's in?


How to set where user is redirected to after logging in at wp-login?

So i'm fairly certain this probably has something to do with the fact that I'm using a custom role I've set up in my functions.php file with almost 0 permissions. However, I'm still able to access the dashboard, just I get sent to profile.php on login instead of dashboard. I want my user_role to get sent to the dashboard each time as I have a custom widget set up for them there. I can't seem to find the function in the codex and the necessary hook to set this up? It looks like if I was using a custom login form I could use `wp_login_form()` but I just want to use the default login form without hacking the admin file so its not effected by updates. Anyone know the function I'm needing. Cant' seem to feed google the right terminology.


WP 3.5 caching problem

Ok so ever since I upgraded some of my sites to WP 3.5 recently, it looks like caching of specifically images and css files are screwed. To explain: If I try to update an image, it keeps on showing the old version of the image even after clearing my browser cache. I'm on a Mac, and tried FF and Chrome and cleared cache for both of them, delivering same results. If I add a parameter to the image URL (to bust the cache) it loads the new image, but then if I remove the parameter it reverts back to the old version again. I did notive that cmd+shift+R does some kind of a refresh that forces the new images/changes to display, but any subsequent "normal" refreshes reverts back again. Same thing happens with my CSS files as explained above for images. I even installed and tried W3TC to add expires headers to my assets and do the caching there, but that didn't really fix anything. Can anyone maybe just point me in the right direction to fix this? Thanks in advance!


Is there an action that is called when a post is restored from the trash?

I'm looking at the wordpress list of actions and trying to find an action that is called when a post is restored from the trash but cannot find one. Does anyone know if it exists?


Get users with atleast one post

How can I get all users with atleast one post? I don't think it's possible with `get_users` function.


Native WordPress Media Uploader on WordPress Frontend

I am using a custom template on my site to enable frontend posting. I wanted to add an option to upload media( _such as pictures_ ) on this form exactly the way native WordPress backend has. In short I wanted a button on the frontend form which could look like this : ![WP Add Media Button](http://i.stack.imgur.com/5mkmX.png) When this button is clicked I want a lightbox to open up which looks like : ![Media Upload screen](http://i.stack.imgur.com/Yw5lf.png) In short, I want the entire WP media upload option but in the frontend form. I'm sure there would be some in built functionality in WP for this. I am unable to locate the code to get this and unfortunately no plugin is able to get this result. Help appreciated.


wp_list_categories: get latest featured_image of category

I was thinking about a nicer way to display the categories in my sidebar. Instead of a plain list style, I'd like to have images / thumbnails show up as well. Currently I'm using the following:               <?php wp_list_categories('show_last_updated=1&show_count=1&title_li='); ?>       Simply displaying the name/link + post count of each category. I want to keep, that but also add a thumbnail to it. I've been browsing through this board for answers and also thought about how to do it, but I couldn't find a solution yet. I guess I have to create a function that gets the featured image of the latest post in that category. If a post has more categories, that also shouldn't cause any problems. Creating a loop with only 1 post in that category and only outputting the thumbnail would be an option, but to set it so that the thumbnail and category match could be a hassle. I'm sure that there must be a better way to do it. I'm not looking for a plugin (as I'm sure there are some), I want to hardcode it. If anybody has a good idea or some advice how to approach this, then please help me out. Thank you very much!


Where to put third party PHP library?

I'm developing a couple of open-source plugins and a theme (all part of a "suite") that all use the same third party PHP library. I'm wondering what is the best way to include it in Wordpress. Here are some thoughts:   * put it in one of the plugins and require that plugin to be installed and activated   * create a special "core" plugin that does nothing but including it   * put it directly in `wp-content` Any thoughts on that matter?


Search Results: Differentiate posts and pages

Currently the search results are all shown in the same way, no matter if it's a post or a static page. As I don't want the comment count and the categories to show up for static pages, I was wondering how to do it. The code: **(Update October 22nd)**               <?php        if(get_post_type() == 'page') : ?>
      <img src="<?php bloginfo('template_directory'); ?>/images/eye.png" alt="Views" title="views" /> <?php print_page_views(get_the_ID('')); ?>
This is a static page!

     <?php endif; ?>
      <img src="<?php bloginfo('template_directory'); ?>/images/eye.png" alt="Views" title="views" /> <?php print_page_views(get_the_ID('')); ?>              <img src="<?php bloginfo('template_directory'); ?>/images/comments2.png" alt="Comments" title="comments" /> <?php comments_popup_link('0', '10', '%'); ?>

<?php the_category(' // ') ?>
      Thanks for your help so far. I updated the code. Now, it only shows up on static pages, but the HTML markup below the conditional tag also shows up and I want that to only show up for posts. I guess I have to put an "else" tag somewhere? I just don't know how to implement it correctly. Thanks a lot in advance!


Post-Archive like a page in a specific subdirectory

I have a webpage with posts which belong to specific categories (eg _projects_ ). I want to show the archive of a specific category like a page. # Status quo The site structure is similar to this: > /   >  /our-work/   >  **/our-work/projects** <- here I want to have the archive for _projects_   >  /xyz   >  /... I use the following settings:   * `category_base` = _cat_   * `permalink_structure` = _/news/%category%/%postname%/_ I can access the projects-archive via example.com/cat/projects. # What I already tried I tried the following without success: Removing a `page_for_posts` and setting it to a newly created page " _news_ ". Including the following code in the .htaccess file before the wordpress section (with and without an `[L]`: If I use `[L,r=301]` I get a 301-redirect.               <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /         RewriteCond %{REQUEST_FILENAME} !-f         RewriteCond %{REQUEST_FILENAME} !-d         RewriteRule ^/our-work/projects/$ /cat/projects/     </IfModule>      I think there was a time where it worked somehow, but I can not remember how I did it. (Maybe the page only showed all posts, because it had no other info). # My Questions   1. Is there a better way to do this? How? (I think about creating a real page and wring a shortcode, that includes/displays all posts in the projects category)   2. If not - How can I do that?   3. Is it possible to have the posts of this category in this "subdirectory" like _/our-work/projects/acme_?


Order posts by category name

Is there any way to order posts by category name? I tried               $args = array(         'post_type' => 'dlm_download',         'posts_per_page' => 10,         'paged' => $paged,         'order_by'=> 'cat',          'order' => 'ASC'     );      But it does not really work, could please someone give me a hint?


echo vs output variable

Someone once told me, that it is good for performance, not to open and close php tags and use echo all the time, like that:               <hgroup>
<?php echo getHeading1(); ?>

<?php echo getHeading2(); ?>
     </hgroup>      Instead he uses an output variable and echoes it in the end.               $output .= '<hgroup>
' . getHeading1(); . '

' . getHeading2(); . '
     </hgroup>';          echo $output;      Does that really make any difference? When do I use which method?


Some images don't get linked when setting link-to to media-image

When inserting images into posts I have some images which refuse to recognize their link-to setting. The setting is properly saved and I also tried switching to a none setting and back, but with no effect. This only occurs for some images, regardless of the other settings and the context where it is inserted. Any clues what my cause this? **EDIT:** By some images I mean just random images. There are Jpegs (there might be some png, but this seems not to be related) like the others which work with description or without. They are all uploaded from the media library or directly from the post. Re-uploading seems to fix the issue, but it reoccurs from time to time with new images. To make this issue even more weird: It works when I remove the description- text for those images, but when I add it again (or a single letter for testing purposes), it does not work anymore. **EDIT 2:** Also cropping, flipping or other file-modifications don't affect the described behavior for those images. **EDIT 3:** Probably because of using the custom-upload-dir-extension some of my guids seem to be messed up and some of those files are the ones which are problematic. **EDIT 4:** Even with removing the custom-upload-dir-extension the problem still occurs, for new and old images...


Does wp_localize_script Call a Javascript Function or Simply Pass PHP Parameters to It

Easy question: I'm trying to understand wp_localize_script. Does wp_localize_script call a javascript function or does it simply pass PHP parameters to javascript? I want to pass php parameters to a javascript function and call the js function.


Querying a query

Let's say I have a query stored in a array. I want to parse this array, find the first posts inside this array that match a certain value from a certain key, and so extract the whole post. Is there a elegant way to do it ? Or, is it possible to run a query_posts() inside this array ? Thanks ! * * * **Edit:** _Sorry, just learning to use this fantastic website, need to learn correct use._ The purpose is to make a `get_posts()`, and display the posts not in a row, but at different places in the homepage where there is a place for a Beauty category post, a Mode category Post, etc. As any post could be in several categories, I cannot just ask for the last post in the category: a post could be in two places at the same time. My idea is to just make a get_posts query, store the result, and parse it so i could take record of what post are displayed and what are not. So, I make a query with `get_posts()` are store result in a variable. As I don't want certain posts to stay in the query, I use `'post__not_in'`, which is `array` with posts `ID` I don't want.               function request_highlights($exclude_ids) {      /* request that will populate my hightlight feed */     $args = array(     'numberposts'   => 16,     'category'  => null,     'orderby'   => 'post_date',     'order'     => 'DESC',     'post__not_in'  => $exclude_ids,     );          return get_posts( $args );     }          $highlights_posts = request_highlights($slides_id);      So at this point, I have a variable which is a objet, I guess, with all needed data. What I want to do is to get, say, the first post in the objet that has the `cat_ID=5` (for example). What i'm doing right now is :               foreach ($highlights_posts as $highlights_post) {             $fetched_post = get_the_category($highlights_post->ID);                 foreach ( $fetched_post as $fetch_cat) {                     if ($fetch_cat->cat_ID == $cat_sq) {                         $sq_post_id = $fetch_cat->cat_ID;                         break 2;                     }                 }              }     // stuff to do like get_post($sq_post_id);      Now i realise that I would need to remove that post `ID` from my list `$highlights_posts` so I cannot pull it twice. I guess i need to learn more about arrays ?


Display all posts starting with given letter?

I'm trying to build Wordpress based dictionary, basically it will have 26 pages (one for each letter): > A B C ... X Y Z And every page will display all posts starting with given letter, so after opening the "A" page it should display something like: > aback > > abacus > > abalone > > (...) azure I was thinking about custom post types at first, but creating and maintaining 26 custom post types sounds like an overkill. What will be the most efficient way of sorting posts like that? Database query, splitting loop with PHP? I am aiming for 1000s of posts (yes, it has to be Wordpress :)).


Custom tables or custom fields?

I'm building blog where users ll have option to download images. I want to display information how many times post have been displayed and how many times the image have been downloaded. Technically I have solved this by using custom fields and it works. In near future I want to add option to sort images based on vies/downloads. Also I have solved this, but what Im thinking now is that maybe I should use custom tables instead of custom fields. I plan to have about thousand of images, and I'm worrying if queries for displaying most downloaded/viewed images will be slow.


Image picker widget

I want to create a custom widget so the user can select 2 images from the media library via a dropdown box and display them in a sidebar. So I need the widget to display 2 drop downs, which each show the TITLE of the images in the media library. I then need to save the url of these two images to use in the front-end (labelled `<?php $IMAGEVAR ?>` in the `widget` function. Here is my widget template ->               <?php     class Image_Picker extends WP_Widget     {       function Image_Picker() {         $widget_ops = array('classname' => 'Image_Picker', 'description' => 'Pick 2 images from media library');         $this->WP_Widget('Image_Picker', 'Image Picker', $widget_ops);       }            function form() {       //WIDGET BACK-END SETTINGS         echo '<select name="link1">';         echo '<option value="image1" selected>Image 1 Title</option>';         echo '<option value="image2">Image 2 Title</option>';         echo '<option value="image3">Image 3 Title</option>';         echo '</select>
';         echo '<select name="link2">';         echo '<option value="image1" selected>Image 1 Title</option>';         echo '<option value="image2">Image 2 Title</option>';         echo '<option value="image3">Image 3 Title</option>';         echo '</select>';       }            function update() {       //WIDGET SAVE FUNCTION       }            function widget() {       //WIDGET FRONT-END VIEW       ?>
<img src="<?php $IMAGEVAR ?>" alt="" width="203" height="271" border="0">

<img src="<?php $IMAGEVAR ?>" alt="" width="177" height="207" border="0">
          <?php       }     }          // Add class for Random Posts Widget     add_action( 'widgets_init', create_function('', 'return register_widget("Image_Picker");') );          ?>      I have been doing this as a meta box for posts, but I need to make a widget version and can't work out how to implement it. I have added in a front-end template to illustrate how it works as a widget, this template will show as a widget if you include it in your `functions.php`, but obviously it won't do anything... Any help is greatly appreciated, cheers.


Is there any hook for theme activation ? or something similar?

I know this has been asked before however my question is different. So. I have a plugin that creates custom post types on the fly. the plugin also has a function to create template files for each of those custom post types. it simply goes to those theme folder and create template page for each of the current theme. this works perfectly for the current themes. however what happened if the admin added another theme and active it ? So i am looking for a way to detect activation and then run the function to create the template page for that theme. My first idea was to check theme activation hook which i dont think going to work. Anyone with a different idea ?


Possible to add "Even/Odd Classes" to image attachments via wp_get_attachment_image?

Im looking for a way to add an alternating even/odd class directly to each image attachment when its outputted via my function below:               <?php     function nongallery_img_slide( $post_id = null ) {         if ( $post_id == null ) return;         $images = get_posts(             array(                 'numberposts' => -1,                 'post_type' => 'attachment',                 'post_mime_type' => 'image',                 'post_parent' => $post_id,                 'orderby' => 'menu_order',                 'order' => 'ASC',                 //'exclude' => get_post_thumbnail_id( $post_id )             )         );         if ( count( $images ) > 0 ) {             foreach ( $images as $image ) {                 echo wp_get_attachment_image( $image->ID, 'photogallery-img' );             }         }     }     ?>      Can this be done?   Thanks!


How to enable qTranslate languages tabs in custom plugin page

For example, I have created a custom post creator. I am using `wp_editor()` to generate "WYSIWYG" editors for content. I am using `qTranslate` for multi-language user experience. Unfortunately I am forced to create a separate "WYSIWYG" editor for every language translation. Overkill. How to enable / implement `qTranslate` language tabs as they are in default post creator.


PHP error about plugin which is not installed

I vaguely remember having Broken Link Checker installed on my Wordpress website. It is no longer installed. Wordpress is installed in network mode, and on only one of the network websites, I receive the following error at the top of my admin page: > Warning: fopen(/...wp-content/plugins/broken-link-checker/broken-link- > checker.php) [function.fopen]: failed to open stream: No such file or > directory in /.../wp-includes/functions.php on line 3594 > > Warning: fread() expects parameter 1 to be resource, boolean given in > /.../wp-includes/functions.php on line 3597 > > Warning: fclose() expects parameter 1 to be resource, boolean given in > /.../wp-includes/functions.php on line 3600 Why does this error occur when the plugin is no longer installed? Wordpress version is 3.6.1 I don't recall seeing this on WP v3.6 or lower.


Move Category into Subcategory, Keep URL structure

The site I'm working on now was a small blog which then expanded into something quite a bit larger than what they first thought. Example below               -Pizza     -Chinese     -Italian      What I need is either all the posts under one category               - Reviews      Or a structure like               - Reviews      - Pizza      - Chinese      etc..      They started using categories as tags instead of tags themselves, and there are about 15 categories that could be all moved into a parent category. For future purposes I need to move them all under the same category (keeping the category they're in now is optional, but preferable) The one thing that does need to remain the same is the URLs. This is both for disqus comments & for SEO purposes. I've tried to use the Term Management Tools plugin to move to a parent category, and that works, but I get the url of `http://example.com/reviews/pizza/post-name` instead of my original `http://example.com/pizza/post-name`


Whats wrong with this transient? Not caching as expected

I am trying to cache the returned data from a query using WP_Query. It doesn't seem to be storing any where near the time I have specified. Sometimes its refreshing on every page load. What might I be doing wrong?               <?php          // get our transient data if it exists         // prevents pummelling the database with multiple random queries         $tipsloop = get_transient ('homepage_tipsloop');         if (!$tipsloop )           {            echo 'THIS IS NEW TRANSIENT DATA';            $tipsloop = new WP_Query( array( 'cat' => '8', 'posts_per_page' => '1' , 'orderby' => 'rand') );             set_transient ('homepage_tipsloop' , $tipsloop , MINUTE_IN_SECONDS * 5 ); // cached for 5 minutes           }     ?>               <?php while ($tipsloop->have_posts()) : $tipsloop->the_post();          echo get_the_post_thumbnail($page->ID, 'homefooter-thumb'); ?>
             <?php the_content(); ?>

           MORE TIPS
     <?php endwhile;  ?>


What do comments with [...] mean?

I get a bunch of comments that simply repeat the title with '[...]'. ie:               [...] Some cool post title [...]      Is this spam or is wordpress doing something wrong? I have the akismet plugin enabled.


Retrieve current and localized month

instead of writing array of months in desired language, and doing a function to replace date('m') with localized month... I believe there should be some fast and easy way to echo current month, after all its Wordpress? I have define('WPLANG', 'hr');


How to order by post meta name in wp admin?

I am trying to order by post meta name which I added for post. Post meta is "_merchant_id" an I know how to sort by merchan_id but I don't know how to sort by merchant name. I am sorting by merchant id like this:               public function column_orderby( $vars ) {             if ( isset( $vars['orderby'] ) && is_admin() ) {                 switch ( $vars['orderby'] ) {     case 'merchant':      $vars = array_merge( $vars, array(          'meta_key' => '_merchant_id',          'orderby' => 'meta_value_num'      ) );          break;     ...      Merchant is another post type ("merchant"). How can I sort by merchant name? **UPDATE (improved explanation by screenshot):** ![enter image description here](http://i.stack.imgur.com/xmFef.png)


Slow wp-admin due to "SELECT DISTINCT post_mime_type FROM wp_posts WHERE post_type = 'attachment'"

The media library on a large site is slow in wp-admin. I did some research by looking into slow queries in the sql and found that this query is causing the slow response:               SELECT DISTINCT post_mime_type FROM wp_posts WHERE post_type = 'attachment'      It takes around 17 seconds and it's about 759000 rows of type 'attachment' in the db. What would be the best way to optimize it or cache the distinct types? I don't want to change anything in core files.


Best way to abort plugin in case of insufficient PHP version?

You write a plugin which requires PHP 5.1. Someone tries to install it on a server with PHP 4. How do you deal with that in a safe and user-friendly manner?


Custom CSS not being added by plugin

I am attempting to add custom css through my plugin. I do have wp_head() called in my header. My code is -               /**     * Enqueue plugin style-file     */     function prefix_add_my_stylesheet() {             wp_enqueue_script('style1', plugins_url('style1.css', __FILE__) );     }     add_action( 'wp_enqueue_scripts', 'prefix_add_my_stylesheet' );      I can access style1.css when I               echo plugins_url('style1.css', __FILE__);      So I know it exists and is available. I do not get any errors and the style sheet does not show. I am placing the above code inside mysite/wp- content/plugins/mycustomplug/plugin.php Can anyone let me know why this may not be loading? Nothing errors out so I assume my syntax is correct.


Only display posts that are in multidimensional meta_value

So i want to retrive a list with the posts that are in the meta_key "_blocks" and in that there is a multidimensional array with "areas" called left, right ,top etc. And within them there are assigned post_id:s. Like this:               Array     (     [left] => Array     (     [0] => 450     [1] => 452     [2] => 460     [3] => 451     [4] => 454     [5] => 449     [6] => 455     )          [right] => Array     (     [0] => 460     [1] => 455     [2] => 454     [3] => 453     )          )      The query look like this now.. Im a little confused right now how to archive this.. Before this im running a foreach as you can see on $areas as $area. And `$type_areas` holds etch post_type:s.               $args = array(         'post_type' => $type_areas[$area['area']],         'posts_per_page' => '-1',         'meta_key' => '_blocks',         'meta_query' => array(           array(             'key' => 'left',             'value' =>  '450', // just testing...             'compare' => 'IN',           )         )     );          $query = new WP_Query( $args );          while ( $query->have_posts() ) : $query->the_post();             $output .= '
post->ID .'" data-area="'. $area['area'] .'">
'. get_the_title() .'
'. $query->post->post_type .'
';          endwhile;      **UPDATE** So i ended upp with a simple SQL-query:               $sql = 'SELECT post_id FROM kwido_postmeta WHERE meta_value REGEXP \'"'. $area['area'] .'";a:[[:digit:]]+:{[^}]*"'. $mainpost->ID .'"\'';     $results = $wpdb->get_results( $sql, ARRAY_A );      That looks after the current post_id and area with a regex, then if found get the post_id..               $post_ids = array();          foreach ( $results as $result ) {         $post_ids[] = $result['post_id'];     }      With the post_id:s i make the query with `post__in` parameter which accept arrays.               $args = array(         'post_type' => $type_areas[$area['area']],         'posts_per_page' => '-1',         'post__not_in'   => $post_ids     );          $query = new WP_Query( $args );


Sanitizing and validating email field

Should I use `is_email()` to validate an email field? In WP. I've put the email field in a widget. I would really appreciate some help.               function update($new_instance, $old_instance) {          $instance = $old_instance;          $instance['email'] = is_email($new_instance['email']);              return $instance;          }      And               <p>         <label for="<?php echo  $this->get_field_id('email'); ?>">          <?php _e('Email'); ?>  </label>          <input class="widefat" id="<?php echo $this->get_field_id('email'); ?>" name="<?php echo $this->get_field_name('email'); ?>" type="email" value="<?php echo $email; ?> " />         </p>         <?php         }      Is using `is_email()` correct for this? Thank-you!


How can i use GET METHOD on wordpress plugin admin page

I am building a custom plugin which i plan to sell, but i am having problem storing my get request values in the plugin url. I have this url: /wp-admin/admin.php?page=step-one&filename=Styles_For_Less- Styles_For_Less_Product_Catalog.txt and when the submit button on that page is clicked it should go to page with this url: /wp-admin/admin.php?page=step-two&filename=Styles_For_Less- Styles_For_Less_Product_Catalog.txt&header=0&delimiter=%7C&quoted=&step2=Step+2+%3E%3E But i doesn't instead it goes here: /wp-admin/admin.php?header=1&delimiter=%2C&quoted=&step2=Step+2+%3E%3E               <form method="GET" action="<?php echo admin_url( "admin.php?page=step-two&filename=$filename&", "http" ); ?>">

             Header Row:	             <?php echo $header; ?>

             Delimiter:	             <?php echo $delimiter; ?>

             Quoted:	             <?php echo $quoted; ?>

<input type="submit" value="Step 2 >>" name="step2">       <input type="reset" value="Reset" name="B2">
     </form>      Any help greatly appreciated.


Pagination w/Static Front Page

I'm trying to add pagination to my frontpage. It's currently set to Settings --> Reading --> Static Page --> Frontpage: home I'm using a custom template for the homepage. I have my template-home.php open and it looks like this:               <?php     /*     Template Name: Home     */     ?>          <?php get_header(); ?>

                                                 <?php// wp_reset_query(); ?>                           <?php                  if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }                 elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }                 else { $paged = 1; }                      query_posts('posts_per_page=3&paged=' . $paged);                  ?>                                            <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                             <?php /* Widgetised Area */ if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'Homepage Main' ) ); ?>
                           <?php the_content(); ?>

                                       <?php /* Widgetised Area */ if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'Homepage Sidebar' ) ); ?>                                   <?php endwhile; ?>

<?php next_posts_link(__('← Older Entries', 'framework')) ?>

<?php previous_posts_link(__('Newer Entries →', 'framework')) ?>

                                            <?php echo paginate_links(); ?>             <?php endif; ?>

          <?php get_footer(); ?>      I read the "static front page" section of this page an it's not working for me. When I run the template it duplicates all my posts, show 6 posts and duplicates my header section. however my Settings --> Reading --> Says 5


get USER ID in functions.php using user_register action

I am having trouble of getting the ID in user_register filter in functions.php... Here is what I got               add_action( 'user_register', 'sendanotheremail' );     function sendanotheremail($user_id) {             $user = new WP_User($user_id);             $user_login = stripslashes($user->user_login);             $user_email = stripslashes($user->user_email);             $getid      = $user->ID;             global $wpdb;             $getunion = $wpdb->get_results("SELECT value from wp_bp_xprofile_data where user_id = $getid AND field_id = 4", "ARRAY_N");             $message  = sprintf(__('New user registration on %s:'), get_option('blogname')) . "\r\n\r\n";             $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";             $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";             $message .= "
 Please go here to approve the new user Approve/Deny";             if(!($getunion)) {                     $message .= "nothing there";             }             else {                     $message .= "yes";             }     $headers = 'From: xxx <xxx@xxx.com>';     add_filter('wp_mail_content_type',create_function('', 'return "text/html";'));     wp_mail('xxx@xxx.com', 'New User Registration to xxx website', $message, $headers);     }      I am testing the getunion if its empty I am returning "nothing there". _**So all of the other variables are getting me email with right data, but $getunion is empty..._** When I pass manually the ID here               $getunion = $wpdb->get_results("SELECT value from wp_bp_xprofile_data where user_id = $get_id AND field_id = 4", "ARRAY_N");      it works... So how can I get the ID?


Get content from one Wordpress website to another

I have been at this for days and now feel like I am way off track out of desperation and lack of knowledge. Pretty much I am trying to "scrape" public info from one Wordpress install to a separate Wordpress site. The sites are on different domains, servers and databases. Site A (the one I need to grab the content from) uses an RSS Feed which I have been able to successfully pick up. However each post contains an image ( i dont know if it is featured or not) and I really need to know how to get that image to display. At first I ran my own loop and was picking up everything aside from the image, then I tried just setting up Simplepie in the theme and still could not get the images to pick up. Then I was trying a method described on here about XMLRPC and still no luck. I am about to pull my hair out and I just dont have enough knowledgebase on the subject to get what I need done. How can I get the feed and image to display from Site A to Site B? I have read so much stuff I feel like I am so lost. Any help would be greatly appreciated, thanks **EDIT** Here is what I have been using which works as far as picking up the feed but not images                   <?php function custom_dashboard_feed() {                $feed = fetch_feed( 'http://mugshots.starnewsonline.com/feed' );          if ( ! is_wp_error( $feed) ):          // Get a maximum of 5 items          $maxitems = $feed->get_item_quantity( 5 );          $items = $feed->get_items( 0, $maxitems );          foreach ( $items as $item ):          ?>
          <a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?> <?php echo $item->get_date( 'F j, Y' ); ?>
               <?php if (has_post_thumbnail( $post->ID ) ): ?>     <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>     <img src="<?php echo $item->get_image_url ?>" height="200" width="200" />
     <?php endif; ?>          <?php echo $item->get_description(); ?>
          <?php          endforeach;          else: // Returned WP_Error, unable to fetch the feed. ?>
There was an error fetching the feed, please try again later
          <?php endif; ?>               <?php     } ?>          <?php $mugshots = custom_dashboard_feed(); echo $mugshots; ?>


What is the preferred way to add custom javascript files to the site?

I've already added my scripts, but I wanted to know the preferred way.   I just put a `<script>` tag directly in the `header.php` of my template. Is there a preferred method of inserting external or custom js files?   How would I bind a js file to a single page? (I have the home page in mind)


Add JavaScript in admin in custom plugin

> **Possible Duplicate:**   >  What is the preferred way to add custom javascript files to the site? I was reading few posts here about this, but all answers are about wp_enqueue_script or something. I'm looking for solution to embed custom JavaScript variable (created by json_encode()) in footer or in header but in admin add_action 'wp_footer' and 'wp_head' are not called. How to embed custom code - not include file.


Highlight Author Comments issues

So a few days ago I added the following code to Geek for Him and obviously missed the nested comments portion. This is implemented on many other sites of mine, without Standard Theme of coarse and working fine. Am I missing something? Check out the link here - geekforhim dot com is the site A comment is made, I comment (highlight works) someone comments below me and it's highlighted also. Any help would be greatly appreciated.               .commentlist li.bypostauthor, li.comment-author-admin {     background-color: #E0E0E0 !important;     }      So I have figured out that fi I add a background to               #comments ul.children {     background:none repeat scroll 0 0 #FFFFFF;     margin:10px 0 0 25px;     padding:0;     }      it works, but its very ugly. Any cleaner ideas? See image below on what seems to messed up I have noticed that the comments themselves are one. What I mean by this is that 4 nested comments below one all equal one comment. This is not correctly coded in my mind and probably a bug fix? Any ideas or workarounds do let me know. _**UPDATED_** With the guidance below I was able to figure out what I was after. Thanks to t31os!!


Encoding Method for URLs?

Is there a method or API that WordPress uses to encode the URLs similar to how it generates part of the URL when using the title in the URL? I am writing a plugin that generates URLs and would like to use the same method as everything else is. For instance, I type "This is my blog post" in the title and "this-is-my-blog- post" gets generated.


Problems with wierd characters and my plugin

There are special characters that can cause problems in word press, like the infamous microsoft word smart quotes. However, there are many that are captured and dealt with. My collegue and I have written a plugin that, even if it just passes the content through, stops wordpress from handling many of these characters properly. It shows particularly on foreign language web sites like a German one where special characters are handled just fine until my plugin is activated. Why is this so?


Custom Link In Wordpress Media "Attachment Details" Upload Screen

When you click "Add Media" and from there select an image from that media library screen on the right you get a breakdown (the attachment details) related to that particular image. Right below the image there are some image details and then the links > Edit Image > Delete Permanently. How can I add a custom link to appear right there (preferably) above the "Edit Image" link with a function? I searched around and the closest I could find it how to add custom fields to the media upload screen nearest to the bottom options in the right when an image is selected. I couldn't find and I'm not sure how to take that snippet and take the field area to be just a link instead. I used in my description above "image" just for visual purposes. I want the link to appear for all files from the media upload screen, not just images if someone is thinking that. Thanks a lot!


Exclude categories from the_category();

function the_category_filter($thelist,$separator=' ') {         if(!defined('WP_ADMIN')) {             //list the category names to exclude             $exclude = array('Something','Something Else','Blah','YAY');             $cats = explode($separator,$thelist);             $newlist = array();             foreach($cats as $cat) {                 $catname = trim(strip_tags($cat));                 if(!in_array($catname,$exclude))                     $newlist[] = $cat;             }             return implode($separator,$newlist);         } else             return $thelist;     }     add_filter('the_category','the_category_filter',10,2);      I am using that code, to get the_category(); to exclude some categories. But it ain't working, as it is supposed to...


Use a wordpress page to display a certain category

I'm trying to set up a portfolio page on my wordpress website, and I would like the following construct:   * /blog/ where I blog all kinds of things, including portfolio entries   * /portfolio/ where I show just posts from my portfolio category   * some regular /pagename/ pages (about, contact, etc) I want the portfolio section to have a separate style (and even html probably) than a regular category overview. So if someone clicks one of the categories in my blog they still see the normal /category/randomcategory/ overview page. This means I can't just change the category php page and/or the css, because the portfolio page is different from the regular view. Is there a way to set up my page so that it shows the posts in the category portfolio the way I want?


Theme Demo in live Site

I don't know how to explain this question but let me try, Just Imagine I've a website called xyz.com and in xyz there are 10 themes uploaded and in homepage i'll show name & screenshot of all 10 themes if someone click on activate / demo then that theme will be activated in his ip address only till his session destroy after it when he visit again after sometime he can see old theme. Means if someone wanted to buy theme from my site he can able to view it directly from my site.


How to prevent people from seeing an attachment to a scheduled post that's released in future?

I'm developing a website for a large corporation. They release financial documents on specific dates and times. I've developed a custom form to upload these pdfs to articles, and custom loops that display only these attachments on specific pages. When the date of the article is set in the future, the attachments are released when they should and the system works pretty well. The only thing is, that for the company it's super-important that there is no access to the attachment-files before the date when it's supposed to come out. So if anyone can guess the name of the attachment they can just go to wp- content/uploads/financialdocument10.pdf and read it before it's supposed to come out. Is there any ideas how to prevent this? My only idea so far is to add some random characters to the file name so it's impossible to deduce it's name on the the basis of previous filenames. Thanks!


Changing the default header name

Is it possible to change the default header.php file to something else for security reasons? It seems header.php is target for malicious attacks. I know all that, we have different named headers, I am talking about the default one. For example instead of header.php rename it to imcool.php and I don't appreciate the negative point. All the default files index.php, admin as a user, header are always targets for malicious attacks including injection.


Why is Wordpress loading a different sized post thumbnail?

I have a custom theme where I'm using post thumbnails as BG images for a slider. The thumbnails and some other info are entered using a custom post type. However, even though I'm uploading 1440x833 images, the image wordpress loads is always 1024x593. Why is it even creating a 1024 version of these thumbnails? Here's the relevant code in index.php.                    <?php         $args = array(             'post_type' => 'home-slider',             'posts_per_page' => 5,             );     ?>               <?php $homeslides = new WP_Query( $args ); ?>

                                            <?php if ( $homeslides->have_posts() ) : while ( $homeslides->have_posts() ) : $homeslides->the_post(); ?>             <?php $slideimage = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'home-slides' ); $url = $slideimage['0']; ?>
                 <div class="slide-image" style="background: url(<?php echo ($url); ?>) no-repeat center center;">

<?php the_field('slide-title') ;?>

<?php the_field('slide-subtitle') ;?>

                  <?php endwhile; endif; ?>

      Here's where I'm declaring the thumbnail size (functions.php).               // This theme uses a custom image size for featured images, displayed on "standard" posts.         add_theme_support( 'post-thumbnails' );         set_post_thumbnail_size( 320, 180, true ); // primary size         add_image_size( 'home-slides', 1440, 833, true ); // thumbnail size in home slider      } Thanks for your help!


WP Feed namespace attr issue

Having a strange issue (well, strange to me) where an xmlns:media namespace attr is being added to one feed but not the other. How do I get rid of the "xmlns:media" attr? I don't even know why it's being added to one feed but not the other. For example: http://pridemoreproperties.agentfire.com/feed/ Notice the "xmlns:media" being added. http://landandvillage.com/feed/ These are on the same WP install (WP Multisite) and both using the genesis theme.


sidebar - widgets versus code - options

I decided to use Widgets in my sidebar on the advice of another designer who thought the site would take too long to load if I used the images I'm using for titles and branding. I'm dissatisfied with the outcome because the Image and Text widgets create too much white space in between sections, and I'm limited in what I can control. I have two related questions. Does anyone know of an Image or Text Widget that will allow me to minimize the white space between sections? My images are very tightly cropped, so there's no reason for the white space other than the widgets creating it. The second question is: if I decide not to use widgets at all, and just program the sidebar.php file to refer to image files in the media library and enter in the appropriate text -- is it detrimental to the site's functionality? I see a lot of very customized wordpress sidebars online, and I can't imagine they are using widgets. But maybe they are using a technique that is over my head? This is a twenty twelve child theme. Guidance appreciated. The site is at internalcompass.us/castle right now. kb


Why does Wordpress search returns same number of results for every search query?

I am hitting a brick wall, I am searching something on a site I am building and on every search it returns 10 results when I know in the index in relevanssi it shows more for the term I am searching on. Does anyone know what the issue is with it? Thanks, Mark


Post titles and thumbnails as links to custom post types?

I am struggling with the php structure. How do I need to rewrite the code to get the links to the titles and thumbnails of the custom posts?
         <?php $pfportfolio = new WP_Query( 'post_type=portfolio', 'posts_per_page=-1' );?>         <?php while ( $pfportfolio->have_posts() ) : $pfportfolio->the_post();?>              <?php             echo '
ID, 'location', '', ' ', '' ) ).'">';             **echo '';             the_title();             echo '';             echo '
';             the_post_thumbnail('home-feat');             echo '
';**             echo '
';?>              <?php endwhile; ?>             <?php  wp_reset_postdata(); ?>
      I assume I need to integrate somehow               <a href="<?php echo get_permalink(); ?>">      but unfortunately I just dont understand how :(. Thanks so much for any help!


Are there any official or unofficial guidelines for the styling of a widget?

I've designed a sidebar widget and found that on many themes the widget looks fine. However, certain themes make the widget look out of place (clashing with colors, bad contrast, etc.) Are there any guidelines on how to properly style widgets so that they match _most_ websites?


Post thumbnail not displaying in correct position

I'm using the following as part of a shortcode I'm creating:               $loop = new WP_Query(array('post_type' => 'client', 'posts_per_page' => $limit, 'orderby' => $orderby));               if($loop){             $preoutput = '
';             $postoutput = '
';             while ($loop->have_posts()){                 $loop->the_post();                   $output .= '

hello
'.the_post_thumbnail();                  $output .= '

'.get_the_title().'
'.get_the_excerpt().'

';                   $finaloutput = $preoutput . $output . $postoutput;             }         }      However, the post thumbnail doesn't appear in the markup, it appears just at the top of the post - why would it do this?


Link images to post

Link images to post. Hi all I'm sure this is simple but I can't see how to do it. I know how to add images to a post - Click in the post, Add Media, choose thumbnail. This gives me an thumbnail in the post. I think what I want to do is link thumbnails to the post so I can control where the thumbnails appear on the page. I have a template like this.
             <?php                      $car_args = array(                     'post_type' => 'post',                     'category_name' => 'car',                     'order' => 'asc'                 );                      $cars = new WP_Query($car_args);                      if($cars->have_posts()):                     while($cars->have_posts()):                         $cars->the_post();             ?>

<?php the_title(); ?>
                            <?php the_content(); ?>

                      <?php endwhile; endif; ?>                 <?php wp_reset_postdata(); ?>
      I have posts about car's with category name 'car', I'm using the category name in the WP_Query. Some of these posts have images. If there are images with the post I would like to add them as a list in the aside.


Pagination customization

I am working to develop this type of pagination: ![here](http://i.stack.imgur.com/vIV5L.jpg) I am taking values and displaying them on same page and my code snippet is below and couldn't make it why it is not working.               <?php     if ($_SERVER['REQUEST_METHOD'] == 'GET')      {         global $paged;         if(empty($paged)) $paged = 1;         else { $paged = $_GET['paged']; }             if(isset($paged) && is_numeric($paged) && ($paged <= $pages) && ($paged >= 1))              //validation             {                     if($pages == '')                 {                     global $wp_query;                     $pages = $wp_query->max_num_pages;                         if(!$pages) $pages = 1;                 }                        if(1 != $pages)                 { ?>              <form action="#" method="get" >                      page                 <input type="text" name="paged" value="<?php echo $paged; ?>">                 of <?php echo $pages; ?>                 <input type="submit">              </form>                      <?php                  if($paged > 1) echo "‹ Prev Page";                 if ($paged < $pages) echo "Next Page ›";                  }             }      }       ?> Please suggest.


two columns of posts on homepage, one of them "favorites"

I'm using a child theme of Twenty Twelve in wordpress. Here's where I am developing the site: http://internalcompass.us/castle/ You'll notice the two columns of posts on the homepage. I have one labeled recent posts and one labeled favorites. In actuality, both columns are the same - recent posts organized by date. I'd like to actually create a set of posts that populate the second column, so my client can select recommended posts or her favorite posts for that column. I'd like the first column to be recent posts. I'm hearing crickets on the Wordpress Support forum, likely because this is a pretty technical q. sooooo Any info is appreciated. I'm sure I can somehow label posts and add code to the index.html to populate the second column. I just am not yet equipped with the info to know what code to add. Peace & thx


Ignoring slug capitalization on rewrite rule for custom post type archive page

I'm declaring a custom post type 'games' with a rewrite rule:               'rewrite' => array('slug' => 'Games','with_front' => false),      So the resulting url for the games archive is `<mysite>.com/Games` - This works fine. With a Game entry titled "Example", visiting `<mysite>.com/games/Example` it automatically redirects to `<mysite>.com/Games/Example` no problem. This is what I want. * * * However when visiting the archive of the `Games` type, it will not redirect if I change the capitalization:   * With the slug set to `Games` visiting `<mysite>.com/Games` works but visiting `<mysite>.com/games` will redirect to a blog post or page with 'games' in its url.   * With the slug set to `games` visiting `<mysite>.com/games` works but visiting `<mysite>.com/Games` will redirect to a blog post or page with 'games' in its url. **Notes** :   * Yes, I flush my permalink settings after changing the rewrite rules. Since the url works for the non-archive pages this is not the issue.   * I use the custom `Month and name` permalink setting.   * I do have `archive-games.php` defined and working in my theme directory. * * * Is there a way of ensuring that any case variation of 'games' links to the archive, and not some random blog post? In other words, is it possible to tell wordpress to ignore the capitalization and always redirect to `<mysite>.com/Games` even if the user enters `<mysite>.com/gAMeS`? I just want it to be convenient for users that happen to type the url in manually and forget to capitalize it. I could change the slug to lower case 'games' by default, but then   1. It doesn't look as nice   2. Again, if a user types "Games" with caps, They are linked to a seemingly random page.


Restrict access to certain dashboard pages based on user id

I have a client who want's to be given admin access to the dashboard of the test installation of her website on my server. She hasn't paid me yet so I don't want her to be able to go into the themes menu, copy the theme code and run off without paying. So, is there a way that I can give her admin access while also blocking her from viewing the Appearance > Editor menu?


register and insert category manually

I am registering custom taxonomies ....               <?php     add_action( 'init', 'create_book_tax' );          function create_book_tax() {         register_taxonomy(             'genre',             'product',             array(                 'label' => __( 'Genre' ),                 'rewrite' => array( 'slug' => 'genre' ),                 'hierarchical' => true,             )         );          ?>      It is successfully creating Taxonomy of **Genre** under **Product** Post type. Now I want to manually add categories inside **Genre** and it will also be heirarchical so I can again insert new category inside newly created category. Please tell me how to manually create category.