title: Highlighting the current page in a navigation menu which links are generated with a custom loop?

text:
This is a second navigation menu I'm using:
             <?php $custom_posts = new WP_Query(); ?>             <?php $custom_posts->query('post_type=bbp_forum'); ?>             <?php while ($custom_posts->have_posts()) : $custom_posts->the_post(); ?>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
             <?php endwhile; ?>
      Is a custom loop which list a custom post type called Forum. I would like to highlight the current Forum link, like this: ![enter image description here](http://i.stack.imgur.com/ryBto.png) Any suggestions?


title: Next Page & Previous Page links - skipping a single page - how?

text: On my Wordpress webpage, I have several Pages. Now I want to display "Next Page" & "Previous Page" links. I know that there are several ways out there to do this, but they all fail because I want to skip one page using this link system. The existing Wordpress functions for this can exclude pages, but if the next page is the page that should be excluded, no link is displayed. I need a solution to just skip the excluded page. As my English isn't best, here is an example of what I need:   The current page id is 3.   The page I want to exclude has page id 4.   So the "Next page" link should point to page id 5, the "Previous page" link to page id 2. How is this possible? I Actually tried this by myself and was able to get the ID of the next page using `get_pages` and some PHP functions, but I failed to exclude the page. If needed I can post the code for that. Please help me!


title: Saving category to a post, before publishing the post

text: I have created a link from the dashboard, which goes to add new post, but with a category already selected for the post - but the post will not belong to this category before publishing - this is a problem, because I have some custom fields, which I have assigned to the category, and they will not be visible before the post is published. Is there a way to asign a category to a post, before it is published, which will make what I am trying to achieve possible?


title: Large image upload size (using timthumb.php

text: I seem to be having this issue with all of the images on my site. First I optimise a .jpg in Photoshop to approx 100k (it's a large header image), then I upload through Wordpress' media uploader as a Featured Image. Here's the code I use to output the image in my template file:               <?php if (has_post_thumbnail( $post->ID )): ?>                 <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); ?>                 <img src="<?php bloginfo('template_directory'); ?>/thumbs.php?src=<?php echo $image[0]; ?>&w=660&h=246&zc=1" alt="<?php the_title(); ?>" />             <?php endif; ?>      **Problem:** When I view the image in the browser, it seems to have a file size of approx 900k. 9 times the size of the original file! What is causing this increase in file size after uploading through Wordpress? Is it WP's media uploader or the timthumb.php script?


title: Creating a job board using WordPress (for free)?

text: I found several plugins/themes for creating a job board with WordPress, but only one solution which is free (see here) Are there any other **free** solutions for doing that? Thanks.


title: How do I pass variables into short-code enabled Post Snippets in Wordpress 3.0?

text: I am using a plugin called Post Snippets. According to the documentation, it can substitute variables, such as {url} within the snippets. http://wordpress.org/extend/plugins/post-snippets/ I am unclear how to assign values from within a specific post to a variable. I tried using exec-PHP, and used the following:               [exec]url = "domain.com";[/exec]      But the snippet registered no value for {url}. **How can I assign, from within a post, the value to a variable so that I can use it as described?**


title: Where do files uploaded via Media Manager get stored in MU?

text: Standard WordPress sites, at least of the versions of WP I've tested, store files uploaded via the Media Manager under wp-content/uploads/ Where do these same files get stored in MU sites and how can you obtain a reference to this folder via script from functions.php? Is the location different depending on which version of WP or WPMU is installed?


title: Replace Gravatar with UserPhoto in All Users Coulmn view

text: I am using the UserPhoto plugin which allows users to upload a photo which can be used in many ways. (It's awesome) But I would also like when the admins look at the list of users the column displays this users photo instead of the Gravatar. Is there a hook? I'm a little closer...               function change_user_avatar_col( $column ) {         $column['avatar'] = 'avatar';              return $column;     }     add_filter( 'manage_users_columns', 'change_user_avatar_col' );          function change_user_avatar( $val, $column_name, $user_id ) {         $user = get_userdata( $user_id );              switch ($column_name) {             case 'avatar' :                 return userphoto_thumbnail($user);                 break;                  default:         }         return $return;     }      add_filter( 'manage_users_custom_column', 'change_user_avatar', 10, 3 );      I am getting the images but they they are not in the column, plus I really want to replace the current gravatars and this is creating an additional column. I tried changing out the "avatar" to "Username" for the column but no success.


title: Override default url for author pages?

text: So the default url to display a list of posts by a particular author looks like this: `http://domain.com/author/{username}` I am wondering how to change the 'author' in that url to something else? I am working on a website for a charter school and they would like to allow each teacher to have a list of posts by "classroom". So the desired url would be `http://domain.com/classroom/{username}`


title: Print all inline styles to head

text: Currently working on a project here http://palanquin.shrimp-works.com. When I try to validate what I have done so far, using http://validator.w3.org/, I get lots of this error **_Element style not allowed as child of element div in this context. (Suppressing further errors from this subtree.)_** , which basically means there is a div which is printing it's styles to the body tag of my document. This means simple styles like background color, text color, etc are all being printed in the body tag of the html, ruining any chance of html5 validation. Is there a wordpress filter that can print all **_style tags_** from the text editor or tinymce to the head instead of to the body? I know how to enqueue inline styles in functions.php. I don't think that's what I need here. Any ideas?


title: Ajax requests without JQuery

text: I want to make Ajax requests without JQuery, and without including `wp_load.php`. I want to use a vanilla `XmlHttpRequest` object that I write myself. Any links, hints, done-it-befores, etc?


title: View category in the preview of Theme Customizer

text: I am building a theme which Theme customizer changes colors, sizes, etc. and has also the option to choose a category and style that category specifically. How can I display that category in the preview (only when the user is changing the corresponding options) instead of the default home/front page displayed by default? **EDIT** I can access the preview window with customize_preview_init, but I can not apply wp_redirect, which I guess could be a way.


title: Permissions in a Local Dev Environment (OS X)

text: I wanted to enable WordPress auto-updates to work without FTP, so I added: `define('FS_METHOD', 'direct');` to my `wp-config.php`. So in order to grant write privileges to WordPress's auto-updater, I ran `chown -R _www:_www [wordpress-project-folder]`. I'm using _www instead of www-data, because I read that it's OS X's equivalent. However, now anytime I modify a file with a Text Editor or commit changes with git within that wordpress folder, I need to `sudo`, which is slowing me down. Is there a happy medium?


title: Images sizes generated smaller than specified

text: So I have an image that's `1536x2048` and I've set up an image size that would hard crop to `460x600` with:               add_image_size( 'hard-edge', 460, 600, true );      When this is actually output, I get a file size of `450x600`. That ain't right. There's more than enough room for a hard crop to get the exact size, so what I am not understanding about the way it's cropping?


title: Partially translated dashboard in one of network's site

text: I have multisite WordPress installation with default language for all new sites set to English. For one of my sites I wanted to add support for different (Polish) language. I copied all Polish *.mo files I found in Polish installation of WordPress. After switching to that language that one site only, I noticed that not only frontend, but also dashboard has been translated into Polish. Because that was unwanted effect, I deleted all *.mo files from languages directory, except for pl_PL.mo. Especially I removed *.mo files for admin and network admin. Even though I did it, I can see right now, that my Dashboard for this site is partially translated into Polish. Only certain strings (dashboard sections, frames, buttons) are translated, other remains in English. What is going on? Form where this partial translation comes out? I only left pl_PL.mo file, which (as I understand) purely for frontend translation and does not changes anything it dashboard. This case goes for my test blog (network's site), so I can use ultimate solution -- that is, delete whole site and re-create it again. But even though, I'm pretty curious, what has happened, and what to do, if similar problem appear in the future for one of my production blogs?


title: Upcoming Event: How do I sort database by custom date field, but ignore past dates?

text: I am using an events plugin and struggling to get my database query to be perfect. The query is on the event-single.php template. What I need the query to do:   * Query the "events" custom post type for upcoming events   * Sort by `_event_start_date` meta_key to show earliest date (nearest event)   * Not display PAST events   * If "current event", show next nearest event Here's my current $args.               <?php $args = array(         'post__not_in' => array($donotrepeat),         "post_type" => 'event',         'meta_key' => '_event_start_date', // name of custom field         'orderby' => 'meta_value_num',         "order" => 'ASC',         "posts_per_page" => 1        );     ?>      Defining `$donotrepeat` earlier               $donotrepeat = get_the_ID();      So far, the query successfully   * Queries custom post type   * Ignores the "current" event   * Sorts by earliest date. I cannot figure out how to ignore 'past' dates though. There is another meta key 'scope' created by this plugin that contains values like 'past' and 'future' - so that could be promising. I've tried using meta_query to sort through the past date issue, but I just can't seem to get it to work. I think this is probably the way to go, but I'm open to other ideas. I'm sure this isn't THAT difficult... can anyone help?


title: WP e-commerce: getting products by SKU

text: I'm working on a site that uses the WP e-commerce plugin (Gold version) and I need to display a list of products that match a list of SKUs. Users fill in a form, and a list of product SKUs is generated depending on their answers. I need to create a page that fetches these products and displays them, preferably in the default grid view/list view style. Any ideas how to do this? Looking through the documentation, I was expecting a "get_products()" function that could take the SKU as an argument, but there doesn't seem to be anything like that. How could I go about doing this? Thanks a lot, Will


title: How to best delete orphan wp_postmeta

text: I'm in the middle of doing some fairly complex queries involving metadata from a custom post type. Unfortunately if any posts are deleted the metadata stays put which complicates matters as I am counting it. I was wondering how best to go about deleting the orphan metadata in the event that the post is deleted. Should I include a function that deletes them the database through $wpdb? I found an SQL query that does just that but I'm not sure how to format it.               DELETE pm     FROM wp_postmeta pm     LEFT JOIN wp_posts wp ON wp.ID = pm.post_id     WHERE wp.ID IS NULL      I tried it in phpmyadmin on a backup copy of my database but to no avail.


title: Comments appear in wrong posts

text: Nasty problem here! Comments are not connected to the right posts but to other ones! Passing from disquss to jetpack comments doesnt't fix this. What could be the solution? The site is http://www.zonasismica.sism.org/ Thanks! UPGRADE! Seems like disqus is the problem... My team use to publish posts in chunks. It seems that diqus cannot distinguish between posts when their pub time are too close. All the posts in one chunk show the same comments. Check zonasismica.sism.org/~ ~- lincaricato-locale-tra-deriva-dittatoriale-e-leader- democratico-problematiche-dilemmi-e-psicodrammi-di-un-il - do-you-know- climate-change - calcutta-village-project-e-noi-dove-siamo - i-cinque-segreti- dellarea-scopescore If I turn off diqus, the posts again appear in one post only, but of course not were wanted to see them!


title: How to check if searchform.php is being included as widget?

text: I'd like to put something like this in searchform.php:               <?php if($widget){ ?>         //load serach form for sidebar...     <?php }else{ ?>         //load different search form for page content (404 page)     <?php } ?>      How can I prepare `$widget` variable? Or maybe I should use another method? Like filter? Or get template part?


title: How to reset the plugins without deactivate the plugin

text: function set_copyright_options() {         delete_option('ptechsolcopy_notice');         delete_option('ptechsolcopy_reserved');              add_option('ptechsolcopy_notice','Copyright ©');         add_option('ptechsolcopy_reserved','All Rights Reserved');          }     register_activation_hook(__FILE__, 'set_copyright_options');      Hi I use the code to make it plugin default while deactivate and activate plugin .But i need the options to make it using the reset button in the admin side to make it default without deactivate the plugin ?


title: What are all the available parameters for query_posts?

text: The WordPress codex page for query_posts states that it does not cover all the parameters which query_posts takes: > ## Parameters > > This is not an exhaustive list yet. It is meant to show some of the more > common things possible with setting your own queries I couldn't find a reference of all the parameters which are accepted by query_posts, though, even in just a simple list form. Is there a cheat-sheet or something similar available with this data?


title: list or get meta_key where meta_value is 'something'

text: I'm trying to get with               get_user_meta      the meta_key where the meta_value is `'ive-read-this'` But I do not get the value. What should I do?


title: How can I delete orphan keys in WordPress database tables?

text: In particular in table `wp_options`. After almost 2 years of blog production it seems increased a lot, and I don't know how many crap is in there. Do you know a plugin that works with WordPress 3.0 or safe query to run to search orphan keys/rows?


title: WP_Query of Category Not Showing First Post

text:
I have the following loop, and only this loop, in my `home.php` file (apologies if I didn't paste the code properly). I have populated lorem ipsum posts, and noticed that of the five posts only four show up on the page. Any insights would be greatly appreciated.
               <?php          // the query         $the_query = new WP_Query( 'category_name=news'); ?>                       <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>              <div itemprop="blogPost" id="post-<?php the_ID(); ?>" <?php post_class('snippet') ?>>                   <a itemprop="url" href="<?php the_permalink(); ?>" class="permalink">
<?php the_title(); ?>

<?php the_time('j M Y') ?>

<?php the_tags( '', ', ', '' ); ?>

                  <?php the_excerpt(); ?>

               <?php endwhile; ?>

         <?php posts_nav_link( ' ', '', '' ); ?>
              <?php else : ?>

There are currently no news updates.

              <?php endif; ?>         <?php wp_reset_query(); ?>


title: Plugin for single language localisation

text: I have found dozens of plugins which helps you to translate a Wordpress website into different languages. However, I cannot find anything that would help me localise Wordpress for different regions, all of which would still be using English language. Let me explain. I have a website which serves MOSTLY the same content for several different regions (e.g. NYC, LA & Chicago). While page structure for each region is identical, some small bits are different between different regions. For example contact us page will have different phone number based on the region. What I would like to do is be able to set default content & custom fields for each page, however be able to overwrite whatever I need for regional versions of each page. For example: http://example.com/nyc/contact and http://example.com/la/contact would be mostly identical, apart from the bits which are set manually. There are several plugins which allow doing just that but they are very much focused on multilingual websites and so come with loads of bloat and are not very convenient (especially when you have to pass them over to less technical colleagues or clients). Example of multilingual plugin


title: How to create a template for a custom URI associated with the user

text: I am working on a site where I am using a plugin called Favorite Posts so logged-in users can add a post (a custom post type) to their favorites. I created a page called `my-favorites` which allows the logged-in user to see the posts he has favorited. Now I need to create a page which allows the another user or visitor to check this user's favorites. So I need to be able to do three things:   1. Get a function related to author that returns a link like `example.com/user/username` which I can append to /favorites to get the link - `example.com/user/username/favorites` (`the_author_link()` and `get_the_author()` link seems to link to the website and `the_author_posts_url()` outputs the a tag with the name. any function to just get the url or maybe modify author to show user instead?)   2. Get WordPress to use a template called `favorites.php` to display this page. (If the structure matches, then how do I tell WordPress which template to use?)   3. Get the user id of the user in order to show his/her favorites to the visitor. Right now, I use the `[favorite-post]` shortcode in my template file and can pass a parameter called               [favorite-post user_id = ""]      Will it automatically get the user id if the page is branched out from /author? I found this article but it still deals with custom post types and `query_vars` which I am not using. How do I make it work for the favorites page? Most other similar questions asked here were solved using a slug for the custom post type or taxonomy.


title: How to migrate subsite from dev multisite to production multisite

text: I'm looking for the best and most secure way to develop locally a numbers of subsite using multisite and moving them to the production environment when they are ready. I've already migrated the full multisite install with the first subsite which is now live. I would prefer to develop the other sites on the local server so I leave the production server alone but obviously I can't do a full migration again. I looked for a solution but everything I found is about moving a single site to a multisite or the other way around, no "move subsite from multisite to multisite". I would like to keep everything: settings, widgets and so on.


title: Can't add options to db

text:
I'm trying to create a really simple options page for my wordpress site that just contains one option - a conversion rate for a currency. I have the following code:               add_action('admin_init', 'currency_options_set');     add_action( 'admin_menu', 'admin_menu' );          function admin_menu () {         add_options_page( 'Currency Options','Currency Options','manage_options','options_currency', 'settings_page' );     }          function currency_options_set(){         register_setting( 'currency_options_group', 'currency_options' );     }          function  settings_page () {              $default_options = array( 'currency_eur' => "1.1" );         $options = get_option('currency_options', $default_options);         ?>         <form method="post" action="options.php">         <?php                  settings_fields("currency_options_group"); ?>

                     EUR:	                                              <input type="text" name="currency_options_group[currency_eur]" size="40" value="<?php echo stripslashes($options["currency_eur"]); ?>" />

                 <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
         </form>     <?php     }      The new options page shows and I can see the form but when I submit it, no options are saved to the wp_options table. What am I missing here?


title: How do I Redirect Tags from Old Joomla Site to New WordPress Site?

text: I've recently converted a site from Joomla to WordPress. I'm down to polishing up the old Joomla site links that don't match the WordPress structure, and I've run into a problem where I need some help: tags. The Joomla site had close to 500 tags, and all the tags were indexed in Google and other search engines. The Joomla tags links have a structure like               "http://example.com/components/tag/apples.html"       and               "http://example.com/tags/apples.html"       while the WP site tag links look like               "http://example.com/tag/apples/".      What I really would like to do is have a 301 redirect that points all the old Joomla tags to their equivalents on the new WP site instead of doing several hundred htaccess entries, one for each tag ("Redirect 301 http://example.com/components/tag/apples.html http://example.com/tag/apples/" works). The tags themselves are the same on both sites, so it's not a matter of renaming tags or getting tags with different names to match up. But I can't figure out how to make the redirect work. I've tried doing things like               "Redirect 301 http://example.com/components/tag/*.html http://example.com/tag/"      or               "Redirect 301 http://example.com/components/tag/*.html http://example.com/tag/*/"      or               http://example.com/tag/*/       or               http://example.com/tag/?/       for the redirect target. None of those work. Quite frankly I don't know my way around regex very well, so my trying to find a solution would be mostly an Easter egg hunt where there may or may not even be any Easter eggs. So I'm hoping someone on the WP forum will be able to help me out or point me to a solution. Thanks for any help, Susan


title: WP_Customize_Image_Control generating error when used

text: I'm adding some customisation controls for my theme, but I've hit a snag with the `WP_Customize_Image_Control` class. The control is showing, but whenever I try and upload an image I receive the following error - > TypeError: a.settings.data is undefined (`load-scripts.php`, line 2) Has anyone come accross this before, and more crucially, can anyone tell me what I need to do to fix this? Thanks.               add_action('customize_register', 'register_costomisation_controls');      function register_costomisation_controls($wp_customize){              $wp_customize->add_section('header_section' , array(             'title'     => __('Header', 'dd_theme'),             'priority'  => 1000         ));              $wp_customize->add_setting('header_image' ,array(             'default'   => '',             'transport' => 'refresh'         ));              $wp_customize->add_control(             new WP_Customize_Image_Control(                 $wp_customize,                 'header_image',                 array(                     'label'     => __('Logo', 'dd_theme'),                     'section'   => 'header_section',                     'settings'  => 'header_image',                 )             )         );          }


title: Update user from external script

text: I am using the API code of WordPress to update some fields of user profiles but I am having some problems. When I try to save information, it is not updating unless I click twice. For example for user called user3465 **For example :**               $user=get_user_by('login',"user3465");     wp_set_password(''.$new_password.'',$user->ID);     update_user_meta($user->ID, 'user_email', "".$new_email."" );      I launch form and load new data in database, but I must launch another time, to see the data change. Why is this ?


title: What is the best way to insert links indepently of the permalink structure?

text: ... or is there a way to insert links similarly to Drupal with pathauto, that is: I want to set links in html like this:               ?p=123      and Wordpress to process at runtime it and display the pretty url               /page/title      Also I don't like the idea of putting full url's as the website can run on several server (at least during dev time)


title: How come I see a manage_categories capability but not a manage_tags capability for any users?

text: Using plugins like "Members" or "Capability Manager", I don't see any such `manage_tags` capability. Shouldn't there be one like there is `manage_categories`? EDIT: I think I figured it out. manage_terms is for all taxonomies. There isn't one specifically for tags, but I could create one if I so desire. This could allow me to set up a role that can edit only categories, but not tags, and vice versa. NOTE: I got rated down. If you rate me down, _please state why_. Thanks.


title: How to get the meta title of a page configured as blog (loop)

text: I'm using a function to print the titles for every type of content. I also configured a new metabox in the posts and pages to enter the title tag. This is part of the function to print the titles:               //...     elseif (is_page() || is_single()) { //Page and Post Title         global $post;         $metatitle = get_post_meta($post->ID, 'metatitle_value_key', true);         if ($metatitle) {             echo stripslashes($metatitle);         } else {             the_title();         }     }     //...     else { wp_title(''); }      It works perfect for posts and pages, except when I select a static home page and the blog page (it's a blank page created previously). Thanks to the last `else` it prints the normal title of the page 'Blog', but it doesn't print the metabox with the metatitle 'My metatitle box'. I thought it was 'cause of the post ID, so I separeted `is_page()` and `is_post()` trying to get the page ID out of the loop, with this code `$page_id = get_queried_object_id();` but this one didn't work for me. The following code is what I have:               //...     elseif (is_page()) { //Page Title         global $post;         $page_id = get_queried_object_id();         $metatitle = get_post_meta($page_id, 'metatitle_value_key', true);         if ($metatitle) {             echo stripslashes($metatitle);         } else {             the_title();         }     } //...      What can I try to do that? Probably the problem is due to the way to insert the metabox, it uses `$post_id` every time. Anyway I'm not sure, 'cause it works for both: posts and pages.


title: How safe is renovating $wp_query when doing WP_Query pagination in Page Template

text: With a lot of search and trial&error, I's unable to do the pagination in a custom page template. I's not actually tired, but frustrated, why the most common err issue is not explained in a way so that somebody can dig into the actual problem. In most of the Q&A, there's a solution with a bulk of code, that's not a bullet-proof solution at all. There are lots of philosophy, but there's no actual digging into the solution. Eventually I came across to Chris' solution to the pagination of a Custom Post Type. I'm not dealing with CPT, but the solution worked for me. Where, my Query arguments are:               $wp_query->query('posts_per_page=3&post_type=post&order=DESC&orderby=date&post_status=publish'.'&paged='.$paged);      Except that portion everything is as followed as Chris stated. My pagination is working nicely. But I'm actually concern about some issues:   1. First, what's the code actually doing?   2. I _think_ it's now taking more time (performance issue) than the default solution -- is that _actually_ right?   3. Is that safe messing with the global `$wp_query`?


title: How can I implement faceted search with Wordpress 3.x?

text: I would like to allow visitors to a site to search for posts based on various attributes (categories, tags, custom fields). I have tried using Solr, but this doesn't appear to work. I tried using the MySolrServer plugins for a local instance of Solr and a hosted instance, but the plugin doesn't appear to work. I also tried using Solr for Wordpress, but the plugin wouldn't enable. I don't want to use something like Taxonomy Drill-down. Bearing those points in mind, how can I now try to implement true faceted search that will enable site visitors to search for posts based on attributes?


title: Plugin allowing users to add articles to a library

text: We are currently redesigning our site (currently on Joomla) to a new Wordpress platform and I'm concerned I'm going to lose an important feature. I have a membership based site and one of the features I wish to provide is for members to be able to maintain their own library of favourite articles from our article list. We have over 1000 articles online so this feature would allow members to save their favourites for easy access. I've tried looking for document and library plugins but can't seem to find anything appropriate. Does anyone know of a plugin that would do this effectively? Any other ideas?? Thanks so much for your time.


title: What exactly is "wordpress theming"?

text: When a book says that it is all about wordpress theming, what does it mean?


title: orderby ignored by wp_query

text: With the following code, I do not get the result set ordered by titles. No matter what values I give to 'orderby' and 'order', I get the same ordering. The parameters seem to be ignored (or overridden?) by something else.. Any idea how I troubleshoot this one? Is there a specific filter I should be looking at, that some plugin could be overriding this via? Should the code below work out of the box? IF it looks correct, something must be interfering.               $args = Array(         'post_type' => 'post'         'category_name' => 'reviews'         'posts_per_page' => '999'         'orderby' => 'title'         'order"' => 'ASC'         'post_status' => 'publish'     )          $customloop = new WP_Query();     $customloop->query($args);          while ($customloop->have_posts()) { ... }


title: Wordpress monthly archive links result in 404

text: When I use the archive widget in a sidebar, it creates the normal monthly post archive listing like the following:   * February 2014   * January 2014   * October 2013 and so on. Whenever I click on these links, I get a 404 page. The urls generated by the archive widget for monthly listings are in this format: > www.mysite.com/pedestrian/2014/02/ However, manually entering the following url style works: > www.mysite.com/pedestrian/?post_type=news&year=2014&monthnum=02 This shows exactly what I would expect to see (all the posts from February 2014). I believe that the following code will fix my issue, but I am at a loss as to where to put it.               // Add day archive (and pagination)     add_rewrite_rule("pedestrian/([0-9]{4})/([0-9]{2})/([0-9]{2})/page/?([0-9]{1,})/?",'index.php?post_type=news&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]','top');     add_rewrite_rule("pedestrian/([0-9]{4})/([0-9]{2})/([0-9]{2})/?",'index.php?post_type=news&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]','top');          // Add month archive (and pagination)     add_rewrite_rule("pedestrian/([0-9]{4})/([0-9]{2})/page/?([0-9]{1,})/?",'index.php?post_type=news&year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]','top');     add_rewrite_rule("pedestrian/([0-9]{4})/([0-9]{2})/?",'index.php?post_type=news&year=$matches[1]&monthnum=$matches[2]','top');          // Add year archive (and pagination)     add_rewrite_rule("pedestrian/([0-9]{4})/page/?([0-9]{1,})/?",'index.php?post_type=news&year=$matches[1]&paged=$matches[2]','top');     add_rewrite_rule("pedestrian/([0-9]{4})/?",'index.php?post_type=news&year=$matches[1]','top');      So, am i on the right track and if so where do i put this code? Thanks!


title: How to remove admin menu pages inserted by plugins?

text: I've got the following code, which cleans up a lot of stuff that is not going to be used within the admin area:               add_action( 'admin_menu', 'my_remove_menu_pages' );          function my_remove_menu_pages() {       remove_menu_page( 'edit.php' );                   //Posts       remove_menu_page( 'upload.php' );                 //Media       remove_menu_page( 'edit-comments.php' );          //Comments       remove_menu_page( 'themes.php' );                 //Appearance       remove_menu_page( 'users.php' );                  //Users       remove_menu_page( 'tools.php' );                  //Tools       remove_menu_page( 'options-general.php' );        //Settings          };      However, there are two menu items that have been inserted from plugins. When I hover over each menu item, it says the links are:               /wp-admin/edit.php?post_type=acf     /wp-admin/admin.php?page=wpcf7      Is there a way to hide these menu pages, too?


title: Cannot override hooks.php

text: I building a child theme for 'Responsive Theme' from Cyberchimps. I would like to change one hook. So I guess I need hooks.php file in my child theme. So I copied it from the parent. I made the same hierarchy (I guess this is the right approach).               wp-content/[my_child_theme]/core/includes/hooks.php      Copying file to theme root didn't help. I also tried to just recreate this critical hook. I put the code in my child functions.php file, but It's also not working, because hooks happen after the theme stuff (just my asumtion). So the question is simple: how to override parent theme's hook.php file?


title: Is there a PHP function that can match anything after the given URL, so my IF statement will work in each instance?

text: I have an IF statement shown below that runs one of 2 custom queries, based on the url. The problem I'm facing is if the url contains pagination such as `/page/2/`, my query breaks because the url isn't correctly matched. I'm very new to php and in my searching I've come across a few different php functions that may help my situation - I'm just unsure of how to use them and which is more efficient for my needs. These are `preg_match`, `parse_url`, and `dirname`. For example, `site.com/players` lists the players and `site.com/players/type/pro` lists the pro players. The latter has been rewritten and is actually `site.com/players/?type=pro`. The following if statement is what I have now and will not run the first query if the url has anything after the /pros/ segment, such as pagination in my case:               if ( $_SERVER['REQUEST_URI'] == '/players/type/pros/' ) {          //run the query to list the pros     }          else {         //run the default query for the players     }      Here's what I need to do, which works, but without all the manual labour of writing an OR for every single page. This is where I'm guessing one of those php functions would come into play.               if ( $_SERVER['REQUEST_URI'] == '/players/type/pros/' || $_SERVER['REQUEST_URI'] == '/players/type/pros/page/2/' || $_SERVER['REQUEST_URI'] == '/players/type/pros/page/3/' || $_SERVER['REQUEST_URI'] == '/players/type/pros/page/4/' ) {          //run the query to list the pros     }          else {         //run the default query for the players     }      **Update** Thanks to those who answered. I've been digging into WordPress' rewriting and with the help of some very informative posts on this site I ended up doing it this way.   1. Made a new page template called player-types.php which would handle the incoming query or queries. I may need to further list players by other types.   2. Setup some rewrite rules placed in functions.php              add_filter('init', 'add_page_rewrite_rules');     function add_page_rewrite_rules() {         //would match www.site.com/players/type/pro             add_rewrite_rule('^players/type/([^/]*)/?$','index.php?pagename=player-types&type=$matches[1]','top');           //would match www.site.com/players/type/pro/page/2             add_rewrite_rule('^players/type/([^/]*)/page/([0-9]+)?$','index.php?pagename=player-types&type=$matches[1]&paged=$matches[2]','top');            }        3. Added the `type` variable to `query_vars` so I could use it on the new page template (placed in functions.php)              add_filter( 'query_vars', 'add_query_vars' );     function add_query_vars( $query_vars ) {         $query_vars[] = 'type'; //add type to query vars         return $query_vars;     }        4. And the page template in it's most basic form looks like this              <?php /* Template Name: Player Types */ ?>          <?php if ( $wp_query->query_vars['type'] == 'pro' ) {         //custom pro query     } ?>      This allows me to have `www.site.com/players/type/pro` and I can expand on it to `www.site.com/players/type/whatever-else`. Normal players are still listed at `www.site.com/players/`. And for those who are wondering, I didn't do it with a taxonomy because I'm listing the players based on their custom WordPress role ( pulling the author id's into the query) rather than having a check box that someone has to manually check.


title: Excerpts automatically remove paragraph space

text: I use excerpts of posts in my front page. In my excerpt, the summary of the post seems to be clumped together with no spaces that are indicated in the post (e.g., paragraph spaces are automatically removed). I understand this is the default behavior. Question: Is there a way to retain the paragraph in excerpts? To show excerpt on the fron page in my Twenty Ten theme's loop.php I changed this (around line #137:               <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>      with this:               <?php if ( is_home() || is_front_page() || is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>      thanks.


title: How do I insert JS tracking code to a page with the WP editor?

text: My client needs to add unique blocks of javascript to certain pages in order to track visitors. How do I go about doing this? At first I tried to use a custom field but the field stripped out everything before outputting it to the page so I got an empty result. Then I installed an Advanced Custom Fields extension that allows you to add code to your page and then call it on the template but it put the code within script tags which breaks the tracking code. So I'm at a bit of a loss right now.


title: Specific way to allow Wordpress users to view their current password? And edit it?

text: I know the built in user manager doesn't allow a user to see what her current pass is, just recover / reset it via email or write in a new one in the admin but I am looking for a plugin or other method to circumvent this and allows for the creation of a user profile page that permits a user to see her current password in a field and update it form there, if they wish. I realize standard Wordpress won't allow this so I am open to a plugin like s2member -- or any other -- but not sure if any of them do this. I use Amember on one site and it integrates with WordPress via a plugin and you may edit and view passwords in Amember in the way I mentioned but I can't host Amember on a host like WPENGINE with additional security stringency. Thanks.


title: How to remove a meta description or other <head> contents

text: I have a plugin that generates a meta description or title as two of its features. However I run into the problem of other SEO plugins possibly being installed, and ending up with two meta descriptions or duplicate titles. Ideally, I'd like to detect what is already in the `<head>` section and if a meta description is present, re-write it with the output from my plugin. If no meta description is present, then I simply add one (that's the easy part). Same situation for titles. Trouble is I can't seem to find any way to get the contents of `<head>`, as one can with `the_content` in a filter or action hook. It's not an option to edit the theme as this must work regardless of the installed theme. I need a way to accomplish this using a hook or some other method from within my plugin itself. Suggestions? Thanks!


title: Catch all taxonomy template

text: I've created a custom taxonomy and I'm trying to get Wordpress to display the taxonomy template when no term is defined. Currently Wordpress is only showing the template when a term is defined on the URL. My taxonomy is called `projects` and defined like this:               $args = array(         'labels' => array(             'name' => "Categories",             'singular_name' => "Category",             'search_items' => "Search Categories",             'popular_items' => "Popular Categories",             'all_items' => "All Categories",             'parent_item' => "Parent Category",             'parent_item_colon' => "Parent Category:",             'edit_item' => "Edit Category",             'update_item' => "Update Category",             'add_new_item' => "Add New Category",             'new_item_name' => "New Category Name",         ),         'hierarchical' => TRUE,         'label' => 'Categories',         'query_var' => TRUE,         'rewrite' => array(                 'slug' => 'projects'         ),     );          register_taxonomy('projects', 'project', $args);      Next to this I have created a template file called `taxonomy-projects.php`. Currently when I browse to the `http://mysite.com/projects` URL, Wordpress falls back to the `index.php`. How can I make it so that when no term is defined, Wordpress shows my `taxonomy-projects.php` template? **UPDATE** : I should have added this straight away, I'm clearing my rewrite rules each time I make a change to try again.


title: Parent/Child pages

text: I find that the parent/child pages in the "Pages" area of WordPress has become a bit confusing since the introduction of the new menu creation area. Using the new menu system, as far as I know I can set a page which is actually itself a child page (in the pages section) to be a parent of a page which is actually itself a parent. Can someone tell me, is the whole parent/child pages scenario now superseded by the new menu system, and unless we plan on using wp_list_pages in the theme should we avoid having child pages altogether and instead just decide where they go in the menu area. What is normaly done on a site that doesn't use wp_list_pages ?


title: Offset for Loop

text:
I want to have an offset of 4 posts for my related posts. I'm using Flowplayer's jQuery Tools Scrollable, so I want people to be able to scroll through the 4 latest posts, then the next 4 posts etc. I tried something like that, but I keep getting error messages:
Related Posts

                                                             <?php          $backup = $post;         $tags = wp_get_post_tags($post->ID);         if ($tags) {         $tag_ids = array();         foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;             $args = array(         'tag__in' => $tag_ids,         'post__not_in' => array($post->ID),         'posts_per_page'=> 12     );     $my_query = new WP_Query( $args );     if( $my_query->have_posts() ):     ?>
         <?php         while ( $my_query->have_posts() ) : $my_query->the_post(); ?>         <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail(array(120,80)); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

     // if this is not the last post             // and remainder of current post plus one then divided by four is zero             // close the container and open a new one           <?php  if( $my_query->current_post != ( $my_query->post_count - 1 ) && ( ( $my_query->current_post + 1 ) % 4 ) == 0 ):                 ?>

                 <?php             endif;              endwhile;         ?>
             <?php     endif; ?>              <?php         $post = $backup;         wp_reset_query(); ?>

                            <?php comments_template(); ?>

             <?php endwhile; else: ?>
Sorry, but you are looking for something that isn't here.
              <?php endif; ?>      The error I get is the following: > Parse error: syntax error, unexpected T_ENDWHILE in > /hermes/bosweb25a/b155/ipg.zoomingjapancom/wp-content/themes/alltuts- > child/single.php on line 165 Line 165:               <?php endwhile; else: ?>      **EDIT:** This is my original setup without the offset (just the same loop twice). This works fine without any errors:
Related Posts

                                                            <?php                                  $backup = $post;                                 $tags = wp_get_post_tags($post->ID);                                 if ($tags) {                                     $tag_ids = array();                                     foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;                                          $args=array(                                         'tag__in' => $tag_ids,                                         'post__not_in' => array($post->ID),                                         'showposts'=>4, // Number of related posts that will be shown.                                         'caller_get_posts'=>1                                     );                                     $my_query = new wp_query($args);                                     if( $my_query->have_posts() ) {                                         while ($my_query->have_posts()) {                                             $my_query->the_post();                                         ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail(array(120,80)); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

                                         <?php                                         }                                         echo '';                                     }                                 }                                 $post = $backup;                                 wp_reset_query();                                  ?>

                                              <?php                                  $backup = $post;                                 $tags = wp_get_post_tags($post->ID);                                 if ($tags) {                                     $tag_ids = array();                                     foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;                                          $args=array(                                         'tag__in' => $tag_ids,                                         'post__not_in' => array($post->ID),                                         'showposts'=>4, // Number of related posts that will be shown.                                         'caller_get_posts'=>1                                     );                                     $my_query = new wp_query($args);                                     if( $my_query->have_posts() ) {                                         while ($my_query->have_posts()) {                                             $my_query->the_post();                                         ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail(array(120,80)); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

                                         <?php                                         }                                         echo '';                                     }                                 }                                 $post = $backup;                                 wp_reset_query();                                  ?>
      Here's the whole single.php: http://pastebin.com/x2mbQUFM I cannot seem to spot the mistake and hope somebody can help me out here. Thanks a lot in advance!


title: Got a problem with a widget

text: i am trying to build a widget that would display a list of top authors on sidebar.. This is not my first widget but it is my second one so my apologies if i am way off.. The problem is that when i drag the widget into the side (in admin ofcourse) and saves it apears no where..later when i check i see after refreshing the widgets page it doesent apear to exist.. **here is my widget code:** --> http://pastebin.com/Hf4xTUHG i know it rather langthy but can anyone help / give an idea as to why this is happening?


title: Buddypress integration with wordpress

text: I needed some directions to work on my problem. I would like to have buddypress installed on my site so that every user is able to see a link blog on his/her profile thorugh which they can post their own blog post. Is this something doable with wordpress and buddypress? Any help is much appreciated.


title: Show Custom Post From Logged In Author

text:
I have a custom home page set up so soon as users log in they see an overview of their account. I want to show them all of their own posts but im having trouble and can only get it to show current published posts to everyone. I need to show only the logged in user their own post I am also having issues with the categories showing all categories in the post type and not just what the post has. What do i need to use rather than wp_list_categories to just list cats attached to post?               <?php       query_posts( array( 'post_author' => $current_user->ID, 'post_status' => 'publish' , 'post_type' => array(    'user_lists' )  ) ); ?>          <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>       <?php echo '

';       echo ''; the_time('F j, Y'); ?> at       <?php the_time('g:i a'); echo '';        echo '

';        echo wp_list_categories('taxonomy=list_type&type=user_lists&title_li=&style=');         echo '

';        echo wp_list_categories('taxonomy=list_state&type=user_lists&title_li=&style=');         echo '

';         the_tags('', ', ', '');       echo '

'; ?>       <form class="delete-coupon" action="" method="post">         <input type="hidden" name="postid" value="<?php the_ID(); ?>" />         <input class="more-button" type="submit"  value="Delete" />       </form>       <?php  echo '

'; ?>       <?php endwhile; ?>       <?php wp_reset_query(); ?>


title: WAMP to XAMPP WordPress transfer

text: I want to switch a WordPress site from a wamp localhost to xampp localhost. Using the Tools > Export, I saved the WordPress content to an XML file. I did not create a similar backup of the MySQL databases (and won't be able to) but have all the files from wamp. How can I make this transfer without having to install a new version of WordPress? There are important settings in widgets and plugins that I need preserved. I am looking to place the relevant wamp and WordPress files in the correct xampp and WordPress folders. Thanks in advance.


title: Custom metabox not working

text:
Morning! I have a call in my `functions.php` file to include a custom meta-box php file in my theme's directory called: `/metaboxes/home-meta.php` The code is as follows for the call:                   add_action( 'add_meta_boxes_page','load_home_meta' );         function load_home_meta() {             $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;             if($post_id == '104'){                 include( get_template_directory() . '/metaboxes/home-meta.php' );             }         }      The include is now working (had an `add_meta_boxes` function wrapped around my metaboxes within the `home-meta.php` file below (updated code)). However, I'm getting errors in each metabox siting the first `case` within the `switch` for the callback functions. An example error is: > Warning: Invalid argument supplied for foreach() in > /Users/[my_mac]/Sites/[site_dir]/wp- > content/themes/[site_theme]/metaboxes/home-meta.php on line 224 The `home-meta.php` code is:                   <?php              /**          * Home Page Custom Meta Content          *         **/          add_meta_box(           'home_meta_box', // $id           'Home Page Content', // $title            'show_home_meta_box', // $callback           'page', // $page           'normal', // $context           'high'); // $priority     add_meta_box(           'home_meta_box_lower_1', // $id           'Home Lower Left', // $title            'show_home_meta_box_lower_left', // $callback           'page', // $page           'normal', // $context           'high'); // $priority         add_meta_box(           'home_meta_box_lower_2', // $id           'Home Lower Center', // $title            'show_home_meta_box_lower_center', // $callback           'page', // $page           'normal', // $context           'high'); // $priority      add_meta_box(           'home_meta_box_lower_3', // $id           'Home Lower Right', // $title            'show_home_meta_box_lower_right', // $callback           'page', // $page           'normal', // $context           'high'); // $priority                    // Creating Array for Fields         $prefix = 'home_';         $home_meta_fields = array(             array(                 'label' => 'Caption Title',                 'desc' => 'Upper section H2 caption title.',                 'id' => $prefix.'title',                 'type' => 'text'             ),             array(                 'label' => 'Caption Sub Title',                 'desc' => 'Upper section H3 caption title.',                 'id' => $prefix.'sub_title',                 'type' => 'text'             ),           array(                 'label'=> 'Caption',                 'desc'  => 'Caption text block.',                 'id'    => $prefix.'caption',                 'type'  => 'textarea'             ),             array(                   'label'  => 'Caption Image',                   'desc'  => 'Upload a pre-cropped 1140px wide x 530px tall web-optimized image.',                   'id'    => $prefix.'image',                   'type'  => 'image'               )         );// end caption array              $prefix2 = 'home_lower_left_';         $home_meta_fields_lower_left = array(             array(                 'label' => 'Column Title',                 'desc' => 'H2 title for column.',                 'id' => $prefix2.'title',                 'type' => 'text'             ),             array(                   'label'  => 'Column Image',                   'desc'  => 'Upload a pre-cropped 360px wide x 300px tall web-optimized image.',                   'id'    => $prefix2.'image',                   'type'  => 'image'               ),             array(                 'label' => 'Column Sub-Title',                 'desc' => 'H3 sub-title above text block.',                 'id' => $prefix2.'sub_title',                 'type' => 'text'             ),           array(                 'label'=> 'Text block',                 'desc'  => 'Caption text block.',                 'id'    => $prefix2.'caption',                 'type'  => 'textarea'             ),             array(                 'label' => 'Button Label',                 'desc' => 'Button link label (what user reads on button).',                 'id' => $prefix2.'btn_label',                 'type' => 'text'             ),             array(                 'label' => 'Button Title Tag',                 'desc' => 'On hover and SEO text.',                 'id' => $prefix2.'btn_title_tag',                 'type' => 'text'             ),             array(                 'label' => 'Button URL',                 'desc' => 'URL where button links to. Enter http:// to work.',                 'id' => $prefix2.'btn_url',                 'type' => 'text'             )         );// end lower left array              $prefix3 = 'home_lower_center_';         $home_meta_fields_lower_center = array(             array(                 'label' => 'Column Title',                 'desc' => 'H2 title for column.',                 'id' => $prefix3.'title',                 'type' => 'text'             ),             array(                   'label'  => 'Column Image',                   'desc'  => 'Upload a pre-cropped 360px wide x 300px tall web-optimized image.',                   'id'    => $prefix3.'image',                   'type'  => 'image'               ),             array(                 'label' => 'Column Sub-Title',                 'desc' => 'H3 sub-title above text block.',                 'id' => $prefix3.'sub_title',                 'type' => 'text'             ),           array(                 'label'=> 'Text block',                 'desc'  => 'Caption text block.',                 'id'    => $prefix3.'caption',                 'type'  => 'textarea'             ),             array(                 'label' => 'Button Label',                 'desc' => 'Button link label (what user reads on button).',                 'id' => $prefix3.'btn_label',                 'type' => 'text'             ),             array(                 'label' => 'Button Title Tag',                 'desc' => 'On hover and SEO text.',                 'id' => $prefix3.'btn_title_tag',                 'type' => 'text'             ),             array(                 'label' => 'Button URL',                 'desc' => 'URL where button links to. Enter http:// to work.',                 'id' => $prefix3.'btn_url',                 'type' => 'text'             )         );// end lower center array              $prefix4 = 'home_lower_right_';         $home_meta_fields_lower_right = array(             array(                 'label' => 'Column Title',                 'desc' => 'H2 title for column.',                 'id' => $prefix4.'title',                 'type' => 'text'             ),             array(                   'label'  => 'Column Image',                   'desc'  => 'Upload a pre-cropped 360px wide x 300px tall web-optimized image.',                   'id'    => $prefix4.'image',                   'type'  => 'image'               ),             array(                 'label' => 'Column Sub-Title',                 'desc' => 'H3 sub-title above text block.',                 'id' => $prefix4.'sub_title',                 'type' => 'text'             ),           array(                 'label'=> 'Text block',                 'desc'  => 'Caption text block.',                 'id'    => $prefix4.'caption',                 'type'  => 'textarea'             ),             array(                 'label' => 'Button Label',                 'desc' => 'Button link label (what user reads on button).',                 'id' => $prefix4.'btn_label',                 'type' => 'text'             ),             array(                 'label' => 'Button Title Tag',                 'desc' => 'On hover and SEO text.',                 'id' => $prefix4.'btn_title_tag',                 'type' => 'text'             ),             array(                 'label' => 'Button URL',                 'desc' => 'URL where button links to. Enter http:// to work.',                 'id' => $prefix4.'btn_url',                 'type' => 'text'             )         );// end lower right array                   //The Callback         function show_home_meta_box() {         global $home_meta_fields, $post;         // Using nonce for verification         echo '<input type="hidden" name="home_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';                  //Begin field table and loop             echo '
';             foreach ($home_meta_fields as $field) {                 // get value of this field if it exists for this page                 $meta = get_post_meta($post->ID, $field['id'], true);                 // begin a table row with                 echo '
                                 '.$field['label'].'	                                 ';                                 switch($field['type']) {                                     // case items will go here                                     // text                                       case 'text':                                           echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="30" />
'.$field['desc'].'';                                       break;                                     // textarea                                       case 'textarea':                                           echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'.$meta.'</textarea>
'.$field['desc'].'';                                       break;                                     case 'image':                                           $image = get_template_directory_uri().'/library/images/img-preview-blank.png';                                             echo ''.$image.'';                                           if ($meta) { $image = wp_get_attachment_image_src($meta, 'medium'); $image = $image[0]; }                                                          echo    '<input name="'.$field['id'].'" type="hidden" class="custom_upload_image" value="'.$meta.'" />
                                                          <input class="custom_upload_image_button button" type="button" value="Choose Image" />                                                           Remove Image
'.$field['desc'].'';                                       break;                                   } // end switch                 echo '
';             } // end foreach             echo '
'; // end table         }              // Save the Data         function save_home_meta($post_id) {               global $home_meta_fields;                    // verify nonce               if (!wp_verify_nonce($_POST['home_meta_box_nonce'], basename(__FILE__)))                    return $post_id;               // check autosave               if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)                   return $post_id;               // check permissions               if ('page' == $_POST['post_type']) {                   if (!current_user_can('edit_page', $post_id))                       return $post_id;                   } elseif (!current_user_can('edit_post', $post_id)) {                       return $post_id;               }                    // loop through fields and save the data               foreach ($home_meta_fields as $field) {                   $old = get_post_meta($post_id, $field['id'], true);                   $new = $_POST[$field['id']];                   if ($new && $new != $old) {                       update_post_meta($post_id, $field['id'], $new);                   } elseif ('' == $new && $old) {                       delete_post_meta($post_id, $field['id'], $old);                   }               } // end foreach           }           add_action('save_post', 'save_home_meta');         // end Upper Home Content              // Lower Left         //The Callback         function show_home_meta_box_lower_left() {         global $home_meta_fields_lower_left, $post;         // Using nonce for verification         echo '<input type="hidden" name="home_meta_box_left_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';                  //Begin field table and loop             echo '
';             foreach ($home_meta_fields_lower_left as $field) {                 // get value of this field if it exists for this page                 $meta = get_post_meta($post->ID, $field['id'], true);                 // begin a table row with                 echo '
                                 '.$field['label'].'	                                 ';                                 switch($field['type']) {                                     // case items will go here                                     // text                                       case 'text':                                           echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="30" />
'.$field['desc'].'';                                       break;                                     // textarea                                       case 'textarea':                                           echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'.$meta.'</textarea>
'.$field['desc'].'';                                       break;                                     case 'image':                                           $image = get_template_directory_uri().'/library/images/img-preview-blank.png';                                             echo ''.$image.'';                                           if ($meta) { $image = wp_get_attachment_image_src($meta, 'medium'); $image = $image[0]; }                                                          echo    '<input name="'.$field['id'].'" type="hidden" class="custom_upload_image" value="'.$meta.'" />
                                                          <input class="custom_upload_image_button button" type="button" value="Choose Image" />                                                           Remove Image
'.$field['desc'].'';                                       break;                                   } // end switch                 echo '
';             } // end foreach             echo '
'; // end table         }              // Save the Data         function save_home_meta_lower_left($post_id) {               global $home_meta_fields_lower_left;                    // verify nonce               if (!wp_verify_nonce($_POST['home_meta_box_left_nonce'], basename(__FILE__)))                    return $post_id;               // check autosave               if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)                   return $post_id;               // check permissions               if ('page' == $_POST['post_type']) {                   if (!current_user_can('edit_page', $post_id))                       return $post_id;                   } elseif (!current_user_can('edit_post', $post_id)) {                       return $post_id;               }                    // loop through fields and save the data               foreach ($home_meta_fields_lower_left as $field) {                   $old = get_post_meta($post_id, $field['id'], true);                   $new = $_POST[$field['id']];                   if ($new && $new != $old) {                       update_post_meta($post_id, $field['id'], $new);                   } elseif ('' == $new && $old) {                       delete_post_meta($post_id, $field['id'], $old);                   }               } // end foreach           }           add_action('save_post', 'save_home_meta_lower_left');         // end lower left              // Lower Center Column         //The Callback         function show_home_meta_box_lower_center() {         global $home_meta_fields_lower_center, $post;         // Using nonce for verification         echo '<input type="hidden" name="home_meta_box_center_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';                  //Begin field table and loop             echo '
';             foreach ($home_meta_fields_lower_center as $field) {                 // get value of this field if it exists for this page                 $meta = get_post_meta($post->ID, $field['id'], true);                 // begin a table row with                 echo '
                                 '.$field['label'].'	                                 ';                                 switch($field['type']) {                                     // case items will go here                                     // text                                       case 'text':                                           echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="30" />
'.$field['desc'].'';                                       break;                                     // textarea                                       case 'textarea':                                           echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'.$meta.'</textarea>
'.$field['desc'].'';                                       break;                                     case 'image':                                           $image = get_template_directory_uri().'/library/images/img-preview-blank.png';                                             echo ''.$image.'';                                           if ($meta) { $image = wp_get_attachment_image_src($meta, 'medium'); $image = $image[0]; }                                                          echo    '<input name="'.$field['id'].'" type="hidden" class="custom_upload_image" value="'.$meta.'" />
                                                          <input class="custom_upload_image_button button" type="button" value="Choose Image" />                                                           Remove Image
'.$field['desc'].'';                                       break;                                   } // end switch                 echo '
';             } // end foreach             echo '
'; // end table         }              // Save the Data         function save_home_meta_lower_center($post_id) {               global $home_meta_fields_lower_center;                    // verify nonce               if (!wp_verify_nonce($_POST['home_meta_box_center_nonce'], basename(__FILE__)))                    return $post_id;               // check autosave               if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)                   return $post_id;               // check permissions               if ('page' == $_POST['post_type']) {                   if (!current_user_can('edit_page', $post_id))                       return $post_id;                   } elseif (!current_user_can('edit_post', $post_id)) {                       return $post_id;               }                    // loop through fields and save the data               foreach ($home_meta_fields_lower_center as $field) {                   $old = get_post_meta($post_id, $field['id'], true);                   $new = $_POST[$field['id']];                   if ($new && $new != $old) {                       update_post_meta($post_id, $field['id'], $new);                   } elseif ('' == $new && $old) {                       delete_post_meta($post_id, $field['id'], $old);                   }               } // end foreach           }           add_action('save_post', 'save_home_meta_lower_center');         // end lower center              // Lower Right Column         //The Callback         function show_home_meta_box_lower_right() {         global $home_meta_fields_lower_right, $post;         // Using nonce for verification         echo '<input type="hidden" name="home_meta_box_right_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';                  //Begin field table and loop             echo '
';             foreach ($home_meta_fields_lower_right as $field) {                 // get value of this field if it exists for this page                 $meta = get_post_meta($post->ID, $field['id'], true);                 // begin a table row with                 echo '
                                 '.$field['label'].'	                                 ';                                 switch($field['type']) {                                     // case items will go here                                     // text                                       case 'text':                                           echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$meta.'" size="30" />
'.$field['desc'].'';                                       break;                                     // textarea                                       case 'textarea':                                           echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'.$meta.'</textarea>
'.$field['desc'].'';                                       break;                                     case 'image':                                           $image = get_template_directory_uri().'/library/images/img-preview-blank.png';                                             echo ''.$image.'';                                           if ($meta) { $image = wp_get_attachment_image_src($meta, 'medium'); $image = $image[0]; }                                                          echo    '<input name="'.$field['id'].'" type="hidden" class="custom_upload_image" value="'.$meta.'" />
                                                          <input class="custom_upload_image_button button" type="button" value="Choose Image" />                                                           Remove Image
'.$field['desc'].'';                                       break;                                   } // end switch                 echo '
';             } // end foreach             echo '
'; // end table         }              // Save the Data         function save_home_meta_lower_right($post_id) {               global $home_meta_fields_lower_right;                    // verify nonce               if (!wp_verify_nonce($_POST['home_meta_box_right_nonce'], basename(__FILE__)))                    return $post_id;               // check autosave               if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)                   return $post_id;               // check permissions               if ('page' == $_POST['post_type']) {                   if (!current_user_can('edit_page', $post_id))                       return $post_id;                   } elseif (!current_user_can('edit_post', $post_id)) {                       return $post_id;               }                    // loop through fields and save the data               foreach ($home_meta_fields_lower_right as $field) {                   $old = get_post_meta($post_id, $field['id'], true);                   $new = $_POST[$field['id']];                   if ($new && $new != $old) {                       update_post_meta($post_id, $field['id'], $new);                   } elseif ('' == $new && $old) {                       delete_post_meta($post_id, $field['id'], $old);                   }               } // end foreach           }           add_action('save_post', 'save_home_meta_lower_right');         // end lower right              ?>


title: Password protecting a page

text:
I'm trying to password protect a page but it doesn't seem to be working. I've set the password for the page but when you navigate to it it just loads up like normal and doesn't ask for any passwords. This is the loop I have on my page:               <?php     /**      * @package WordPress      * @subpackage Default_Theme      * Template Name: Page      */          get_header(); ?>          <?php     global $post;     if ( post_password_required( $post ) ) {     ?>          <?php $fields = get_acf(); ?>

          <?php } else { ?>         Not passworded                        <?php if (have_posts()) : ?>             <?php while (have_posts()) : the_post(); ?>                  <?php endwhile; ?>         <?php endif; ?>                 <?          } // Page isn't password-protected         ?>     <?php get_footer(); ?>      I want to password protect everything within the page. UPDATE: I have custom content on the page so if possible I need to be able to wrap some code around it all. Update: ![enter image description here](http://i.stack.imgur.com/cSsGc.png)


title: How many Custom Post Types to register?

text: My current WordPress site only exists of pages. The structure is as simple as this:               example.com/hotels      example.com/attractions      example.com/restaurants       I want to use Custom Post Types to add listings about individual hotels, attractions and restaurants. The new structure will look like this:               example.com/hotels/myhotel      example.com/attractions/myattraction      example.com/restaurants/myrestaurant      With myhotel/myattraction/myrestaurant being a Custom Post Type. All listings share the exact same custom fields. My Question: Do I need to create 3 Custom Post Types (hotel/attraction/restaurant) or should I register just 1 "global" custom post type - eg called "Place" - and specify if its a hotel/attraction/restaurant using hierarchical Custom Taxonomies? What are the advantages/disadvantages of these different approaches? Thanks!


title: Removing user contact methods works from functions.php but not from a plugin

text: I'd like to remove user fields and I used this code:               add_filter( 'user_contactmethods', 'newfields' );     function newfields( $user_contact ) {         unset($user_contact['facebook']);         unset($user_contact['twitter']);              return $user_contact;      }      If I use this code in `functions.php` of my theme, it works, but if I use this code in a plugin, it doesn't work. Why? How can I resolve it?


title: How can I control the HTML output of my post?

text: As you already know, WordPress manipulates posts, even if you write everything in **Text** mode. (replacing line breaks with `\r\n` 's , converting single quotes into double quotes etc.) I know this is good for helping us not to mess things up, however, in my case, I want to put HTML codes inside my post -both `<code>` and `</code>` tags , and some HTML directly-. so I want to make sure what I see in Text mode (or install an HTML mode somehow) , so that _What I See is What I Get_ , in terms of HTML :) Maybe a better explanation for what I want is this : What I write in "add new post" window should be **exactly** equal to what is printed between `<div class='entry-content'>` and `</div>`. Any tips for this? Should I change my theme? Or a plugin for tinymce? ## p.s.: I know single quotes should be escaped for database, but I want to preserve line breaks, html tags etc. So please tell me there is a way other than writing directly into the database.


title: Why is wp_enqueue_script not loading included jquery ui scripts?

text: Using Wordpress 3.4.2, the wp_enqueue_script documentation seems to indicate that jQuery UI libraries can be loaded simply by referencing their handles. I have the following code with no prior wp_register_script():               wp_enqueue_script('jquery');     wp_enqueue_script('jquery-ui-core');      The enqueue for 'jquery' works fine, but the enqueue for 'jquery-ui-core' isn't working. I realize that I can register and load script explicitly using Google CDN (or make explicit references to library elements in Wordpress install) ... but again documentation makes me think I shouldn't have to do this w/ Wordpress current version. Anyone know why this doesn't work?


title: List the 5 most recent child pages

text: I created a hierarchical custom post type for a gallery. The parent pages are the galleries and the child pages are the albums. I want to display the most recent albums on my sidebar (so basically the most recent child pages).               'post_parent' => 0      I only find this in the codex, but this is the opposite i want, this will only list the parent pages. Here is my code so far:               $albums = new WP_Query(array(         'post_type' => 'gallery',         'posts_per_page' => 6     ));


title: Getting Error "invalid secret string" by running wp-cron.php manually

text: I am trying to run the wp-cron.php manually by calling it that way:               http://mysite.com/wp-cron.php?doing_wp_cron      Disabling the auto cron function with :               define('DISABLE_WP_CRON', TRUE);      produces the same error. What could be the issue?


title: Modify Wp-Login Labels: Username to Email

text: Simple straightforward, question: How can you edit the labels of the wp- login.php form? I am using emails for logins, so I need to change 'username' to 'email' The answer here seems to be out of date, or just doesn't work with ssl or something: Function to change a label (Username) in a core WordPress File (wp- includes/general-template.php) I tried this in my functions file, but it didn't work:               function wpse60605_change_username_label( $defaults ){        $defaults['label_username'] = __( 'Email' );        return $defaults;     }     add_filter( 'login_form_defaults', 'wpse60605_change_username_label' );


title: make a dropdown custom field with 'cities' list in it

text: I am developing a website for real estates. I was wondering that how can I add a dropdown to my custom forms (theme my login plugin) for cities states etc. The basic point is that I dont want to add new tables in the database. I want to achieve this without that. Thanks


title: If post custom meta data is not set, show normal state

text: I'm much of a php-noob but have this idea of a loop for my site. I have the idea behind it but maybe you have an idea how to put this into code:               $customfield = get_specific_customfield          if $custom-field is = not empty     echo 'custom-field-input" class="'          else          echo '`<?php echo $thumbnail_src[0]; ?>" class="fancybox`'      (I have to integrate the fancy-box stuff to control how the input will be displayed)


title: Allow customers  to download updated versions of software

text: I will shortly be creating my WordPress website in which I will be selling a software product. Ideally, I would want two things to happen : 1) When a customer makes a payment(through PayPal account or PayPal credit card processing I suppose), they should be redirected to the download page to immediately download the software. 2) Since software tends to be updated into new versions quite a lot, I would really like to have a flexible way to allow customers to re-download the software using a well secure, secret uri, probably created with a token and based on some passwords. Hence, I would like to ask you how you would suggest I should handle that. I know that there are some WordPress plugins that would allow me to do (1), but i would really like to know your experience and if you use one, which plugin do you suggest? For (2), I don't really have any ideas yet? Is there a plugin or other solution ? Has anyone has done it?


title: Can I allow certain people to add/edit pages within a parent?

text: I'm planning on building a site with different sections, for example:   * Training   * Conferences   * Ideas A different person will be in charge of editing and managing each section. They will be able to edit the parent page and add, edit and delete sub-pages within each section. I don't want each person to be able to add/edit/delete pages from a section that they don't manage. As far as I can tell if I give each person an "editor" role then they will be able to add/edit/delete pages from each section. If I give them an author role, then they won't be able to add pages at all. Is there a way to achieve my goal from within Wordpress? If not, will I need to use a plugin, and if so, can you recommend one that will help?


title: Define permalinks for custom post type by taxonomy in WP 3.4

text: I want to create canonical permalinks for products and product types. I have the custom post types and custom taxonomy figured out, but I don't know if its possible to define permalinks with taxonomies. So my workflow, for example, would be this...   1. I create a custom post type called **products**.   2. Then I create a custom taxonomy for **product types**.   3. Then I add a product type called **'Chairs'** and add a product called **'Red Chair'** to this category. Once I create this product, the **desired permalink structure** to view this product would be formatted like so ->               http://shop.com/products/chairs/red-chair      Is this possible in wordpress 3.4? The meta boxes in my custom post type allow for selecting of the product types defined for my custom taxonomy, and there will only ever be one type per product. If possible, I would also like to include any parents of the selected product category if possible (For example, if the **'chairs'** category was a child of the **'lounge'** category, the permalink structure would be as follows ->               http://shop.com/products/lounge/chairs/red-chair      Here is how I create the custom post type and the custom taxonomy, I just need help defining rewrite / slug rules to include product type in the permalink.               /* Custom Post Type - Products ------- */     function products_init() {         $args = array(             'public' => true,             'label' => 'Products'         );         register_post_type( 'products', $args );     }     add_action( 'init', 'products_init' );          /* Custom Taxonomy - Product Type ------- */     add_action( 'init', 'create_prodtype' );     function create_prodtype() {         $labels = array(             'name' => _x( 'Product Type', 'products' ),             'singular_name' => _x( 'Product Category', 'product' ),             'search_items' =>  __( 'Search Product Types' ),             'all_items' => __( 'All Product Types' ),             'parent_item' => __( 'Products' ),             'parent_item_colon' => __( 'Products:' ),             'edit_item' => __( 'Edit Product Type' ),             'update_item' => __( 'Update Product Type' ),             'add_new_item' => __( 'Add New Product Type' ),             'new_item_name' => __( 'New Product Type' ),         );         register_taxonomy(             'products',             array('products'),             array(                 'rewrite' => array(                     'slug' => 'products',                     'hierarchical' => true                 ),                  'with_front' => false,                 'labels' => $labels         ));     }


title: Secure my "add_settings_field" translation?

text: I am using "add_settings_field" and want to provide translation for it , but my problem is security.   So is `__('My Checbox:' , 'domain')` secure enough for translation?      **If not what can I do about it?**      I have tried to use `esc_html_e( 'My Checbox:' , 'domain' )`   and `esc_html_( 'My Checbox:' , 'domain' )` but it breaks my page...               add_settings_field(        'add_checkbox',         __('My Checbox:' , 'domain'),<!--Is this secure when translating?-->            'my_checkbox_function',        'theme_options',        'theme_options'        );


title: Adding an assisting editor box to Post page

text:
I run a multiple author platform and to improve the moderation, I want to add a couple of assisting editors. I want to add a custom box to the Post page where the assisting editor can confirm which tasks they have completed. So, this box would contain a checklist of options, for example: > >         1 => ' Proofread ', >         2 => ' Graphics Added ', >         3 => ' SEO Fixed ', >         4 => ' Ready for Publish ' >   And then contain a checklist that lists all assisting editors (users that can `edit_published_posts`) and there the user can mark themselves as they have contributed to the edit. The box could look like this: ![Editorial Tasks](http://i.stack.imgur.com/uiHre.png) Then finally, on the front end post page, I want to list which user(s) that have edited the post. In an attempt to do this, I have this code:               add_action( 'add_meta_boxes', 'assisting_editor' );     function assisting_editor() {         add_meta_box(             'assisting_editor', // id, used as the html id att             __( 'Editorial Tasks' ), // meta box title             'editor_tasks', // callback function, spits out the content             'post', // post type or page. This adds to posts only             'side', // context, where on the screen             'low' // priority, where should this go in the context         );          }          function editor_tasks( $post ) {         global $wpdb;         $value = get_post_meta($post->ID, 'rating', true);         echo '
Editorial tasks: ';              $ratings = array(             1 => ' Proofread ',             2 => ' Graphics Added ',             3 => ' SEO Fixed ',             4 => ' Ready for Publish '         );              echo '<select name="rating">';         echo '<option value=""' . ((($value == '') || !isset($ratings[$value])) ? ' selected="selected"' : '') . '> Untouched </option>';              // output each rating as an option         foreach ($ratings as $id => $text) {             echo '<option value="' . $id . '"' . (($value == $id) ? ' selected="selected"' : '') . '">' . $text. '</option>';         }         echo '</select>';              echo '
';     }          add_action( 'save_post', 'save_metadata');          function save_metadata($postid)     {            if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return false;         if ( !current_user_can( 'edit_page', $postid ) ) return false;         if( empty($postid) ) return false;                   if ( is_null($_REQUEST["rating"]) ) {             delete_post_meta($postid, 'rating');         } else {             update_post_meta($postid, 'rating', $_REQUEST['rating']);         }          }      **However** , this code adds a drop-down list, not a check-list, and more importantly, it does not list the editor users. **My question is** : how can I make a box like the picture above and with those features, and how do I echo the list of users that have edited the post?


title: How to get category id in single.php wordpress?

text: I need to `get category id` in `single.php`. I tried this:   `$cat_ID = get_query_var('cat');` It didn't work. What should I use instead?


title: Single-user registration to access all sites in WordPress MultiSite Network

text: Ok This is what i'm trying to achieve. A site network where user can post their articles and get rewarded for each post. For example, Lets say i have a main site example.com. I created a network like site1.example.com, site2.example.com, etc. So lets say i have around 10 subsites in my network. Each subsite have one custom post type. For example site1.example.com has custom post type videos and only dedicated for videos, site2.example.com has custom post type pictures and only dedicated for pictures, etc. Likewise i created 10 custom post types in 10 of my subsites. Now i want user access in all network sites with one registration. I mean user who register in site2.example.com should able to access all my network sites and create new posts. They all should be able to access even if i add a new site in my network. Is there any plugin available for this feature?. Please help me. Thanks


title: How to create a blogs category page with Blog-Types Plugin

text: I'm not a web developer so I don't know how to create an sql query to display information from my database. Here's what I wanted to do, I want to have a page that will display blog categories. When a visitor clicked a category, a list of blogs will be displayed under that category. I already have a table and information stored on my database however, i don't know how to display it on the frontend.                   CREATE TABLE `wp_blog_types` (       `blog_types_ID` bigint(20) unsigned NOT NULL auto_increment,       `blog_ID` bigint(20) NOT NULL,       `blog_types` TEXT NULL,       `blog_subtypes` TEXT NULL,       PRIMARY KEY  (`blog_types_ID`)     ) ENGINE=MyISAM;          CREATE TABLE `wp_signup_blog_types` (       `blog_types_ID` bigint(20) unsigned NOT NULL auto_increment,       `blog_types_domain` varchar(255) NOT NULL,       `blog_types_path` varchar(255) NOT NULL,       `blog_types` TEXT NULL,       `blog_subtypes` TEXT NULL,       PRIMARY KEY  (`blog_types_ID`)     ) ENGINE=MyISAM;      I wanted to display the information based on that sql code by using a shortcode.


title: Featured image thumbnail sometimes in content, sometimes changes header images

text: I am using wordpress 3.1 and when I use the featured image metabox to upload sometimes I see in my posts the image as part of the content and sometimes the header image changes as well. I cannot understand what is the reason. Any help will be appreciated. I am using                   if ( has_post_thumbnail() )      { // check if the post has a Post Thumbnail assigned to it.         the_post_thumbnail();     }       ## Update sorry i got confused with the editor. anyway what i need right now is to display the thumbnail in a size of 300x300 but have a larger image to display when the user clicks on the thumbnail. i saw the loop-attachment.php and i think i have to use this one.               <?php $attachment_page = get_attachment_link( $attachment_id ); ?>                     <?php $thumb=get_the_post_thumbnail(); ?>                         <a href="<?php echo $attachment_page; ?>">                         <?php the_post_thumbnail();?>                         </a>      but it is not working. i dont know if i have to post it as a new question also.


title: Changing the title tag from a shortcode

text: I currently have a shortcode which dynamically swaps out locations on a page to make each page specific to a location. For example the url               http://mywebsite.com/offers/scotland/      Would make the H1 of my website be               Special Offers Scotland      But now I also want to change the title tag to allow effect search engine optimisation. I am unsure if it's possible to do this within my shortcode as it will execute within the loop and therefore the header.php has already finished loading. Any guidance would be greatly appreciated.


title: Wordpress MU LDAP connection failures

text: I'm using Wordpress 3.8.1, WPMU Ldap Authentication plugin 4.0.2 (This site fixes the deprecated WordPress functions ), and Linode Hosting with Linux CentOS 6 and I'm still having problems connecting LDAP. When I test the connection it takes a long time and comes back a " ** _Connection: Failed_** ". Is there a way to look at a LDAP Debug file so I can check for errors?


title: Message box when accessed from iPad

text: I am still looking for a solution for this and can't seem to find it. I have the following code to start, but am not sure how to write the function to fire off a .js file. I need this to work on one specific page ID.               function ipad_alert() {      if( preg_match('/ipad/i',$_SERVER['HTTP_USER_AGENT'])) {?>           // link to .js file?       <?php }      }      add_action('init','ipad_alert');


title: Featured Image or Post Thumbnail Displaying on index.php?

text: When I'm on the main page, of my site, `site.com` it shows an excerpt of each post along with a category to the side. it also displays the same thumbnail image but above the content and I'm guessing because its grabbing the first image in the post.. I already tried removing `<?php the_post_thumbnail();?>` from the single.php and it didnt help. How do I stop any additional images from displaying on the homepage?


title: how get number of twitter followers in wordpress

text: I used function to get twitter followers               function twitter_count($twitter_user){              $count = get_transient('twitter_count');         if ($count !== false) return $count;              $count = 0;              $dataOrig = file_get_contents('http://twitter.com/users/show/'.$twitter_user);        if (is_wp_error($dataOrig)) {              return 'Error!!!';        }else{              $profile = new SimpleXMLElement ( $dataOrig );              $countOrig = $profile->followers_count;              $count = strval ( $countOrig );              }      set_transient('twitter_count', $count, 60*60*24); // 24 hour cache     return $count;      and I need replace `file_get_contents` for `wp_remote_get` how realize it?


title: I want to restrict admin panel from front user in wordpress

text: I am very new in wordpress. I am working on a project in which I want to restrict access to `wp-admin` url for admin login. I want when user as well as admin try to access the `wp- admin` they should redirect to home page. In home page I created a Login form. From where user as well admin would be able to login.


title: Utilise WP_Customize_Image_Control to only show image picker

text: I would like to achieve the following (using a copy of twentytwelve):   * Turn off custom-header theme support to prevent users being able to upload their own images (achieved)   * Create own section in customize admin area (achieved)   * Add a list containing thumbnails to be selected to replace header image. No upload capabilities. I am trying to hook into customize_register and utilize WP_Customize_Image_Control but get it to **only** display a predefined list of images without the upload options. This post explains how to use the customize_register and in the additional notes towards the bottom goes onto describe what each control can do. It suggests WP_Customize_Image_Control is used to upload AND display a list of images. I just want a list. This post shows you how to add the images to a 'default' tab but the original custom-header theme support has to be switched on which gives users the option to add header images from the admin page. I know I could do it using a simple drop down menu but I like the selector window which provides a visual prompt. Does anyone have a suggestion as to how I might utilize customize_register to achieve this?


title: PNG file uploads don't stay in Media Libtary

text: When uploading these I get the percentage count then the "crunching" alert but the crunching never stops to indicate that the file is done. I'll go into the media library and it will be there, sometimes it stays, often it disappears...It's not too big in size What is going on?