Displaying a video on the homepage via a custom field inside a php widget

I'm trying to get a video to display inside a widget which is called from a custom field inside a post. The code I am using is here:               <?php query_posts('cat=8&showposts=1'.get_option('posts_per_page')); ?>     <?php if(have_posts()) : while(have_posts()) : the_post(); ?><?php if( get_post_meta($post->ID, "youtube", true) ): ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="The W Club: <?php the_title(); ?>"><?php the_title(); ?>
          <iframe width="250" height="199" src="http://www.youtube.com/embed/<?php echo get_post_meta($post->ID, "youtube", true); ?>?rel=0" frameborder="0" allowfullscreen>          <?php else: ?>          Video can not be displayed.          <?php endif; ?>          <?php endwhile; endif; ?>          <?php echo get_post_meta($post->ID, "youtube", true); ?>          I have created a post inside category 8 (videos), entered a title, added the custom field (youtube) with the right code for the URL to display the video. When I load the page all the widget displays is "Video can not be displayed", it doesn't use the post title and I can't get it to even echo the custom field entry. Any ideas as to what is going on? The custom php widget I am using is http://wordpress.org/extend/plugins/php-code-widget/ Thanks in advance. Of course if anyone has a better way of doing what I'm trying to achieve that would be awesome too :)


Admin menu bar dropdown opens when I click on a form <select> element (Chrome)

Whenever I click on a `<select>` element within a form, it opens not only the relevant dropdown but at the same time the first dropdown menu of the admin menu bar. It seems to be an issue with _Google Chrome_ , as this doesn't happen with _Firefox_. Does anyone else have the same issue ? Any ideas about how to fix it ?


query in category.php repeats itself

I'm need some help on my query. I'm building up a category page where on top a post need to show where custom field key 'uitleg' has value 'ja'. Per category there is only one post with that value. I use this post as an introduction post. Below that post I need to show all other posts in the same category minus the introduction post. This part works like a charm. But then something strange happens. If I got 4 posts in one category (1 introduction post and 3 other posts) the query below repeated itself 4 times beneath eachother. Is there a way to stop this? Must be in one of my foreach queries. But I can't see where this is going wrong. Anyone can see where this is going wrong? Thanks in advance!                               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                          <?php $drukproef = get_post_meta($post->ID, 'drukproef', $single = true); ?>                     <?php $drukproefimage = get_post_meta($post->ID, 'drukproefimage', $single = true); ?>                     <?php $actief = get_post_meta($post->ID, 'actief', $single = true); ?>                     <?php $uitleg = get_post_meta($post->ID, 'uitleg', $single = true); ?>                     <?php $artistnaam = get_post_meta($post->ID, 'artistnaam', $single = true); ?>                     <?php $artisturl = get_post_meta($post->ID, 'artisturl', $single = true); ?>                               <?php global $post;                         $categories = get_the_category();                         foreach ($categories as $category) :                     ?>                           <?php                      global $post;                      $tmp_post = $post;                      $myposts = get_posts('posts_per_page=1' . '&paged=' . get_query_var('paged') . '&meta_key=uitleg&meta_value=ja&category='. $category->term_id);                      foreach($myposts as $post) :                        setup_postdata($post);                      ?>                      <?php $thumb = get_post_meta($post->ID, 'thumb', $single = true); ?>                                    <?php $drukproef = get_post_meta($post->ID, 'drukproef', $single = true); ?>                     <?php $drukproefimage = get_post_meta($post->ID, 'drukproefimage', $single = true); ?>                     <?php $actief = get_post_meta($post->ID, 'actief', $single = true); ?>                     <?php $uitleg = get_post_meta($post->ID, 'uitleg', $single = true); ?>
                             <?php the_title(); ?>:                             <?php echo $drukproef; ?>                              <img src="<?php bloginfo('template_directory'); ?>/images/uitleg-actief-ja.png" width="20" height="20" />

                                       <?php the_content(''); ?>

<img src="<?php bloginfo('template_directory'); ?>/images/uitlegdivider.png" alt="" width="26" height="171" />

                                     <img src="<?php echo $drukproefimage; ?>" />

                         <?php endforeach; ?>                         <?php $post = $tmp_post; ?>

Overige inzendingen

                                  <?php                             $posts = get_posts('posts_per_page=1000&category='. $category->term_id . '&paged=' . get_query_var('paged'));                             foreach($posts as $post) :                             $thumb = get_post_meta($post->ID, 'thumb', $single = true);                             ?>
                                  <?php if (!empty($thumb)) { ?>
                                     <?php $thumb = get_post_meta($post->ID, 'thumb', $single = true); ?>                                     <?php $artistnaam = get_post_meta($post->ID, 'artistnaam', $single = true); ?>                                     <a href="<?php the_permalink(); ?>"><img src="<?php echo $thumb; ?>" class="img" alt="<?php the_title(); ?>" width="171" height="171" />

                                                                    <a href="<?php the_permalink(); ?>">

<?php echo $artistnaam; ?>

<?php the_excerpt(); ?>

<?php echo the_ratings_results(get_the_id()); ?>

                             <?php } ?>
                             <?php endforeach; ?>                         <?php endforeach; ?>                         <?php wp_reset_query(); ?>                 <?php endwhile; ?>                         <?php else : ?>                     Sorry, no posts matched your criteria.                 <?php endif; ?>


Wrap Meta Box with <li> and </li> for each new line

I'm trying to automate one of our posting aspects. We post a lot of lyrics and have a system of meta boxes which we use to input various pieces of information about each set of lyrics we post. One aspect that is a little annoying is having to search & replace `<li>`<`/li>`tags to the start and end of each new line of lyrics. I was hoping to have PHP echo this automatically but my code is not working at the moment. Here is my untouched code which outputs a verse of lyrics (we use `wpautop`so that line breaks are respected):               <?php if ( get_post_meta($post->ID, '_cmb_lyrics_1', true) ) : ?>     <?php $lyrics_1 = get_post_meta($post->ID, '_cmb_lyrics_1', true) ?>     <ul>     <?php echo wpautop( $lyrics_1) ; ?>     </ul>     <?php endif; ?>       And here is my attempt at outputting `<li>`tags, which didn't work. :(               <?php if ( get_post_meta($post->ID, '_cmb_lyrics_1', true) ) : ?>     <?php $lyrics_1 = get_post_meta($post->ID, '_cmb_lyrics_1', true) ?>     <ul>     <?php      echo "<li>\n"; wpautop( $lyrics_1) ; "</li>\n"; ?>     </ul>     <?php endif; ?>      Any help appreciated. Thanks.


HTML / Javascript in custom field textarea?

Is there a filter for allowing HTML / Javascript into a custom field textarea? I'm using get_post_meta. On the frontpage I want the HTML / Javascript to run, not to be displayed.


Custom post query by taxonomy

I am using WordPress 3.5. My query is,               $args = array(         'post_type' => array('product', 'comic', 'magazine'),         'taxonomy' => 'Genres',         'term' => 'hot',         'posts_per_page' => 10     );     $the_query = new WP_Query( $args );          // The Loop     while ( $the_query->have_posts() ) :         $the_query->the_post();         echo '
' . get_the_title() . '
';     endwhile;          // Restore original Query & Post Data     wp_reset_query();     wp_reset_postdata();      This gives the exact result that I want but,               $args = array(         'post_type' => array('product', 'comic', 'magazine'),         'taxonomy' => 'Genres',         'term' => array('hot','home'),         'posts_per_page' => 10     );     $the_query = new WP_Query( $args );          // The Loop     while ( $the_query->have_posts() ) :         $the_query->the_post();         echo '
' . get_the_title() . '
';     endwhile;          // Restore original Query & Post Data     wp_reset_query();     wp_reset_postdata();      This is not working.


Adding Language Switcher in header , WP

Currently, I'm building multi languages blog. As I know, almost WP language translator plugins are based on .po & .mo files. here is a problem. A new language what I'm going to add does not exist with .po & .mo files, it's just a dialect(local) language. That's why I defined in php and grab the language.php files as below code. **header.php**               <a href="<?php echo $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; ?>/?lang=newlanguage"> New Language     <a href="<?php echo $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; ?>/?lang=eng">English      **function.php**               <?php session_start();     $_SESSION['language'] = $_GET['lang'];     if ( $_SESSION['language'] == 'newlanguage' ) {     require (TEMPLATEPATH .'/languages/new-language.php');     }     else {     require (TEMPLATEPATH .'/languages/english.php');  // default language     } ?>      the problem is it doesn't work, if I load to the new page, "new-language" is disappear and it automatically changes to the default language. My question is Can someone guide me to the right way/codes with developer solution?


3.5 Media Manager - callout in metaboxes

Two ways of doing the same thing: First one:                   var _custom_media = true,         _orig_send_attachment = wp.media.editor.send.attachment;              $('.media-upload-button').click(function(e) {             var send_attachment_bkp = wp.media.editor.send.attachment;             var button = $(this);             var id = button.attr('id').replace('_button', '');             console.log(id);             _custom_media = true;             wp.media.editor.send.attachment = function(props, attachment){                 if ( _custom_media ) {                     $('#'+id).val(attachment.url);                     $('#'+id).prev().attr('src', attachment.url);                     console.log(id);                 } else {                     return _orig_send_attachment.apply( this, [props, attachment] );                 };             }             wp.media.editor.open(button);             return false;         });              $('.add_media').on('click', function(){             _custom_media = false;         });      Second one:               $('.media-upload-button').click(function(e) {         e.preventDefault();         var button = $(this);         var id = button.attr('id').replace('_button', '');         console.log(id);         //If the uploader object has already been created, reopen the dialog         if (custom_uploader) {             custom_uploader.open();             return;         }              //Extend the wp.media object         custom_uploader = wp.media.frames.file_frame = wp.media({             title: 'Wybierz zdjęcie',             button: {                 text: 'Wybierz zdjęcie'             },             multiple: false         });              //When a file is selected, grab the URL and set it as the text field's value         custom_uploader.on('select', function() {             attachment = custom_uploader.state().get('selection').first().toJSON();             $('#'+id).val(attachment.url);             $('#'+id).prev().attr('src', attachment.url);             //console.log(attachment);             console.log(id);             //custom_uploader.close();         });              //Open the uploader dialog         custom_uploader.open();          });      Both works well when there is only one field/button that they are "attached" to, but if there is more than one, only first works ok. The second one always insert data to firstly clicked button/field, even if You click second one (second console.log shows oryginal "id" that is diffrent than one showed in console after click of button). But the second interface looks better for a designed job, so the question is - how the second code should be changed, so it can work with multiple input fields/buttons? AFAIK, the problem with second code is, that Media Manager object that is being created once, stays "in memory" so second callout only displays it, and doesnt ovverrite oryginal "custom_uploader.on" with initial id in it. Maybe somehow object should be destroyed after closing it? To clear thing out - question is: how should I use wp.media.frames.file_frame correctly with more than one button/field instead of wp.media.editor.send.attachment? Ps... for those, who would like to test entire code: functions.php:               add_action( 'add_meta_boxes', 'cs_products_mb_create' );     function cs_products_mb_create() {         //create a custom meta box         add_meta_box( 'products-info', 'Ustawienia Produktu', 'cs_products_mb_function', 'posts', 'normal', 'high' );     }          function cs_products_mb_function( $post ) { ?>

<input id="cs_product_menu_img_src" type="text" name="cs_product_menu_img_src" value="" /> <input id="cs_product_menu_img_src_button" type="button" value="Add / Change" class="button-secondary media-upload-button"  />

<input id="cs_product_bg_img_src" type="text" name="cs_product_bg_img_src" value="" /> <input id="cs_product_bg_img_src_button" type="button" value="Add / Change" class="button-secondary media-upload-button"  />

     <?php        }     add_action('admin_enqueue_scripts', 'cs_admin_customposttype_scripts');     function cs_admin_customposttype_scripts(){         wp_enqueue_media();          wp_enqueue_script( 'cs-image-upload', get_bloginfo('template_url').'/js/admin.js', array( 'jquery') );     }      Its stripped from loading and saving data, but it does what it should The admin.js that works but uses wp.media.editor.send.attachment instead of wp.media.frames.file_frame:               jQuery(document).ready(function($){         var _custom_media = true,         _orig_send_attachment = wp.media.editor.send.attachment;              $('.media-upload-button').click(function(e) {             var send_attachment_bkp = wp.media.editor.send.attachment;             var button = $(this);             var id = button.attr('id').replace('_button', '');             console.log(id);             _custom_media = true;             wp.media.editor.send.attachment = function(props, attachment){                 if ( _custom_media ) {                     $('#'+id).val(attachment.url);                         console.log(id);                 } else {                     return _orig_send_attachment.apply( this, [props, attachment] );                 };             }             wp.media.editor.open(button);             return false;         });              $('.add_media').on('click', function(){             _custom_media = false;         });     });      And admin.js that uses and looks as I would like, but doesnt work coccectly with two or more inputs:               jQuery(document).ready(function($){         var custom_uploader;         $('.media-upload-button').click(function(e) {             e.preventDefault();             var button = $(this);             var id = button.attr('id').replace('_button', '');             console.log(id);             //If the uploader object has already been created, reopen the dialog             if (custom_uploader) {                 custom_uploader.open();                 return;             }                  //Extend the wp.media object             custom_uploader = wp.media.frames.file_frame = wp.media({                 title: 'Wybierz zdjęcie',                 button: {                     text: 'Wybierz zdjęcie'                 },                 multiple: false             });                  //When a file is selected, grab the URL and set it as the text field's value             custom_uploader.on('select', function() {                 attachment = custom_uploader.state().get('selection').first().toJSON();                 $('#'+id).val(attachment.url);                 //console.log(attachment);                 console.log(id);                 //custom_uploader.close();             });                  //Open the uploader dialog             custom_uploader.open();              });     });


Display Today's date outside the loop?

Is there any way to display the Today's date outside any loop/post using WordPress date/time function instead of using the PHP `date()` function? I'm using the PHP `date()` function but it does not translate the date (month/day names) in the local languages, so it is not possible to translate it without changing the PHP code and setting the locale etc.


Filter media upload attachment meta

I'm trying to determine a way to access the meta data for an image when it is **first uploaded** with the media uploader. Looking at the media_handle_upload() function in /wp-admin/includes/media.php I can't see any filters before the meta data is sent to wp_insert_attachment() wp_update_attachment_metadata(). Sure, I can filter the meta inside using the 'wp_update_attachment_metadata' filter. But this fires inside the wp_update_attachment_metadata() function. I need a filter the meta data (specifically the title) when a new image is uploaded, not every time meta data is updated.


Including Angle Brackets In Pre Sections

I am attempting to post some java code between pre tags but the angel brackets get removed. For example:               private HashMap<String, HashMap<String, Integer>> featureCounts;      becomes               private HashMap> featureCounts;      Is there a way I can render the actual code? Also I am not a php developer or a wordpress expert by any means, so modifying the underlying php would be less preferred as a solution. Is there a way I can do this just using the editor?


New Plugin: Post update pushes a copy as a revision

I've been working alot with editing of posts after they've been published. I know I can hit update on the post to just update it, but I want to have the journey of revisions available for users to view on site. So I was thinking of a plugin. I've looked at http://wordpress.org/extend/plugins/duplicate-post/ which creates another copy on a new permalink. This is a good starting point I think, but I'm wondering if the functionality could be done in reverse. Functionality: When a post is updated (on every update no matter how small), it pushes the new updated content to the original post permalink, and moves the older post to a new permalink with a suffix of the update count. Example: My post is called `hello-world`. I publish it and the permalink becomes http://mysite.com/hello-world. I need to edit it, so I go to posts and edit the page. I click update, and the original `hello-world` post is copied and published under `hello-world-draft-1`, and the newly updated post takes the place of the original `hello-world` post. This way anyone linking to the post would always see the most up-to-date version of it, but all drafts would be available to view to any user by visiting `/hello-world-draft-X`, where 'X' is every update made that is not the main post slug. I'm thinking this is something like being able to show revisions to the user? Comments and suggestions welcome. Thanks. Update: This plugin looks good but only works on uploaded .doc files and not posts. http://wordpress.org/extend/plugins/wp-document-revisions/


Checking conditionals

We all know about the default WordPress post types, these being aside, gallery, status, chat and so on. any good theme should support all of them. In the case where a theme does support all of them, is it best, from a clean programming standard to do if, elseif, else if, else or should I use a switch case when checking if you are on a specific post type. for example:                   if(is_aside()){                      }elseif(is_status()){                      }elseif(is_quote()){                      }elseif(is_link()){                      }elseif(is_chat()){                      }elseif(is_gallery()){                      }elseif(is_image()){                      }elseif(is_chat()){                      }elseif(is_video()){                      }elseif(is_audio()){                      }else{                     $this->_title($this->_options);                     $this->_author_and_date();                     $this->_thumbnail($this->_options);                          the_content();                                   }      Seems messy and unclean, what would you suggest to do? **note:** some conditionals may be wrong, this is an example.


How to display site title with post title?

Is it possible to have the site title prepended before each post title, separated by a hyphen? For example:               [my site title] - [my post title]


Filter custom post type using multiple taxonomy dropdowns

I'm trying to create two dropdown boxes on a custom post type page called Activities. One taxonomy category is for Activities Grade Level and the other for Activities Type. With what I have now, if you leave one of the drop boxes empty the search will go to a 404 page. I used the code from this wordpress forum and so this is what I have in my functions folder:               function get_terms_dropdown_grade_level($taxonomies, $args){             $myterms = get_terms($taxonomies, $args);             $output ="<select name='activities_grade_level'>";             $output .="<option value='#'>Select grade level</option>";             foreach($myterms as $term){                     $root_url = get_bloginfo('url');                     $term_taxonomy=$term->taxonomy;                     $term_slug=$term->slug;                     $term_name =$term->name;                     $link = $term_slug;                     $output .="<option value='".$link."'>".$term_name."</option>";             }             $output .="</select>";     return $output;     }          function get_terms_dropdown_type($taxonomies, $args){             $myterms = get_terms($taxonomies, $args);             $output ="<select name='activities_type'>";             $output .="<option value='#'>Select  activity type</option>";             foreach($myterms as $term){                     $root_url = get_bloginfo('url');                     $term_taxonomy=$term->taxonomy;                     $term_slug=$term->slug;                     $term_name =$term->name;                     $link = $term_slug;                     $output .="<option value='".$link."'>".$term_name."</option>";             }             $output .="</select>";     return $output;     }      And this is what I have on the post type archive page:
Filter by
         <form action="<?php bloginfo('url'); ?>" method="get">
         <?php         $taxonomies = array('activities_grade_level');         $args = array('orderby'=>'name','hide_empty'=>false);         $select = get_terms_dropdown_grade_level($taxonomies, $args);         $select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);         echo $select;         ?>         <?php         $taxonomies = array('activities_type');         $args = array('orderby'=>'name','hide_empty'=>false);         $select = get_terms_dropdown_type($taxonomies, $args);              $select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);         echo $select;         ?>         <input type="submit" name="submit" value="filter" />
         </form>      Incase it's good information, I'll include the urls too. A regular url that leads to the correct search is > [...]/?activities_grade_level=elementary- > school&activities_type=engineering&submit=filter A url where one of the drop boxes is empty is > [...]/?activities_grade_level=%23&activities_type=engineering&submit=filter > where %23 replaced something that could have been elementary-school or > middle-school A url that leads to the correct category would be > [...]/activities_type/engineering/ or > [...]/activities_grade_level/middle-school Any suggestions for this php and wordpress beginner?


Sticky menu for WP custom menubars

This seems simple, except that I am not able to figure it out. In a wordpress theme, how can I make a custom menubar below the header image stick at the top after scrolling down the page? Example sites are www.riverviewford.com and www.forexfactory.com. Here is the code I found on the net and am trying to use in wordpress. http://jsfiddle.net/uFq2k/3/ How do I actually call the script, and where from? Thanks in advance.


Plugin:Read More Right Here , How to change the name (more...) to Read More

Hi all I am using Read More Right Here Plugin when i using the `<!--more-->` Tag it appears like `(more...)` I need to know how to change the `(more...)` to Read More` Anyone Much appreciated!!


Permalinks okay some pages but 404 error on others

I recently upgraded to WP 3.4.2 and had multiple issues with custom theme. In the course of trying to fix those, permalinks broke for some pages, not others. I get server 404 page not found for the about page and subpage, services page and subpages, and contact page. But pages of home, health- concerns page and subpages, and resources are okay. I have tried:   1. Undoing and redoing the permalinks. (mod rewrite rules and htaccess is okay). While the pages are all there with page numbers, I must use twentyten theme to access them.   2. Activating twentyten theme. Same 404 behavior. (And it's the server 404, not the WP 404.)   3. Reupdating to 3.4.2. Site is hosted on GoDaddy; I don't have access to any config or log files. Site is: http://phoenixhealingarts.net At one point, I did reupload the database xml backup file. That apparently created a lot of duplicates (custom fields, SEO plugin info), which have since been removed from the database, but possibly could have created problems that persist. I'm looking at the SQL file (exported via phpadmin) but I don't see anything obviously wrong there. I've been reading posts/forums looking for an answer for many hours now. If you have any ideas, please share them.


Showing custom post type categories in the menu

here is my custom post type and category:               //Register nav     register_nav_menus( array(         'main_nav' => 'Main navigation'     ) );          //Custom post types     add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'assets',             array(                 'labels' => array(                     'name' => __( 'Assets' ),                     'show_in_nav_menus' => true,                     'show_in_menu' => true,                     'singular_name' => __( 'Asset' )                 ),             'public' => true,             'has_archive' => true,             )         );     }          //Custom post type taxonomy/category     add_action( 'init', 'build_taxonomies', 0 );     function build_taxonomies() {         register_taxonomy( 'categories', 'assets',             array(                 'hierarchical' => true,                 'label' => 'Categories',                 'query_var' => true,                 'rewrite' => true             )         );     }      Even though I have 'show_in_nav_menus' turned on, it still won't show. Is there something wrong with my code? It seems to work fine otherwise. Thanks


Current Page Highlight Issue

I'm currently working on website that has Wp-ecommerce and the current page link doesn't highlight except when I dedicative WP E-commerce. Any Ideas what the problem could be.


how to create a menu with all sub categories?

Is it possible to create a menu with a category such that each time that I had a sub category that automatically display on the menu? As far as I know, if I have a menu with the category "fruit", and I create the subcategory "bananas", I have to manually add it.


How to Migrate Blog Posts (only) from One Server to Another

I have a heavily infected and hacked server. I have setup a new server and created a fresh install of WordPress (fyi...it was a Joomla install on my server that got hacked and took the server down, not WordPress). So, now that I have a new and fresh install of WordPress on the new server I have a couple questions:   1. if I run a `check table` query on my current server, would that detect any malicious data in the WP Tables? I know the tables contain just data but I want to be completely sure that I guard against any possible way of transporting the malicious data from my current server to the new server.   2. what WP Tables do I need to move over to the new server now that I already installed a fresh WP copy. I have tweaked the new WP options a bit and all I want to do is move my blog posts and their related data -- nothing else. Which of the following tables should I be moving: wp_commentmeta wp_comments wp_links wp_options wp_postmeta wp_posts wp_terms wp_term_relationships wp_term_taxonomy wp_usermeta wp_users Thank you.


How to wrap a text with shortcode into php file?

I want to wrap a text with shortcode into the `single.php` file.   * The shortcode is: `[box type="note" align="aligncenter" ][/box]` and   * the code is:              Διοργανωτής διαγωνισμού: <?php the_field('diorganwths_diagwnismou');?>
     Απαιτεί λογαριασμό Facebook: <?php the_field('apaitei_logariasmo_facebook');?>
      How can i wrap the this php code so i can have it into the box as the shortcode orders?


How do I add a new template to my site

I am in the template editor for my WP site, and I want to upload a new file, but I can't find that option anywhere. I want to make a new php file for a custom portion of the site. Where can I find this functionality?


Removing parent page in URL for one page

I have a page e.g.: mysite.com/parent/child1/child2/page And I want the URL to be: mysite.com/page But only for this one page ... not the entire site. Is there a way to do this without using some of the WP plugins which seem to have issues according to the support forums. Thanks for you help :)


Wordpress post carousel

I stuck with this. I would like to have a portfolio carousel, that shows 9 of the latest posts in the carousel, and when you click on an arrow, than you will the 9 older posts etc. How can I get this working? My theme code:

                 <?php                      $args = array('post_type' => 'portfolio', 'posts_per_page' => -1, 'paged' => $paged);                     $loop = new WP_Query($args);                     $count = 0;                 ?>                      <?php if ($loop) : while ($loop->have_posts()) : $loop->the_post(); ?>
                 <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">                                              <?php the_post_thumbnail('thumbnail-portfolio'); ?>
<?php the_title(); ?>

<?php the_excerpt(); ?>

                 <?php endwhile; ?>                 <?php else : ?>
No portfolio items were found! I'm not sure what you're looking for.
                 <?php endif; ?>                 <?php wp_reset_query(); ?>

          <?php get_template_part( 'contact' ); ?>


get_option() will not work without access to wp-config.php

I've created a plugin. In the initialisation file of my plugin I created an options page with some options to be stored by the admin.               <form method="post" action="options.php">             <?php settings_fields( 'settings-group' );             do_settings_sections( 'settings-group' );             ?>                 API key
                 <input type="email" name="apiemail" value="<?php echo get_option('apiemail'); ?>">
<input type="submit" value="Save" class="button-primary" />
     </form>      This works correctly and options are saved. In **another file** within the plugin folder, I need to get these options back and store them in variables.               $apiemail = get_option('apiemail');      However I get the error:               Fatal error: Call to undefined function get_option()      It seems this file has no concept of get_options. I can get it working if I include an abs path to `wp-config.php`               require_once('../../../wp-config.php');      This then gets the options correctly. But the "require" of wp-config conflicts later on with me trying to do `header(Location:)`               Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/syyco/wp-config.php:85)      **So how do I use`get_option` in this file without `require` of `wp-config` ?** Edit: As requested, more detail regarding what I am trying to acheive. I am creating a newsletter signup plugin which submits an email to an external API. The customer will see an input box, pop their email in and it will be added. Once it's added, I want to reroute them to a success page. I have created a plugin which consists of two files. **Dotmailer.php** is my plugin initialisation file. Included is the creation of the plugin, the creation of an admin menu item and an options page. The options page has a bunch of admin login details needed by the API. This file also creates a widget (the front-facing part of the plugin) with the custom email input box. The widget is pretty simple. It's a form with one input. It POSTs the email address data to another script called **dotmailer-add.php** , also in my plugin folder. **dotmailer-add.php** takes the users email and sends it over to the API to be added to a mailing list. The API required an authorisation key. This auth key is one of the options I have asked the admin to set. **This is where the problem occurs**. Dotmailer-add.php file needs to use `get_option` to get the api key that the admin added through the dashboard. It cannot get this option, I get the error that get_option is undefined. If I `require` wp-config.php, then get_option works fine. You can see the code in it's entirety here. Dotmailer.php (the initialisation file) Dotmailer-add.php (the script that the widget form posts to)


Meta query relation 'OR' not working as expected

I have the following query, `$the_query = new WP_Query( $args );`, which is supposed to show any properties of H_property_type **bandb** , **hotel** _or_ **dining**. If I do a print_r of $args I get the following, which I would expect to work great:               Array(     [post_type] => property     [posts_per_page] => -1     [orderby] => H_featured     [order] => DESC     [meta_query] => Array         (             [relation] => OR             [0] => Array                 (                     [key] => H_property_type                     [value] => bandb                     [compare] => on                 )                  [1] => Array                 (                     [key] => H_property_type                     [value] => hotel                     [compare] => on                 )                  [2] => Array                 (                     [key] => H_property_type                     [value] => dining                     [compare] => on                 )         )     )      But for some reason this technique is only retrieving results for one of the checkboxes - i.e. they ALL have the H_property_type of hotel. What am I doing wrong? My arguments are set up using this bit of code:               if(isset($_GET['H_property_type'])){         if(count($_GET['H_property_type']) > 1){             $args['meta_query']['relation'] = 'OR';         }         foreach ($_GET['H_property_type'] as $type) {             $args['meta_query'][] = array(                 'key' => 'H_property_type',                 'value' => $type,                 'compare' => 'on'             );         }     }


How do you remove a broken theme from WordPress Admin (without FTP or Cpanel)

Is it possible to remove a broken theme from WordPress using only the WordPress dashboard? i.e, without using cpanel or FTP? Background: When you are doing customer support, its rare that you have access to the user's FTP or cpanel, but its pretty simple for them to set you up as a temporary user to troubleshoot their site.


query if on page/2/?

hey guys, is there a way to check if i'm currently not on the frontpage of my blog? I know there are conditional tags like is_home(). However that won't work if I'm on myblog.com/page/2/ I have a pagination on my frontpage that let's users jump to the next page. If I'm on the second page i want to show a "Back Home" link. any idea how I could achieve that? thank you.


Sort post's categories by ID

I have a blog in which several post's categories have to be outputted first before other categories. Those categories have lower ID compared to other categories. I am using `get_the_category_list` but it is not working as I expected. Makes me confused because I remember a theme doing this very well. Can someone point me in the right direction? Thanks!               <?php get_the_category_list( array(       'orderby'      => 'ID',       'order'     => 'ASC'     ) ); ?>


How to load and show comments with AJAX instead of pagination?

Is there a plugin that displays comments like this: http://img541.imageshack.us/img541/6541/47905634.jpg when the user clicks "read more", older comments are being appended to the list with ajax.


how to properly use comments-template.php

I want to modify comments form for both logged in users, and for those who are not. I modified the form for those who are not logged in by changing my comments.php but I'm not quite sure how to modify my form for logged in users. I know I have to use comments_template(), but when ever I try to use it in my page.php, I get errors like this               Notice: Undefined variable: args in {PATH}/twwr-theme/comments-template.php on line 13       these are the contents of my comments.php, its a bit messy               <?php     if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))         die ('Please do not load this page directly. Thanks!');          if ( post_password_required() ) {         echo "This post is password protected. Enter the password to view comments.";         return;     }     ?>
<?php comments_number('No Comments', 'One Comment', 'Comments' );?>

<?php previous_comments_link() ?>

<?php next_comments_link() ?>

         <?php //comment layout is in functions.php ?>         <?php wp_list_comments('callback=comment_layout'); ?>

<?php previous_comments_link() ?>

<?php next_comments_link() ?>

                    <?php if ( comments_open() ) : ?>                    <?php else : // comments are closed ?>
Comments are closed.
          <?php endif; ?>      ID); ?>


Excerpt Word Count

The code below from WPSnipps provides an excerpt character counter, but I'd like to count **words** instead. Does anybody have an idea of how to do this?               // Excerpt character count     function excerpt_count_js(){           echo '';     }     add_action( 'admin_head-post.php', 'excerpt_count_js');     add_action( 'admin_head-post-new.php', 'excerpt_count_js');


How to edit the Wordpress e-mail that gives the user their password?

Can't find the answer in the codex or on here. Just need to know what file to look in to find the e-mail template. The default e-mail that gets sent upon new user registration has a link which points to wp-admin, and I need it to point to frontend.


What do these phpMyAdmin errors mean on my WordPress databaes?

I'm getting 3 very similar phpMyAdmin errors on one of my WordPress databases.               More than one INDEX key was created for column `comment_approved`          More than one FULLTEXT key was created for column `post_title`          More than one INDEX key was created for column `lead_id`      Anyone know how to resolve these? ![alt text](http://i.stack.imgur.com/T0Ssk.png)


The $post variable – Did I get the grasp of how the Backend actions get parsed?

I was looking for a way to attach a custom meta box to the edit screen of a page at a specific template. I found and tried this here and from my actual point of view this can't work that way. Let me explain why I think so: To determine, whether I'm on a screen using a specific template I need reference the global $post. But since this function to create the meta box is hooked into the admin_init the global $post will not yet exist. So it has to put out an Error message, doesn't it? After those thoughts I tried to tie my meta_box_init function to edit_post, save_post and such. But the codex says, even they need $post to be set. So how could I achieve my page template specific meta box, really? Is there a clean solution?


loop with the last commenter on each post on specific category

Hi i have the following code that lists the posts from specific category and the date, post author, the last comment author, last comment date and the avatar for comment author for each post on the list but it shows only all posts from this category with the post author, date, title and a photo functions.php:                   <?php function Theme_get_post_blog()     {                                   $arrImages =& get_children('post_type=attachment&post_mime_type=image&post_parent=' . get_the_ID());                                   if($arrImages)                               {                                 $arrKeys    = array_keys($arrImages);                                 $iNum       = $arrKeys[0];                                 $sThumbUrl  = wp_get_attachment_thumb_url($iNum);                                 $sImgString = '' .                                   '' .                                 '';                                   }                              else                              {                                     $sImgString = '' .                                   '' .                                     '';                                    }                                                 $args_lastcom = array(                             'status' => 'approved',                             'number' => '1',                             'post_id' => get_the_ID()                                 );               ?>                               <div class="post" id="post-<?php the_ID(); ?>">

                     <?php echo $sImgString; ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">                             <?php the_title(); ?>

Posted <?php the_time('F jS, Y') ?>  By                             <?php the_author() ?>
                                  <?php                                         $comments = get_comments($args_lastcom);                             foreach($comments as $comment) :                             echo( get_avatar($comment->comment_author_avatar,64) . $comment->comment_author . '
');                             endforeach;                                  ?>

      blog_posts.php:               <?php function Theme_blog_posts_area_function(){    global $current_user;   get_currentuserinfo();  $uid = $current_user->ID;       ?>

<?php echo __("All Blog Posts", 'Theme'); ?>

                                                                                <?php                                       $args = array('post_type' => 'post', 'paged' => get_query_var( 'paged' ), 'category_name' => 'general', 'post_id' => get_the_ID());                 $my_query = new WP_Query( $args );                  echo '
 suggestion cat
';                   if($my_query->have_posts()):                    while ( $my_query->have_posts() ) : $my_query->the_post();                                          Theme_get_post_blog();                                      endwhile;                                           if(function_exists('wp_pagenavi')):                         wp_pagenavi( array( 'query' => $my_query ) );                       endif;                                      else:                   _e('There are no posts.','Theme');                                      endif;                                                                                ?>

            <?php dynamic_sidebar( 'other-page-area' ); ?>

                      <?php } ?>      this is what i want to make: ![enter image description here](http://i.stack.imgur.com/kbHA6.jpg)


Not able to access admin panel after updating WordPress database fails

After upgrading to WordPress 3.5.2 I can't log in to the control panel anymore. Instead, I'm redirected to /wp- admin/upgrade.php?_wp_http_referer=%2Fwp-admin%2F where I'm presented with a 'Database Update Required' message and an 'Update WordPress Database' button. When I click on the button the page reloads, runs for a couple of seconds, and then nothing happens. All I get is a screen with the WordPress logo at the top and nothing else. The URL of the page is /wp- admin/upgrade.php?step=1&backto=%2Fwp-admin%2F. I've tried various things to resolve the issue, without luck:   1. Wait for an hour to see if the problem goes away (the first page does say that "the update process may take a little while")   2. Tried to click the button in four different browsers   3. Checked the server's error log (no errors at the time of the upgrade)   4. Restored the database (I made a backup before I started the upgrade)   5. Renamed the folder of my theme   6. Renamed the plugins folder The only other solution I can think of is downgrading WordPress to an older version. Does anyone have a better idea please? PS - While searching for a solution I noticed a similar query was closed as "too localized". However, I reckon this is an issue "generally applicable to the worldwide audience of the internet". I'm not the first person to come across this issue, nor do I think I'll be the last!


How to disable Jetpack modules such as Stats?

I want to disable some of the Jetpack modules such as Stats in order to check if they make the web site slower or not. But I couldn't see an option to disable modules one by one. Of course, one can disable the Jetpack plugin as a whole. Is there a way to disable Stats module only? ![](http://i.imgur.com/Hg8cIhO.png)


How do I separate link levels in a custom menu walker?

I am trying to build a custom menu walker and I am unclear on how I would be able to build a UL for top level menu items and a separate UL for all menu items of lower levels. Essentially I am trying to output:

                 first level link A

                 first level link B

second level link A.1

third level link A.1.a

             second level link A.2

      Example http://christopheryanceyis.me/test.php Can I do this in a wordpress walker? If so, how?


Gravatar - Default IMG

Gravatar is slowing my website and I want to host mystery man on my main server. So this is my normal gravatar mystery man                     And I want to host it on my server, so I tried to use this php code               function my_own_gravatar( $avatar_defaults ) {           $myavatar = get_bloginfo('template_directory') . '/design/img/m.png';           $avatar_defaults[$myavatar] = 'DEFAULT SPEED';           return $avatar_defaults;       }       add_filter( 'avatar_defaults', 'my_own_gravatar' );       But then there is still gravatar and redirect that is slowing loading time                     F***ing gravatar - Can you please help me ?


Code to remove authors with no posts connected to them

I am looking for SQL code that I can run from phpmyadmin to remove all registered users on the blog that do not have any post associated with them.


Force WordPress to load a specific template

How would I force WordPress by code to load a template file on my home page? I know how to do it via the backend but I would like to create a plugin and have the option to set the front page from inside the plugin. Basically, I am looking for the code to force loading a template when the home page is being loaded. So instead of the `index.php` it would load the plugin template. I can't find anything about this.


Parse error on user_register

I am trying to add a matching system. When I signup it will loop through all users that have the same interest as me, interests are done in checkboxes and put in one array. This is my whole function:               function registerfunction(){              global $user_ID;                   $velden = array(           'SecondName' , 'street', 'Gender' ,            'postalcode' , 'Province' , 'kvknumber' ,            'Phone', 'phonemobile' , 'website' ,            'company_presentation' , 'beschikbaar_direct',           'beschikbaar_later' , 'vergoeding' ,            'waarkenjevan' , 'test', 'cv_id', 'var_id',            'get_id','kvk_id','dip_id',           'opleiding',"sys_knowledge","task_timespan",           "days_timespan","get_id1","get_id2",           "get_id3","get_id4",           "dip_id1","dip_id2","dip_id3");//de array waar de velden worden opgeslagen              foreach($velden as $item){             if (isset($_POST[$item])) {                 update_user_meta( $user_ID , $item , $_POST[$item]);             }         }              $args = array(             'blog_id'      => $GLOBALS['blog_id'],             'role'         => 'company',             'meta_key'     => '',             'meta_value'   => '',             'meta_compare' => '',             'meta_query'   => array(),             'include'      => array(),             'exclude'      => array(),             'orderby'      => 'login',             'order'        => 'ASC',             'offset'       => '',             'search'       => '',             'number'       => '',             'count_total'  => false,             'fields'       => 'all',             'who'          => ''         );              $gebruikers = get_users($args);                   foreach ($gebruikers as $user) {             $company_match_systeem = get_user_meta($user->ID,'Match_systeem');             $company_match_duur = get_user_meta($user->ID,'Match_duur');             $company_match_opleiding = get_user_meta($user->ID,'Match_opleiding');             $matching_check = get_user_meta($user->ID , 'Match_check');                       if($_POST['opleiding'] == $company_match_opleiding){                      wp_mail('Dennissnijder97@gmail.com', 'Er is een nieuwe match voor u beschikbaar!', 'er is een match gevonden!' );                  }                       //parse error moet gefixt worden             $match_opleiding_result = array_intersect_assoc($_POST['opleiding'] , $company_match_opleiding[0]);                  wp_mail('dennissnijder97@gmail.com' , 'subject' , var_export($match_opleiding_result , true));             wp_mail('dennissnijder97@gmail.com' , 'subject22' , var_export($_POST['opleiding'] , true));             wp_mail('dennissnijder97@gmail.com' , 'subject232' , var_export($company_match_opleiding , true));              }          }          add_action('user_register' , 'registerfunction');      When I try to register it will say `parse error`, but all fields are getting registered, and I get an email with a notification. I just don't understand how this is happening.


Upgrade Nightmare - No Posts, Permissions Issues and Can't Create a new post

Symptoms:   1. Can't view ANY previous Posts, but the correct totals are listed by class - published, draft....   2. When creating a new post - no save or publish button   3. Unable to administer ANY plug-ins - error message: You do not have sufficient permissions to access this page What Has Changed? Upgraded from 3.0.2 to 3.0.1 or something like that, I was clearly on 3.x What Have I Attempted?   1. validated the roles and access values were correct for the admin user in database tables   2. Created a new admin   3. Changed admin user values to something else and back    4. Changed to default template   5. Disabled ALL plug-ins   6. Re-installed latest version What would you do next?


Default, locked sorting of posting fields

Is there anyway to disable custom dragging and sorting of the posting fields in admin? From time to time, the fields gets dis-ordered, and I have to sort them back to the way I want it, witch is kinda annoying. I want this also because I'm going to have other editors on the site, and I want a standardized order for everybody. I also want the excerpt-field to be above the content-field. Is all this possible?


When use a cache system with WordPress

(sorry if this is duplicated but I couldn't find anything related) I have an WordPress 3.0.3 instalation with some custom coding and tried the W3 Total Cache plugin but had some problems...so I've decided to deactivated it. And now I'm wondering that there are any average number of daily visits that becames necessary the use of a cache system. I'm not saying with this that I don't want to use a cache system, but only managing priorities. Thanks in advance!


Speed up MU Wordpress on Apache VPS?

I have a wordpress multisite 3.6 with 1 main site and 5 subdomains(with mapping domains) I am tried to make it faster, i install the W3 Total Cache plugin i add on my apache the APC 3.1.13 yum install httpd-devel pecl install apc > Enable internal debugging in APC [no] : no Enable per request file > > info about files used from the APC cache [no] : no Enable spin locks > > (EXPERIMENTAL) [no] : no Enable memory protection (EXPERIMENTAL) [no]: no > Enable pthread mutexes (default) [no] : yes Enable pthread > > read/write locks (EXPERIMENTAL) [yes] : no edit php.ini after line eaccelerator.shm_ttl="0"               apc.enabled="1"     apc.shm_segments="1"     apc.shm_size="128"     apc.ttl="7200"     apc.user_ttl="7200"     apc.num_files_hint="1024"     apc.mmap_file_mask="/tmp/apc.XXXXXX"     apc.enable_cli="1"      and on my shh add this command lines               service httpd restart          php -r 'phpinfo();' | grep 'apc'      but i can see big difference :/ **on gtmetrix (but is not solid everytime that i test)** **Before** B (82%) D (62%) 7.88s 1.67MB 118 **After** A (92%) +10% C (73%) +11% 5.33s -2.55s 1.33MB -344KB 101 -17 **on pingdom (but is not solid everytime that i test)** **Before** Page size 1.5MB Load time 3.78s Requests 133 **After** Page size 1.2MB Load time 2.58s Requests 129 This my phpinfo and this my w3 total case setup what I have done wrong and i have something else to add on my server or on my multisite?


Showing sticky posts with get_posts()

I'm using this to retrieve posts on my index page:               <?php $posts = get_posts( "category=13&numberposts=2" ); ?>      <?php if( $posts ) : ?>     <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>           [code]      Is there a way to include sticky posts on loops like that one? Or I'll have to use WP_Query?


Auto delete Wordpress users according to time

In my wordpress site spam users are registered so i am add mail confirmation to my resister area. And my problem is how can i delete users when not check or activated the mail. > is it possible to automatically delete users that are x days old? if the user is 7 days old and not active his profile are automatically deleted from the database once every day? If so, could someone please explain how? i am using `tecla_users` field in my database.


Child theme only loads on home page

I was having the following problem: I created a child theme, it was 'correct', technically. It even worked and displayed the proper changes, and when I navigated to sub-pages (ie not the home page), the child theme's effects seemed to vanish.


Plugin activated but plugin files nowhere to be found

I installed ThreeWP Broadcast through the WP backend and it works fine. But where can I find the associated PHP files? I've tried looking in the plugins and mu plugins folder of wp-content.


How can I get $id variable in widget's form function? According to widget's structure I see that widget function have $args as a parameter, which will be extracted in function's body. In my case i want to use $id variable (from extracted $args) which contains current sidebar's id. How can I make 'visible' $id variable in form function? Any ideas?               class Ex_Widget_Example extends WP_Widget {         //constructor goes here         function widget($args, $instance) {extract($args);}         function update($new_instance, $old_instance ) { }         function form( $instance ) {}     }      For example we have sidebar with id 'my_sidebar'. I put this widget in it. For example my widget function, which we use to output something on page, looks like this:               function widget($args, $instance) {              extract($args);              echo $id; //or just echo $args['id'];     }      So on my page, in my 'my_sidebar' sidebar I will see a text 'my_sidebar'. That's great. But how can I get this $id or $args['id'] in widget's form function. In class example I see, that only widget function takes $args as argument. I'm not an expert in OOP pragramming, I tried to create a static variable (unsuccessfully), which would keep id value:               class Ex_Widget_Example extends WP_Widget {         public static $widget_id;         //constructor goes here         function widget($args, $instance) {                  extract($args);                  self::$widget_id = $id;                  echo self::$widget_id //here outputs sidebar's id perfectly on my page         }         function update($new_instance, $old_instance ) { }         function form( $instance ) {                  echo self::$widget_id //here outputs nothing on my widget's form         }     }      Maybe wordpress call form function first, before widget function, that's why I can't see anything on my form ....anyway, any ideas how to solve this problem?


Function to allow single post template based on custom taxonomy?

I'm trying to use Justin Tadlocks function for category specific custom post templates, but have become stuck when trying with a custom taxonomy, as his examples only have normal categories. Can this be edited to work with custom tax's? Thanks for any help :)


How does "Your comment is awaiting moderation" work?

The question here is if someone could help me to make the comment "Your comment is awaiting moderation" work correctly for custom page. It works ok for standard Wordpress page but not for my own page. I use native wp function `get_comments()` and `wp_list_comments()` to get and display comments. If I submit new comment that awaits moderation the comment and the message `Your comment is awaiting moderation` is accessible to anyone. I always thought that the awaiting comments is visible only to the user that submitted the comment. If it's not the case what is purpose of the message if anyone is able to see the comment? The one purpose I can think of is that it is a kind of notice that this comment will be moderated in the future and could be deleted. If really everyone can see the comment that it would make sense if the message reads `This comment is awaiting moderation`. Is there any way how to change the text of the message from a plugin? # UPDATE ok, so it is my code. If I display the page using standard wp way it works ok. If I use my code it doesn't work (meaning everyone can see the comment with awaiting message. Would someone know what I need to add to my code to make it work? I use just two above functions. The code is something like that               $comments =     get_comments(array(         'post_id' => $post_id,         'status' => 'approve'      ));         wp_list_comments(array(     //              'page' => 1,             'per_page' => 10,             'avatar_size'   => 16,         ), $comments);


Custom Post within a custom post

I have a custom post called "A". I have created another custom post called "B". I want the hierarchy of B to be a sibling of A, that is http://www.mysite.com/A/B/name-of-post I have A as a custom post type because I want to change the layout, and make it loop through all the items of A and B has another style of it's own. Everything works, when I see the archive of A I see the posts for type A, and same as B (see the posts of B) but when I click on the archive of B to see each individual post, I get NOT FOUND (and yes I have gone to permalink settings). These are my rules: For post type A:               $args = array(         // ... other args removed for clarity         'rewrite' => array( 'slug' => 'A' )         // ...     );      For POST TYPE B:               $args = array(         // ... other args removed for clarity         'rewrite' => array( 'slug' => 'A/B' )         // ...     );      Appreciate any help on the matter.


Changing URL scheme, mod_rewrite not helping

We're trying to move away from the /YYYY/MM/DD/Post-Title URL structure without breaking links that are floating around on the internet. The mod_rewrite rule is fairly straight forward -               RewriteRule [0-9]+/[0-9]+/[0-9]+/(.*)$ /$1 [R=301,L]      And it works fine (in that it redirects to the non-existent /$1 pages) UNTIL I change the URL scheme on Wordpress. Presumably, Wordpress is fiddling with the URLs itself in a way that's breaking things. I imagine it's something many people have done before, can anyone point me in the right direction? Thanks.               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /blog/          RewriteRule [0-9]+/[0-9]+/[0-9]+/(.*)$ /$1 [R=301,L]          RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /blog/index.php [L]     </IfModule>


Author template, filter sidebar widgets by author?

I'd like to be able to filter my sidebar widgets (tag cloud, category, archive) to only show those tags/categories/months that apply to a given author on the author template. What is the correct way to filter or modify these widgets? I found this page in the codex but it doesn't seem that the native functions for any of the widgets can accept an author id as a parameter.


WP Query orderby meta key natural sort?

I have this code:               $args = array(         'posts_per_page' => -1,         'post_type' => 'product',         'meta_key'   => 'custom key',         'orderby'    => 'meta_value',         'order'      => 'ASC',                 'no_found_rows' => true,         'cache_results' => false,         'include_children' => false,         'tax_query' => array(             array(                 'taxonomy' => $taxonomy,                 'field' => 'id',                 'terms' => array($cat_id)             )         )      );            $loop = new WP_Query($args);          When the custom key is like               FA3     FA1     FA10      the wp query orderby paramaters sorts this as               FA1     FA10     FA3      **when I want a nsort-algoritm:**               FA1     FA3     FA10      Is there any way of acheiving this with `WP_Query`? (Or is the only option to create an array and sort that array with `nsort()`)


How to display most recent posts that haven't already been displayed with WP_Query?

I have two content divs that each take up half of their containing div. My plan is to use WP_query to display the 6 most recent posts (3 in each.) It will go: Div 1 -> post 1, post 2, post 3 Div 2 -> post 4, post 5, post 6 At the moment however it is displaying like this: Div 1 -> post 1, post 2, post 3 Div 2 -> post 1, post 2, post 3 How can I get it to display the posts in the order of the first example? Please bear in mind that I'm still learning the Wordpress Codex.                       <?php                   $args = array(             'posts_per_page' => 3,             'orderby' => 'most_recent'             );                  $the_query = new WP_Query( $args );                  ?>
                  <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                      <a href="<?php the_permalink();?>">
<?php the_title(); ?>

Published on <?php the_date(); ?> by <a href="<?php echo the_permalink();?>"><?php the_author(); ?>
                 <?php the_excerpt(); ?>                  <?php endwhile; else: ?>                  <?php endif; ?>                            <?php wp_reset_postdata(); ?>
                  <?php                        $args = array(             'posts_per_page' => 3,             'orderby' => 'most_recent'             );                  $the_query = new WP_Query( $args );                  ?>
                  <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                      <a href="<?php the_permalink();?>">
<?php the_title(); ?>

Published on <?php the_date(); ?> by <a href="<?php echo the_permalink();?>"><?php the_author(); ?>
                 <?php the_excerpt(); ?>                  <?php endwhile; else: ?>                  <?php endif; ?>                  <?php wp_reset_postdata(); ?>


wp_get_attachment_image_src() width and height boolean

I have the following code in my theme:               <?php     $size = 'large';     $postimage = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $size );     $url = $postimage[0];     $h = $postimage[2]     ?>          <div style="background-image: url(<?php echo $url; ?>); height: <?php echo $h; ?>;">
      Here's an example `var_dump` output for $postimage:               array(3) {      [0]=> string(99) "{base url here}/uploads/2013/10/h3greendeck.jpg?fit=660%2C660"      [1]=> bool(false)      [2]=> bool(false)     }      If I remove the `size` argument for `wp_get_attachment_image_src()` to let it use default I get the same result. Why is size returning boolean, when WordPress knows the size of the image? This happens for every single instance of this code, regardless of the post I'm viewing.


Where to update the Static Pages Blacklist for Multisite Install?

_**Where in the menu system is the link to this blacklist?_** As referenced in the codex https://codex.wordpress.org/Multisite_Network_Administration > Also note that the blog prefix is not used for static pages which will be > accessible directly under the base address, e.g. domain.com/PAGENAME. If you > try to create a static page in the first site with the name of another > existing site on the network, the page's permalink will get a suffix (e.g. > domain.com/PAGENAME-2). If you create a new site with the slug of an > existing static page, the static page will not be reachable anymore. To > prevent this, you can **_add the names of your static pages to the > blacklist_** so that no site with that name can be created. After a few different searches I cannot find another reference to this static pages blacklist. I want to add a few pages like "contact,about,ect...". I have my wordpress setup and using multi-site.


get_post_meta($post->ID, 'Begin', true); don't give me numerical value

I'm trying to use the jquery plugin Timeago. With this, I want to countdown from a date (2013/03/04 format) Which is in a custom field. Echo $Begin2 gives me something like : 34 days ago. It's work fine. The problem is I want to take the number "34" as a numerical value. With the following code, echo $Nombre gives me "0". I think it's because get_post_meta($post->ID, 'Begin', true); is not a numerical value ?                  $Begin = get_post_meta($post->ID, 'Begin', true);        $Begin2 = '<abbr class="timeago" title="'.$Begin.'">'.$Begin.'</abbr>';        echo $Begin2;        $Nombre = (int) substr($Begin, 0, strpos($Begin, ' '));        echo $Nombre;      Thank you for your help !


User count only for role frontend vendor

i use the following code for count the authors                   $count_posts = wp_count_posts( 'download' );         echo 'Published eBook (' . $count_posts->publish .  ')';         echo ' ';         global $wpdb;          $user_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->users;" );         echo '  Published Authors (' . $user_count . ')';      i need a count from authors who have the role frontend vendor or who have published a downlaod post. any idea? thanks for help


"admin_enqueue_scripts" hook or $_GET['page']?

When adding a function to "admin_enqueue_scripts" a hook is passed to the function. It looks like this "toplevel_page_nameofyourpage". That works great, but how is it different from checking the $_GET variable to see which page you are on? Is one preferred over the other? Why? I'm only talking about when you create your own menu, not the default admin pages.


How to add an admin function only to posts, not pages?

I'm having a problem with adding an excerpt counter to the excerpt field. It may be a conflict with another plugin, but basically it screws with other jquery if the excerpt field doesn't exist (e.g.: when it's a page which doesn't have an excerpt). Some issues that occur are: kills admin nav fly-out, media button doesn't work... Is there a conditional I could use that would only add this function if it is a post, or if it has the excerpt field? I have several custom post types, and the default posts all using the excerpt field. Here is the code I have so far, but I can't figure out what conditional would make this work:               function excerpt_count_js(){         if(possible_conditional_here()) {               echo '';           }           return;     }     add_action( 'admin_head-post.php', 'excerpt_count_js');     add_action( 'admin_head-post-new.php', 'excerpt_count_js');      I've tried these (none of which worked): `if(post_type_exists())` - doesn't display at all   `if(!is_page())` - doesn't change anything


How to reduce three query to one in multiple output template?

I would like to publish 7 posts from the same category but embedded in different DIV or UL. How could I simplify this code?               <?php     $query01 = array( 'numberposts' => 1, 'offset'=> 0, 'post_type' => array('product') );     $query02 = array( 'numberposts' => 3, 'offset'=> 1, 'post_type' => array('product') );     $query03 = array( 'numberposts' => 3, 'offset'=> 4, 'post_type' => array('product') );     ?>

     get_posts( $query01 ) -> FOREACH WITH ONE POST

     get_posts( $query02 ) -> FOREACH WITH THREE POST

     get_posts( $query03 ) -> FOREACH WITH THREE POST


Logout/login redirect CSS issue

I'm using WordPress Multisite. When I use `wp_logout_url()`, I get redirected to the login page but somehow I end at a different login page without any styles applied                  <a href="<?php echo wp_logout_url(); ?>" title="Logout">Logout      That's the only logout function I'm calling. And my login functions look like this:                 // 1. Custom login CSS     function my_login_stylesheet() { ?>     <link rel="stylesheet" id="custom_wp_admin_css"  href="<?php echo get_bloginfo( 'stylesheet_directory' ) . '/style.css'; ?>" type="text/css" media="all" />     <?php }     add_action( 'login_enqueue_scripts', 'my_login_stylesheet' );          // 2. Change logo URL     add_filter('login_headerurl', 'my_custom_url');     function my_custom_url(){     return "http://mydomain.com/domain";     }          // 3. Add personal message to login          function custom_login_message() {     $message = '
KOMM - App
';     return $message;     }     add_filter('login_message', 'custom_login_message');          // 4. Change login button text          add_action( 'login_form', 'wpse17709_login_form' );     function wpse17709_login_form()     {         add_filter( 'gettext', 'wpse17709_gettext', 10, 2 );     }     function wpse17709_gettext( $translation, $text )     {         if ( 'Log In' == $text ) {             return 'OK';         }         return $translation;     }          // 5. Redirect user to index-page after login     add_filter('login_redirect', 'plugin_admin_redirect');      function plugin_admin_redirect($redirect_to, $url_redirect_to = '', $user = null) {          return get_option('siteurl');          }       I guessing that I need to apply function 1 and 2 to the `wp_logout_url()` function to get the CSS applied. I've been trying for long now. Login page: ![Login page with css applied before login](http://i.stack.imgur.com/6tZsL.png) And when I logout I get to next screenshot: ![enter image description here](http://i.stack.imgur.com/smL1D.png) Logout/login page that I'm being redirected to: ![Login/logout without stylesheet applied](http://i.stack.imgur.com/rcxSy.png) I would appreciate if someone could explain or get me on the right path. **NOTE:** _Login link:_               /wp-login.php?redirect_to=http%3A%2F%2Fdesignmobile.se%2Fgomobile%2Fkrisdemo%2Fwp-admin%2F&reauth=1      _Logout link:_.               /wp-login.php?action=logout&redirect_to=http%3A%2F%2Fdesignmobile.se%2Fgomobile%2Fkrisdemo%2F&_wpnonce=17d70b468f


Custom permalink structure gives 404

For a Custom Post Type called 'matches' I created a custom permalink structure. The structure shows up just the way I want it, however, I get a `404` everytime I visit the post. I have tried removing the `.htaccess`, re-saving the permalinks, flushing the rewrites etc. None of it did any good. The code I use is as follows:               <?php     add_action( 'init', array( $this, 'match_permalink_structure' ) );     add_filter( 'post_type_link', array( $this, 'better_match_permalinks' ), 10, 3 );          function match_permalink_structure() {         global $wp_rewrite;              $structure = trailingslashit( __( 'match', 'apollo' ) );         $structure .= trailingslashit( '%year%/%month%/%day%' );         $structure .= trailingslashit( '%matches%' );              $wp_rewrite->add_rewrite_tag( "%matches%", '([^/]+)', "matches=" );         $wp_rewrite->add_permastruct( 'matches', $structure, true );     }          function better_match_permalinks( $permalink, $post, $leavename ) {         $rewritecode = array(             '%year%',             '%month%',             '%day%',             $leavename ? '' : '%matches%',         );              $timestamp = get_field( 'match_datetime', $post->ID );              if( ! empty( $timestamp ) ) {             $year = date( 'Y', $timestamp );             $month = date( 'm', $timestamp );             $day = date( 'd', $timestamp );         } else {             $year = date( 'Y', strtotime( $post->post_date ) );             $month = date( 'm', strtotime( $post->post_date ) );             $day = date( 'd', strtotime( $post->post_date ) );         }              $rewrite_replace = array(             $year,             $month,             $day,             $post->post_name,         );              $permalink = str_replace( $rewritecode, $rewrite_replace, $permalink );              return $permalink;     }     ?>      I have installed Rewrite Rules Inspector and that gives me the following for matches: > wedstrijd/[0-9]{4}/%month%/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$ > index.php?attachment=$matches1 matches > wedstrijd/[0-9]{4}/%month%/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$ > index.php?attachment=$matches1&tb=1 matches > wedstrijd/[0-9]{4}/%month%/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ > index.php?attachment=$matches1&feed=$matches[2] matches > wedstrijd/[0-9]{4}/%month%/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ > index.php?attachment=$matches1&feed=$matches[2] matches > wedstrijd/[0-9]{4}/%month%/[0-9]{1,2}/[^/]+/attachment/([^/]+)/comment- > page-([0-9]{1,})/?$ index.php?attachment=$matches1&cpage=$matches[2] matches I think that means that something is going wrong with `%month%` maybe? I am not sure. Does anyone have any idea what I could possibly be doing wrong, or what I need to do to fix this issue?


Wordpress MU wp_posts table

We have wordpress MU and have wp_*_posts tables and wp_posts table. They both seem to get updated. Why are there 2 sets of tables for posts? I was reading somewhere that each blog is suppose to keep track of their posts. I also have noticed that wp_*_posts doesn't always have the excerpt. Do you think something is wrong with our install?


wpdb inside foreach loop only returns first result - 2 other similar cases found

@Milo Problem solved, found spaces in the array $arrname. I was trying to get post id using post_name. First of all I stored all post_name in an array an then loop through the array to use the key variable in a wpdb query to get post id, really strange though, it only returns the first post id. As you can see I tried to output the array and it works fine, outputs every key value in that array,but the wpdb query only return the first result(tried switch the order of the key values in the array, confirmed that it only output the first result.). Any ideas?               global $wpdb;     $rawname=$_POST['image_post_name'];     $arrname=explode(",", $rawname);     foreach ($arrname as &$value) {     $mypostid = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name='$value'"));     echo $mypostid;     echo $value;}      Tried to add exit( var_dump( $wpdb->last_query ) );, found out only the first query got executed. string(49) "SELECT ID FROM wp_posts WHERE post_name='unamed3'" last query, "String(49)"?


Assign post format to categories

I'm looking for a way to allow Wordpress (via a plugin?) to assign a specific post format to categories. (I can assign categories via a third party like IFTTT) Then all my posts in a certain category will be formatted rather than just text posts.


Certain aspects of site suddenly not working in Chrome and Firefox

My site has been working perfectly in all browsers, until suddenly 2 days ago. Now in Chrome and Firefox, the main page accordion slider is stuck, the "log in" button is not functional, and a few other things. I have tried the site in Safari, Opera, Internet explorer and it still looks and operates as it should. I have cleared the cache and cookies in Chrome and Firefox multiple times hoping that was the problem, but it still appears broken. I even have switched and re-uploaded the theme, same deal. Also, I'm pretty sure it's not a plugin conflict, I have only installed one new plugin and it was days before this happened, and I have since deleted it. I also tried changing the DOCTYPE. Anyone have an idea of what has gone wrong? The site is www.fearlessblue.com (excuse the site, it's my first, and I'm definitely a noob). All the pages are locked for development, so that is not my concern)


Redirect Old .php URLs to New Wordpress Page

I have an old website that I'm revamping with a custom new Wordpress theme. The old site had a custom (non-WP based) downloads archive that mapped URLs like this: `/downloads/view.php?id=2` The ID maps to a download item in a separate MySQL database. I'd like to move everything over to Wordpress in this refresh and I'm going to be using a custom post type to handle the downloads section, with a custom field that maps the "old ID" to the new post. This isn't difficult and I know how to do this, but the issue becomes remapping the old URLs to the new locations. The issue I see is that the older URLs are all PHP files (have an extension of `.php`). How would I go about create a plugin or Wordpress function in my theme's functions.php file to redirect these old URLs to a new URL. Essentially, I just need to have a Wordpress function redirect from `/downloads/view.php?id=2` to `/downloads/2/`, or another more optimized URL (`/downloads/title-of-archive`). How would I go about handling pages with a URL of "`/downloads/view.php`" and "`/downloads/download.php`" and performing the redirect? I know I can use the `.htaccess` file, but I'd prefer to do this directly in a Wordpress plugin if possible for portability...


get_post_meta printing empty fields, but it shouldn't be

I'm trying to call some hidden custom fields into a meta box. The custom fields are the same - a maximum of five named _link and five named _url, with sequential numbers following (eg _link3). However, if the user has only filled in one link when submitting the post, I don't want the empty fields to appear. I have knocked up the following loop. In theory, it should do a get_post_meta for _link0, and if it isn't empty it should do the same for _url1, print the results, and advance the counter to process _link1/_url1. With _link0/_url0 contained in the database, those fields appear fine. What I'm finding is that because _link1/_url1 aren't in the database, the loop will print the first field correctly, followed by four more empty fields. I'm stumped. I've seen posts that suggest using !empty($link) and found that while it prints the first fields fine, the second fields will cause a fatal error (maximum execution time exceeded) and stop the page from loading. My code is below - am I overlooking something simple?               $i = 0;     do {            $link_key = '_link' . $i;            $url_key = '_url' . $i;            $link = get_post_meta($post->ID,$link_key,TRUE);            if (isset($link)) {               $url = get_post_meta($post->ID,$url_key,TRUE);               include(MY_PLUGIN_FOLDER . 'links.php');               $i++;            } else { $i = 5;}         } while ($i<=5);      links.php:
Link Name: <input type="text" name="link<?php echo $i; ?>" id="link<?php echo $i; ?>" value="<?php echo $i; ?>" /> URL: <input type="text" name="url<?php echo $i; ?>" id="url<?php echo $i; ?>" value="<?php echo $i; ?>" /><input type="button" class="addnew" value="Add Link" />


Custom taxonomy term as class?

I'm trying to add a class to a container within a query, ideally I'd like to use the terms from a custom taxonomy I have setup (guide-categories). As an example:               <div class="myclass *taxonomy term*">       -content-     </div>      Any help would be much appreciated, been looking around trying to find out how to do this for a while, but haven't had any luck yet!


How to get comment_ID by post_ID in wordpress

I used `get_comment()` but its parameter is `$comment_ID` which I has to enter manually for previous comments from `wp_comments` instead of that I need to get current comment means last updated comment author name based on the `post_ID`. However `wp_posts` and `wp_comments` are related with `post_ID` and `comment_post_ID`, so I can use SQL query to get comment_ID I tried `$wpdb->get_results('select comment_ID from wp_comments where comment_post_ID = 1')` its even manual process but at-least I want to pass comment_ID by fetching from database but could't do that query results nothing so is there any way to get current comment_ID for a post_ID I can get post_id by `$post->ID`.


Sorting a query by custom field date

**EDIT: Reworded the question for more clarity** I'm trying to sort by custom meta box data, which I am converting to a date using the `strtotime` function, but I'm having some difficulty. My chief problem seems to be a catch-22 with the `strtotime` function. If I use `strtotime` inside the loop (see below) I cannot use the UNIX time to sort by date. However, if I process the strtotime upon save (in functions.php), I run into a bunch of problems with the meta box updating / not parsing if the user edits the post or re-saves. Is there a simple solution to this? Here is the code... I just want to order these posts in ascending order by the custom date field (not the posted date). **EDIT: Fixed the array by adding a meta-key - solution still pending**                    <?php     $args = array(         "post_type" => "podcasts",         "meta-key" => "_date",         "orderby" => "meta_value",         "order" => "ASC"         );     ?>               <?php $podcasts = new WP_Query( $args ); ?>               <?php if ( $podcasts->have_posts() ) : while ( $podcasts->have_posts() ) : $podcasts->the_post(); ?>               <?php $podcast_date = get_post_meta($post->ID, '_date', true);?>     <?php $fixed_date = strtotime($podcast_date); ?>                **EDIT: Added relevant meta-box code (below) from functions.php** Note -- This code does not include the strtotime function anywhere because I'm currently using it on the page template. I could include it here, but I am not sure what to do to allow the user to edit posts / resave. Once the strtotime function runs upon save, wouldn't it change the meta-box date to something like 1327248252? If so, that won't parse the next time that post is saved, creating issues.               // Create podcast Meta boxes          function add_podcast_metaboxes() {     add_meta_box('podcast_info', 'podcast Information', 'podcast_info', 'podcasts',  'normal', 'high');     }          // podcast Meta Box          function podcast_info() {     global $post;          // Noncename needed to verify where the data originated     echo '<input id="podcastmeta_noncename" name="podcastmeta_noncename" type="hidden" value="' .     wp_create_nonce( plugin_basename(__FILE__) ) . '" />';          // Get the data if its already been entered     $week = get_post_meta($post->ID, '_week', true);     $date = get_post_meta($post->ID, '_date', true);     $description = get_post_meta($post->ID, '_description', true);          // Echo out the field     echo 'Week
What week of the series is this podcast?';     echo '<input class="widefat" name="_week" type="text" value="' . $week  . '" />';     echo 'Date
Enter the Date the podcast was recorded';     echo '<input class="widefat" name="_date" type="text" value="' . $date  . '" />';     echo 'Description
Enter the text you would like to display as a description on the media archives list.';     echo '<input class="widefat" name="_description" type="text" value="' . $description  . '" />';          }          // Save the podcast Meta box Data          function save_podcast_meta($post_id, $post) {          // verify this came from the our screen and with proper authorization,     // because save_post can be triggered at other times     if ( !wp_verify_nonce( $_POST['podcastmeta_noncename'], plugin_basename(__FILE__) )) {     return $post->ID;     }          // Is the user allowed to edit the post or page?     if ( !current_user_can( 'edit_post', $post->ID ))         return $post->ID;          // OK, we're authenticated: we need to find and save the data     // We'll put it into an array to make it easier to loop though.     $podcast_meta['_week'] = $_POST['_week'];      $podcast_meta['_date'] = $_POST['_date'];     $podcast_meta['_thumbnail'] = $_POST['_thumbnail'];     $podcast_meta['_seriesimg'] = $_POST['_seriesimg'];     $podcast_meta['_description'] = $_POST['_description'];          // Add values of $podcast_meta as custom fields          foreach ($podcast_meta as $key => $value) { // Cycle through the $podcast_meta array!         if( $post->post_type == 'revision' ) return; // Don't store custom data twice         $value = implode(',', (array)$value); // If $value is an array, make it a CSV    (unlikely)         if(get_post_meta($post->ID, $key, FALSE)) { // If the custom field already has a value             update_post_meta($post->ID, $key, $value);         } else { // If the custom field doesn't have a value             add_post_meta($post->ID, $key, $value);         }         if(!$value) delete_post_meta($post->ID, $key); // Delete if blank     }          }     add_action('save_post', 'save_podcast_meta', 1, 2); // save the custom fields


Comment moderation on custom post types

I know that I can require all of the comments on my site to be moderated, but is there a way of forcing moderation for a specific custom post type (i.e. my CPT "species") whilst allowing instantaneous comments across the rest of the site? Thanks in advance,


Create Wordpress child page from page actions

I am trying to add an option to create a child page from the wordpress all pages screen. I found this link, but cannot get it working properly. It is exactly what I need, but I need help fixing it http://sltaylor.co.uk/blog/easy-child-page-creation-wordpress/               function slt_childPageAction( $actions, $page ) {           $actions["create-child"] = 'ID . '" title="Create a new page with this page as its parent">Create child';           return $actions;       }       add_filter( 'page_row_actions', 'slt_childPageAction', 10, 2 );       function slt_setChildPage() {           global $post;           if ( $post->post_type == "page" && $post->post_parent == 0 && isset( $_GET["parent_id"] ) && is_numeric( $_GET["parent_id"] ) )               echo '';       }       add_action( 'edit_page_form', 'slt_setChildPage' );


Theme's window.open call goes to "Page Not Found"

I have a theme that has an uploader utility that opens in a popup window from the theme options page. Basically I have a button labeled "Upload" which has an onclick handler that calls window.open to load a popup window containing a php file that handles various upload tasks. The problem I'm encountering only occurs on less than 1% of all installations of the theme, but I'm unable to determine the cause. On these sites, the window.open call opens the popup window but the contents of the window is the WordPress default "Not Found" page (instead of my php upload handler file) Here is the call from functions.php                <button         type="button"          id="fileUpload"          onclick="window.open('<?php echo get_bloginfo('template_directory') ?>/upload-zip.php?action=uploadFile','popup','width=330,height=235,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no'); return false" />Add/Upgrade Templates      </button>      Note: to eliminate the upload-zip.php as a source of the problem, I've removed the contents and just placed this into it:               <php     echo "in upload file";     die;     ?>      However, it does not appear to get to this file before loading the wordpress "Not Found" page.


How to get grandparent of a given category

Just wondering what the best way to get the top-most level category (grandparent) of a given category assuming it has one? Example structure: Operating Systems - Mac - - Mountain Lion - Windows - - Windows XP I want to be able to somehow get the ID of the "Operating Systems" category from within the Windows XP category. Any suggestions?


Two language versions for each article

I have a Wordpress website that needs to be available in two different languages. We have the articles written in both languages already. I've seen a lot of solutions providing automatic translations but this won't work in this situation because we have to use translations produced by government approved translators. What would be a good solution to allow each article to have 2 versions and allow switching between them with a button or dropdown?


Creating a Front-end based User Search

I am working on a membership site which requires a front-end user search. I have been searching for an answer like a mad man, and I could really use some help! While there are several plugins that have this capability (WordPress Members List, AMR Users, etc.); none of them do exactly what I need, and by looking at their source codes, would be a huge mess to pick apart, and seems like it might a fruitless effort in the end anyway. I fully realize that I will likely need to write something custom myself here. The logic I need is actually very straight forward and simple in terms of how it needs to work. **User search logic goes like:** **1.** User enters another users USER ID # into a simple single search field. **2.** Upon submitting search, the user is taken directly to the members profile _Yes_ , users will search for other users by their _user ID_ (think of it as a membership number). There is a specific reason for this, which does make sense for the site. But I don’t want to get off the subject, just know that this requirement cannot be changed. I am thinking this shouldn't matter though, because if you can query “user_nicename” from the “wp_users” table in the database, you should be able to query the _“ID”_ field as well? I do not expect anyone to provide me with the entire code for this obviously, but it would be nice if you could give me some general direction (and perhaps examples if possible) on how I can go about this. I am having a difficult time wrapping my head around this for some reason. Thanks!


Is it safe update WordPress 3.4.2. to 3.5?

My wordpress 3.4.2 site have 25 activated plugin, so which is safest way to update ?


How to do multi site setup

A client wants to set up a multi site with tabs looking like this: | Home | About | Broker | Resources On the main site (meaning www.site.com), the links will be www.site.com/home, www.site.com/about, etc. Broker is a drop-down with Broker names that will be subdomains, like john.site.com. When the visitor clicks on an broker, and goes to the sudomain, they want all the tab links to be john.site.com/home, john.site.com/about, etc. Obviously they don't want to have to copy all the posts and pages over to the each subdomain that are the throughout the site. What is the best way of doing this?


Dynamic template serving, change theme_root using add_filter from current theme

Some plugins use the `'template'`, `'option_template'` and `'option_stylesheet'` to dynamically serve (alternative) wordpress templates. For example, Nathan Rice's `ServeDefaultToIESix`. For Example -               add_filter('template', 'change_theme');     add_filter('option_template', 'change_theme');     add_filter('option_stylesheet', 'change_theme');          function change_theme()      {         // Alternate theme         return 'AwesomeTheme';     }      Above code only works from a wordpress plugin. What i need, is to switch to alternative template, **_located in one of the subfolders_** of the current theme(template). Examples: display an alternative HTML5 theme, serve mobile users a minimal version of the site.. etc. I tried to use 'theme_root' and 'theme_root_uri' as below. But that isn't working.               // Extra lines to change the theme's root.     add_filter('theme_root', 'change_theme_root');     add_filter('theme_root', 'change_theme_root_uri');     //     add_filter('template', 'change_theme');     add_filter('option_template', 'change_theme');     add_filter('option_stylesheet', 'change_theme');          function change_theme()      {         // Display Alternate theme         return 'AwesomeTheme';     }          function change_theme_root()     {         // Return the new theme root         return WP_CONTENT_DIR . 'themes/OrigTheme/lib/AltThemes';     }          function change_theme_root_uri()     {           // Return the new theme root uri          return get_bloginfo('wpurl') . '/wp-content/themes/OrigTheme/lib/AltThemes';     }      Is this the correct way of doing it? Or does anyone know of the possible way to do so? Thanks in advance.


How to Disable Color Options?

This question is related to my earlier question, but I think it's specific enough to qualify as a standalone question. I am modifying an existing theme (the Twenty Ten theme that ships with WordPress), and I would like to completely control the colors used. The Admin Screen allows the administrator to select a background color, and this seems to be implemented in one of the actions that are automatically registered to the `wp_head` hook (listed by Bainternet here). So I would like to do two things:   * Remove the _Color Options_ menu from the Admin Screen when my theme is activated. Is this possible and if so, how would I go about doing this? (Links to documentation welcome!)   * Remove the automatically registered action to wp_head that controls the color. Which action in particular would be responsible for this? (rsd_link, etc?) Thanks for your help.


how to list all subdomain in wordpress multiuser

I need to show all sub domains/directory in my wordpress multiuser, for eg: blog1 blog2 blog3 Is their any template tags to do this? stuck with this help me out guys.


Wordpress Enqueue Script Chaos (jQuery & Foundation.js)

I've been working on building a theme for the past couple days now, and I've run into a wall. While I originally included foundation.js as an enqueued script, I couldn't remember why I had added it. Today, when I tried removing it (to improve page-load speed) from my functions.php file, it messed up all of my jQuery plugins. After some researching, I discovered that Foundation _already_ includes jQuery, so I was loading two instances of it at a time (I also loaded from the theme's js folder). So, now that I've removed foundation, my custom.js file commands don't work unless I prepend 'jQuery' instead of the simpler '$'. I think there's some part of my Wordpress install that I made bug out, even if I keep the 'Foundation' name reference with the jQuery file earlier called, the theme works. It's like it has to have that 'Foundation' name. Below I've included both my script calls, as well as my custom js file, in hopes that someone will be able to aid me in diagnosing this problem. Links: -Chrome Console Error Message -jQuery & Plugins shown loading in Chrome Console SCRIPT CALLS:               function register_js() {     if (!is_admin()) {         wp_deregister_script('jquery');         wp_deregister_script('foundation');         wp_register_script('jquery', get_template_directory_uri() . '/js/libraries/jquery-1.7.1.min.js');         wp_register_script('jquery-ui', get_template_directory_uri() . '/js/libraries/jquery-ui-1.8.16.min.js', 'jquery');         wp_register_script('superfish', get_template_directory_uri() . '/js/plugins/jquery.superfish.js', 'jquery');         wp_register_script('supersubs', get_template_directory_uri() . '/js/plugins/jquery.supersubs.js', 'jquery');         //wp_register_script('foundation', get_template_directory_uri() . '/js/plugins/jquery.foundation.js', 'jquery');         wp_register_script('custom', get_template_directory_uri() . '/js/custom.js', array('jquery','jquery-ui') );         wp_enqueue_script('jquery');         wp_enqueue_script('jquery-ui');         wp_enqueue_script('superfish');         wp_enqueue_script('supersubs');         //wp_enqueue_script('foundation');         wp_enqueue_script('custom');     }     }     add_action('init', 'register_js');      CUSTOM JS FILE:               $(document).ready(function() {          /* Menu - Superfish */     $('ul.menu').supersubs({          minWidth:    11,         maxWidth:    30,         extraWidth:  1         }).superfish({          hoverClass: "sfHover",          speed: 'fast',          dropShadows: false,          delay: 0,         autoArrows: false,         animation: {height:'show',opacity:'show'}     });          /* Blog Tabs */     $('#tab_controls').tabs({ fx: [ {opacity:'toggle', duration:'normal'},{opacity:'toggle', duration:'slow'}] });           });


Which action hook can I use when a featured image has been selected

I have made a plugin for wordpress which copies the image to another directory when a post has been edit. But if you only upload another featured image and don't save the post. The image has been attached to the post, but the post has not been updated. Which does not trigger my plugin function. Show which trigger (action hook) can I use to also copie the featured image? The action which I now use for the post edit is wp_insert_post(). I forgot the reason why I use wp_insert_post(), but maybe that's why it fails ;)