WordPress Members Area Permalinks based on username

In a particular scenario I want a site with membership areas that give users their own member's "space". I want a permalink structure as such http://example.com/joebloggs and extend on that such as http://example.com/joebloggs/stories/joes-story I thought of using custom posts at first then decided against it. I know some of you may suggest I use a story post type but what if that user was the controller and had like their own membership area of stories, games, reviews etc. To put in context, it's like a multisite only I do not require a multisite. Do I have to create a custom post type for each user dynamically or is there another way. I would love for somebody to point me in direction of the WordPress mechanism I should be using in the API. Thank you all for your help and suggestions. Many thanks, Mark.


WordPress AJAX calls not detecting language properly?

I have a WordPress multisite, which is in both english and french. On the french site, localization is working great (using `date_l18n()` for dates, and `__()`, etc. for the rest). When an AJAX call sends off to WP and returns data (the same rendering functions being called from initial page load and AJAX), however, they are returning English date values. **Example:** Date archive says "septembre 2013". You click the Next Month button, which sends off to AJAX and returns the new month header, and article listing. It's returning "October 2013" rather than "octobre 2013". Is this a known bug, or should I be submitting this to track?               function render_event_archive_month_header( $date = null, $echo = true ) {         $date_str = strtotime( $date );              if( ! $echo )             ob_start();              <?php echo date_i18n('F Y', $date_str ); ?>              <?php         if( ! $echo ) {             $data = ob_get_contents();             ob_end_clean();             return $data;         }     }      This is being passed a yyyy-mm-dd date value, like so               render_event_archive_month_header( '2013-10' );      from within my Ajax action callback.


Resources to learn OOP for WordPress plugins, custom post types, etc

In a plugin, I need to create a custom post type and the associated admin menu modifications with a class rather than procedural code. What is the basic skeleton that I need to build off of in order to do so, and how does that class get hooked into WordPress (i.e., how do I do the "add_action('init','register_my_custom_post_type'), etc. with a class)?


Page displays content from different query?

How can I reset all variables in order to get the actual page content? I keep getting the last post's content I've called from a news-box I've implemented - but need the actual page's content .. thanks


How to update user profile or inputing any data to the wp db from external site?

I need to update user profile field (mainly first name, last name, email and password) from an external website. Wordpress is installed on wordpress.domain.com and external website is at www.domain.com, and both are on two different servers. Now how can I update user data from the external site (www.domain.com)?


wordpress 3.5 tinymce height

I've just upgraded wordpress to 3.5 version and I noticed that TinyMCE Advanced Editor is not as tall as before. How can I change default tinyMCE height? **UPDATE** This is the screenshot of section I want to render higher than the default ![enter image description here](http://i.stack.imgur.com/9hWHg.jpg)


Role Capabilities: Add New Ones?

I'm trying to create a private type of community ... and the current `Capabilities` are great, except for the fact that I don't want users of a certain `Role` being able to see anything that someone else has created (posts, pages, etc) I'd love to be able to create some new `Capabilities` that would compliment my application, such as: `view_others_posts` ... I just don't want a user of a specific `Role` to see anything except what they've created. Another REALLY important example would be the Media Library ... I do NOT want users of a certain `Role` being able to see ANYTHING besides what they themselves have added to the Media Library. Make sense? ...for Admins, they can see all, but I need some serious private limits for users that belong to new custom `Role` Are there any ways of doing so?


Need help setting up a search form for wordpress

I want to set up a search function as a widget in wordpress. This is the situation that I have. 1- I have 3 custom post types 1.a: Each post type has custom fields and taxonomies.   1. I have regular wordpress section with categories and tags. So this is what I want the search to do: There will be a selection option in the search form, and when the user is going to search they will select from the following: a. entire site b. post type a c. post type B d. Post type D Thank you for your help. Please avoid suggesting a plugin. I am looking for custom functions that will search custom fields, custom taxonomies, and the post types. Thank you for taking the time to read this.


How to return loop contents

At times, I need to **return** the output of a loop (usually with `WP_Query` like in this example) for use in a shortcode or with a filter on `the_content`. The following code that uses object buffering works, but I've read in other places that buffering can be inefficient. I've seen HEREDOC too, but I don't see how that would work here unless I saved every template tag as a variable first (which seems inefficient again). So my question is, what's the best way to return the output of a loop?               <?php if ( $cms_pl_pages->have_posts() ) :     ob_start(); // start object buffering. we'll run the loop and spit out final contents.     echo '
';     while ( $cms_pl_pages->have_posts() ) : $cms_pl_pages->the_post();     ?>
             <?php has_post_thumbnail() ? the_post_thumbnail() : null; ?>             <a href="<?php the_permalink(); ?>" title="Read '<?php the_title(); ?>.'">
<?php the_title(); ?>
                          <?php has_excerpt() ? the_excerpt() : null; ?>
          <?php endwhile;     echo '
 ';     $content = ob_get_contents(); // set $content to buffered object     ob_end_clean(); // throw away the buffered object     endif; wp_reset_postdata();     return $content; // return! ?>


wp_enqueue_scripts called twice?

I had some problem with WP recognizing a is_single condition for loading scripts called in function.php. I put a error_log(is_single()) to check what was going on. When opening a post page the log showed me that log function has been called and the is_sigle() tag was positive the first time and negative the second! In the home or other pages it is shown only once. What's going on? Here's the code in function.php. I'm using a child theme.               add_action('wp_enqueue_scripts', function(){         error_log(is_single());         if (is_single()){             wp_enqueue_script('jquery_transform', get_stylesheet_directory_uri()."/js/jquery.transform.js", array('jquery'),'0.9.3',true);             wp_enqueue_script('zs_image_rotate', get_stylesheet_directory_uri()."/js/image_rotate.js", array('jquery_transform'),'',true);         }         wp_deregister_script('thickbox');     });


Displaying list of subcategories and not parent category

I have a blog which has three top level categories. Each top level category has a list of sub categories. I am displaying only certain top level category posts in certain sections of the website. When viewing the post I want to display something like: Posted under Cards, Races, Lifestyle These three categories would be children of a top leve category. How could I list these categories and exclude the top level category when listing how a post is categorized? Thanks.


Limit upload by file type only for certain custom post type

I have created a custom post type called "pdf". I've have a custom metabox where user can upload a pdf file throught wordpress builtin media uploader I need to restrict allowed files (pdf) only in this uploader. I already know how to restrict allowed files: How to set file type in wp_handle_upload? but the link above, interfer with all the uploads. Any hint? Thanks Edit: I've found how to limit file type in plupload, so I've solved half of the problem:                add_filter( 'plupload_init', 'my_plupload_init', 0, 1 );           function my_plupload_init( $plupload_init ) {      $plupload_init['filters'] = array( array('title' => __( 'Allowed Files' ), 'extensions' => 'pdf') );      return $plupload_init;     }      Edit #2: Use of wp_handle_upload_prefilter filter doesn't work: Thi is what is available inside $_REQUEST object after an image is uploaded on a new post:                   array       'type' => string 'image' (length=5)       'tab' => string 'type' (length=4)       'post_id' => string '0' (length=1)       '_wpnonce' => string '375c5f46f2' (length=10)       '_wp_http_referer' => string '/wp-admin/media-upload.php?post_id=' (length=37)       'html-upload' => string 'Carica media' (length=12)      There are no info about my custom post type. The id is 0 because post is not saved yet. Edit #3: Thanks to @TheDeadMusic answer I've added one line of code to my javascript. This is the js code I actually use that works great:               jQuery(document).ready(function($){     // #btn_upload is my custom button     $('#btn_upload').click(function(event){         event.preventDefault();         var backup = window.send_to_editor;         var src='';      //post_id is always set so I can pass it safely to tickbox         var post_id=$('#post_ID').val();      var target=$('#pdf_url');         window.send_to_editor = function(html)           {     //I have to get the link to "original file" from html returned by tickbox             link = $('a',html).attr('href');              $(target).val(link);              tb_remove();              window.send_to_editor=backup; //reset default action         }         //show the uploader          tb_show('', 'media-upload.php?post_id='+post_id+'&TB_iframe=true');          });           });


add 'file upload' field to user details

In the backend when a user goes to their detail page they can edit a few text fields. I want to add a custom field that allows the user to upload a file. I found something similar but its only to add extra text fields. add extra user fields


Adding %author% in custom post type URL structure?

I'm trying to do some WordPress URL rewriting ... Specifically I have custom post type that currently works like this: `http://mydomain.com/videos/post-title/` But I would like to have it located at: `http://mydomain.com/videos/author-name/post-title/` Is there any way to achieve this?


WP-TweetButton is not displaying the tweet button if this is set to "Manual."

I'm using the WP-TweetButton but when I set the settings to add the button manually. Nothing is displayed. Settings:![enter image description here](http://i.stack.imgur.com/D7XXd.png) The Code:

                                 <?php tweetbutton(); ?>

<?php if (function_exists('fbshare_manual')) echo fbshare_manual(); ?>

<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=standard&show_faces=false&width=450&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:60px">

<?php previous_posts_link( __( 'next →', 'twentyten' ) ); ?>
                     <?php endif; ?>
      I'm using Wordpress 3.1.2 and the last version of the plugin. Is anyone having this problem too? Have anyone managed to fix it?


Change theme per page or post

Is it possible to change the theme for specific page or post? Any recommended plugin for this?


Add an option in a builder

I try to add a list of project in the builder of DIVI theme. I have already managed to insert the project_tag list like this :
                 Choisir le(s) réalisateur(s):
                 <% var et_pb_include_project_tag_temp = typeof et_pb_include_project_tag !== 'undefined' ? et_pb_include_project_tag.split( ',' ) : []; %>     END;                          $tag_array = get_terms( 'project_tag' );                     foreach ( $tag_array as $tag ) {                         printf( '<input type="checkbox" name="et_pb_include_project_tag" value="%1$s"%3$s> %2$s
',                             esc_attr( $tag->term_id ),                             esc_html( $tag->name ),                             '<%= _.contains( et_pb_include_project_tag_temp, "' . $tag->term_id . '" ) ? checked="checked" : "" %>'                         );                     }     echo <<<END
Sélectionner le réalisateur.

       But I don't know how to do with parent custom type "project" Any suggestions?


Showposts doesn't show the number of posts indicated

on my homepage, I'm using several loops to display posts from different categories in various sections of the page. The code I'm adding before the loop is :               <?php query_posts('category_name=featured&showposts=5'); ?>      The loop comes just afterwards               <?php                   if ( have_posts() ) :              /* Start the Loop */                 while ( have_posts() ) : the_post();                 get_template_part( $layout, 'blog-'.get_post_format() );                 endwhile;             else :     ?>

<?php _e( 'Nothing Found', 'swift' ); ?>

<?php _e( 'Apologies, but there are no posts in the current context. Perhaps searching will help find a related           post.', 'swift' ); ?>
                     <?php get_search_form(); ?>

         <?php endif; ?>      And I copy paste this with the desired categories. Problem is eventhough I mention shoposts=5, 10 posts show up, whatever number I indicate. Do you guys have any clues please ? Thanks


how to add submenu item under parent menu item with code

Well, here is my problem suppose i have a menu like this generated by wp_nav_menu()               home     test- test1, test2     contact     about      test is my custom post type so what i want to do is if a user/admin publish posts a test post type i want it to automatically add in under test as test3.Forget about the publish_test hook i have done some research and i am ready to go with the code as follows in my functions.php               function auto_add_service_as_menu() {         echo 'ok';exit;          }     function auto_remove_service_from_menu() {         echo 'ok';exit;     }     add_action( 'publish_test', 'auto_add_service_as_menu' );     add_action( 'trash_test', 'auto_remove_service_from_menu' );      now what i want to do is add test3 which will be new test(cpt) post and its title and link should be automatically added to test menu. Note: I don't want anything to add or remove in admin dashboard or admin menu only to the user(wp_nav_menu). So any help would be helpful.Thanks in advance


How to check if post has previous_comments_link() and next_comments_link()

I'm using the following code for comments pagination (based on 2014 theme)               <?php if( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>

           <?php previous_comments_link( __( '← Older Comments', '' ) ); ?>

           <?php next_comments_link( __( 'Newer Comments →', '' ) ); ?>

     <?php endif; ?>      I noticed that if I'm on the first page, the `.previous` list item is still in the DOM. It's empty but still there.

      I tried to find a proper function in the Functions Reference, but found nothing. What I'm trying to do is to check conditionally if `previous_comments_link()` and `next_comments_link()` should be displayed. If not, then do not display the list item. I don't know if this is a good idea (semantic) to remove whole list item.


Passing variables in the permalink structure on a custom post type

I have a structure like this for my custom post types: domain.com/member/member-name/book/book-name Basically, I have a custom post type of member, and the member-name is the post. What I want to do is pass a variable called books, but I can't get my code to work. I've based my solution on one that has previously been asked on here but my structure is different, and I've googled and googled to no avail. I really cant get my head around rewrite structures either!                   function add_book_rewrite() {             add_rewrite_tag('%book_name%','([^&]+)');         }         add_action( 'init', 'add_book_rewrite' );              function add_book_rewrite_rules() {             add_rewrite_rule('^member/([^/]*)/book/([^/]*)/?','index.php?post_type=member&name=$matches[2]&book_name=$matches[4]','top');         }         add_action( 'init', 'add_book_rewrite_rules' );              add_filter( 'query_vars', 'add_query_var' );              function add_query_var( $query_vars ) {                  $query_vars[] = 'book_name';             return $query_vars;         }              echo 'Book is '.get_query_var('book_name');      Any pointers on this would be received with gratitude Thanks


Save & Reset button in theme-option with Ajax (without refresh)

I have a theme-options page and i will that the save and reset button loaded without refresh the whole page... but i have no idea, how i can implement ajax in my theme-option... Thank you for your help. The code is:               function mytheme_add_admin() {         global $themename, $dirname, $themeurl, $shortname, $options;                   if ( $_GET['page'] == basename(__FILE__) ) {                  if ( 'save' == $_REQUEST['action'] ) {                          foreach ($options as $value) {                         update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }                          foreach ($options as $value) {                         if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ]  ); } else { delete_option( $value['id'] ); } }                          header("Location: admin.php?page=admin_interface.php&saved=true");                     die;                  } else if( 'reset' == $_REQUEST['action'] ) {                      foreach ($options as $value) {                     delete_option( $value['id'] ); }                      header("Location: admin.php?page=admin_interface&reset=true");                 die;                  }                       else if( 'export' == $_REQUEST['action'] ) export_settings();             else if( 'import' == $_REQUEST['action'] ) import_settings();              }                           $rp_page = add_menu_page($themename." Options", "".$themename." Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');              add_action("admin_print_scripts-$rp_page", 'rp_load_only');         add_action("admin_print_styles-$rp_page",'rp_style_only');     }                     function rp_style_only() {     $file_dir=get_bloginfo('template_directory');     wp_enqueue_style("admin_style", $file_dir."/functions/admin/css/admin_style.css", false, "1.0", "all");     wp_enqueue_script("colorpicker", $file_dir."/functions/admin/js/jquery.color.picker.js", false, "1.0");     wp_enqueue_script("tabs", $file_dir."/functions/admin/js/jquery.tabs.js", false, "1.0");     wp_enqueue_script("custom", $file_dir."/functions/admin/js/custom.js", false, "1.0");     }               function mytheme_admin() {              global $themename, $dirname, $themeurl, $shortname, $options;                   if ( $_REQUEST['saved'] ) echo '

Options Saved

';         if ( $_REQUEST['reset'] ) echo '

Options Reset

';                              ?>

<?php _e("Options Panel","repra"); ?>

              <input type="submit" name="save" value="Save changes" class="button-primary" />         <input type="hidden" name="action" value="save" />

          <?php foreach ($options as $value) {     switch ( $value['type'] ) {     case "open":     ?>          <?php break;     case "close":     ?>
          <?php break;     case "title":     ?>              <div class="panel option-tab" title="<?php echo $value['name']; ?>">               <?php break;     case "header":     ?>

<?php echo $value['name']; ?>

<?php echo $value['desc']; ?>

          <?php break;     case "divider":     ?>

          <?php break;     case 'text':     ?>

<?php echo $value['name']; ?>
             <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" class="theme-input" />             <?php if($value['extras'] == "uploadbutton") { ?>Get Image<?php } ?>
<?php echo $value['desc']; ?>

          <?php break;     case 'text_small':     ?>

<?php echo $value['name']; ?>
             <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="text" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" class="theme-input text-small" />
<?php echo $value['desc']; ?>

          <?php break;     case 'dimension':     ?>

<?php echo $value['name']; ?>
             <input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="text" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" class="theme-input" />px
<?php echo $value['desc']; ?>

          <?php     break;          case 'textarea':     ?>

<?php echo $value['name']; ?>
             <textarea name="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" cols="" rows="" class="theme-textarea<?php if($value['height'] == "yes") { ?> large-textarea<?php } ?>"><?php if ( get_settings( $value['id'] ) != "") { echo stripslashes(get_settings( $value['id'] )); } else { echo $value['std']; } ?></textarea>
<?php echo $value['desc']; ?>

          <?php     break;     case 'select':     ?>

<?php echo $value['name']; ?>
             <select class="theme-select" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>"><?php foreach ($value['options'] as $option) { ?><option value="<?php echo $option; ?>" <?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option><?php } ?></select>
<?php echo $value['desc']; ?>

          <?php     break;     case "checkbox":     ?>          <div class="option <?php if($value['extras'] == "multi") { ?>multi-checkbox<?php } ?>">
<?php echo $value['name']; ?>
         <? if(get_settings($value['id'])){ $checked = "checked=\"checked\""; }else{ $checked = ""; } ?><input class="theme-checkbox" type="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> />
<?php echo $value['desc']; ?>

          <?php             break;     case "radio":     ?>

<?php echo $value['name']; ?>
               <?php foreach ($value['options'] as $key=>$option) {             $radio_setting = get_option($value['id']);             if($radio_setting != ''){                 if ($key == get_option($value['id']) ) {                     $checked = "checked=\"checked\"";                     } else {                         $checked = "";                     }             }else{                 if($key == $value['std']){                     $checked = "checked=\"checked\"";                 }else{                     $checked = "";                 }             }?>
                 <input type="radio" name="<?php echo $value['id']; ?>" id="<?php echo $value['id'] . $key; ?>" value="<?php echo $key; ?>" <?php echo $checked; ?> /><label for="<?php echo $value['id'] . $key; ?>"><?php echo $option; ?>
               <?php } ?>
<?php echo $value['desc']; ?>

          <?php             break;     case "colorpicker":     ?>

<?php echo $value['name']; ?>

                          <input type="text" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" class="cp_input" />             <div id="cp_<?php echo $value['id']; ?>" class="cp_box">               <div style="background-color:<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo '#fff'; } ?>;<?php if ( get_settings( $value['id'] ) != "") { echo 'background-image:none; border-color:' . get_settings($value['id']) . ';'; } ?>">

Click the text box for color picker.

               <?php             break;     case "import_export":     ?>              </form>

Import Theme Settings

If you have a back up of your theme settings you can import them below.
                  <form method="post" enctype="multipart/form-data">
<input type="file" name="file" id="file" />             <input type="submit" name="import" value="Upload" />
             <input type="hidden" name="action" value="import" />             </form>

Export Theme Settings

If you want to create a back up of all your theme settings click the Export button below. Note: This option only backs up your theme settings and not your post/page data.
                  <form method="post">
<input name="export" type="submit" value="Export Theme Settings" />
             <input type="hidden" name="action" value="export" />             </form>
          <?php             break;     }}     ?>

              <form method="post" onSubmit="if(confirm('Are you sure you want to reset all the theme settings?')) return true; else return false;">         <input name="reset" type="submit" value="Reset" />         <input type="hidden" name="action" value="reset" />         </form>

          <?php }           if (function_exists('wp_enqueue_style')) {         wp_enqueue_script('jquery-ui-core');         wp_enqueue_script('jquery-ui-sortable');                 wp_enqueue_script('thickbox');         wp_enqueue_style('thickbox');     }          add_action('admin_menu', 'mytheme_add_admin');           // Export Theme Settings     function export_settings() {         global $options;         header("Cache-Control: public, must-revalidate");         header("Pragma: hack");         header("Content-Type: text/plain");         header('Content-Disposition: attachment; filename="theme-options-'.date("dMy").'.dat"');         foreach ($options as $value) $theme_settings[$value['id']] = get_settings( $value['id'] );           echo serialize($theme_settings);     }          // Import Theme Settings     function import_settings() {         global $options;         if ($_FILES["file"]["error"] > 0) {             echo "Error: " . $_FILES["file"]["error"] . "
";         } else {             $rawdata = file_get_contents($_FILES["file"]["tmp_name"]);                   $theme_settings = unserialize($rawdata);                     foreach ($options as $value) {                 if ($theme_settings[$value['id']]) {                     update_option( $value['id'], $theme_settings[$value['id']] );                     $$value['id'] = $theme_settings[$value['id']];                 } else {                     if ($value['type'] == 'checkbox_multiple') $$value['id'] = array();                     else $$value['id'] = $value['std'];                 }             }              }         if (in_array('cacheStyles', get_option('theme_misc'))) cache_settings();         wp_redirect($_SERVER['PHP_SELF'].'?page=admin_options.php');     }          ?>


Moving existing media items to new upload path structure not updating full URL path

Have been developing a site and noticed that all of the media files were being saved in the default WP year/month/day rule in the `wp-content/uploads` directory. I decided to change this to `assets` and unchecked the option to store these in the date format. End goal here is to bring over all of the existing media to use that new path. I extracted all of the sub-folders into a flat list of files and then copied them over to the `assets` directory. Then, I tried editing the GUID for attachments to the new location -- still, no dice. Right now, it's referencing those old files as `assets/2012/08/01` instead of the new format. I've verified the option for storing media files in the date subdirectories is unchecked -- is this stored in a transient/cache somewhere that I can reset? I'm more than comfortable going through and running the needed SQL queries to update any post content with these in them, but a bit confused on why the URLs on the front-end are not updating to just `assets`). Thanks! _Update_ New files are being stored just in `/assets` and not the sub-date folders... really confused on these old file paths not working.


Displaying posts on Homepage

I am wondering how to add a column to my homepage that shows the five most recent posts from the blog page located under the "Latest News" heading. Here is the link to my development site. http://pur-vent.29kdev.com/ and below is the code that I believe I must edit to achieve this. If anyone could offer any advice I would greatly appreciate it. Thanks in advance.   * Mike ` ""               <?php if ( get_option('modest_featured') == 'on' ) get_template_part('includes/featured'); ?>          <?php if ( get_option('modest_blog_style') == 'false' ){ ?>
             <?php                  $blurbs_number = get_option('modest_use_third_page') == 'on' ? 3 : 2;                 if ( get_option('modest_use_third_page') == 'on' ) $blurbs_number = 3;              ?>             <?php for ($i=1; $i <= $blurbs_number; $i++) { ?>                 <?php query_posts('page_id=' . get_pageId(html_entity_decode(get_option('modest_home_page_'.$i)))); while (have_posts()) : the_post(); ?>                     <?php                          global $more; $more = 0;                     ?>                     <div class="blurb<?php if ( $i == 3 ) echo ' last'; ?>">
<?php the_title(); ?>
                                                 <?php the_excerpt(''); ?>
                  <?php endwhile; wp_reset_query(); ?>             <?php } ?>                  <?php if ( $blurbs_number == 2 ) { ?>

<?php esc_html_e('Examples of Our Work','Modest'); ?>
                     <?php query_posts("showposts=".get_option('modest_work_number')."&cat=".get_cat_ID(get_option('modest_work_cat')));                         if (have_posts()) : while (have_posts()) : the_post(); ?>                             <?php                              $width = 56;                             $height = 56;                             $titletext = get_the_title();                                  $thumbnail = get_thumbnail($width,$height,'item-image',$titletext,$titletext,true,'Work');                             $thumb = $thumbnail["thumb"];                             $fancybox_title = get_post_meta($post->ID,'Customtitle',true) ? get_post_meta($post->ID,'Customtitle',true) : get_the_title(); ?>
                                 <a rel="gallery" title="<?php echo esc_attr($fancybox_title); ?>" href="<?php echo esc_attr($thumbnail['fullpath']); ?>" class="fancybox">                                     <?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, 'item-image'); ?>
                           <?php                          endwhile; endif;                      wp_reset_query(); ?>
              <?php } ?>
      <?php } else { ?>
             <?php get_template_part('includes/entry','home'); ?>
           <?php get_sidebar(); ?>     <?php } ?>      `


Where to put snarfer.php?

I followed these instructions: http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates My understanding of those instructions was that the file snarfer.php needed to be in the folder 'themes', so it appears in the same list as the following folders and file: twentyeleven (folder) twentyeleven-child (folder) twentyten (folder) index.php …but when I put it there, and went to create a Page, the new template didn't appear as an option in the list Default Template / Showcase Template / Sidebar Template. So I tried putting snarfer.php in the folder 'twentyeleven-child' -- which is the active theme. And the new template now appears in the Template list when I create a Page. Do I have snarfer.php in the right place?


add_query_vars and canonical links

I have two pages, one called cities and the other called states. They use the add_query_vars function to grab the city and or state from a database. The pages load fine. For example when someone goes to sitename.com/roller- derbies/arizona/florence/ and the events in that city display. But when I view the page source and look at the canonical link inserted in wp-head it says sitename.com/cities or sitename.com/states after the page name. This creates a problem where none of my pages are being indexed by google as they all point to canonical link for cities or states. What can I do so the canonical link matches the url? Below is the code I am using.               add_filter('query_vars', 'add_query_vars');     function add_query_vars($aVars) {         $aVars[] .= 'var_state';         $aVars[] .= 'var_city';         return $aVars;     }          add_filter('rewrite_rules_array', 'add_rewrite_rules');     function add_rewrite_rules($aRules) {         $aNewRules = array(         'roller-derbies/([^/]+)/?$' => 'index.php?pagename=states&var_state=$matches[1]',          'roller-derbies/([^/]+)/([^/]+)/?$' => 'index.php?pagename=cities&var_state=$matches[1]&var_city=$matches[2]',          $aRules = $aNewRules + $aRules;         return $aRules;     }


Attaching images to multiple galleries

I've been wondering about this image/gallery issue for ages. So, I've got some images: lifestyle1.jpg, lifestyle2.jpg, lifestyle3.jpg, lifestyle4.jpg, kids1.jpg, kids2.jpg, kids3.jpg, outdoors1.jpg, outdoors2.jpg, etc.... I want to have three galleries:   1. **Homepage** —a mixture of all photos   2. **Lifestyle** —just lifestyle   3. **Outdoors** — just outdoors   4. **Kids** — just kids I can obviously make a page called Lifestyle, attach the lifestyles images and I'm all set with my Lifestyle gallery. How do I make my Homepage gallery a mixture of all pictures? ie: **Homepage** - lifestyle1.jpg, lifestyle2.jpg, kids2.jpg, outdoors1.jpg When all these photos are already in the media library. It seems so basic, yet I can't see a way to do it besides re-attaching and re-uploading the same images again. Thanks!


Use meta box value in CPT as post title

This has been addressed in another post, but the solution was too specific to apply here. My goal is to use a metabox value (ecpt_name) as the post title so that the user only needs to input their name once, and the name appears in both the admin post listing and online. As it is now, I require the user to input the post title as the full name AND in a metabox. This allows me to display the fullname online and show the fullname in the admin post listing, but it's double the work. Looking for something to put into functions.php that hooks the ecpt_name metabox value and places it into the post_title name. thx - Steve


Having a lot of difficulty getting add_editor_style() to load into source code

I have tried many different things to get `add_editor_style()` to load into the source code on my site without any luck. I would like to use `editor- style.css` to customize CSS properties for my WordPress WYSIWYG. However, I am unable to get it working. Even when I look in Chrome Inspector's Resources tab and scroll down to "Stylesheets" I don't see any listing of `editor-style.css` Here's what I tried so far:   1. Placed `editor-style.css` in the root of my theme directory   2. `<?php add_editor_style(); ?>` is placed in my `functions.php` file for my theme (I've even moved around this function call to editor style in my `functions.php` to see if that would do the trick … no luck.   3. All of my CSS and JavaScripts are registered and enqueued in my functions.php file Is there some type of override going on that I am not aware of?


variables in translatable text

I am adding a list of suggested plugins to my theme using TGM Plugin Activation - https://github.com/thomasgriffin/TGM-Plugin-Activation/ However, when I run theme check, about 40 or so recommendations popped up because the plugin uses variables in translatable functions. I was able to remove about half of the problems by typing in my text domain instead of using the variable used by the plugin author. However, I need help rectifying the error below: > RECOMMENDED: Possible variable $instance found in translation function in > class- tgm-plugin-activation.php. Translation function calls must NOT > contain PHP variables. Here's the code associated with the error:               $table_data[$i]['source'] = __( 'External Link', TGM_Plugin_Activation::$instance->domain );      I know that translation functions should look something like __('Item Name', 'text-domain'), but I am not sure what to do with the second part of the function:               TGM_Plugin_Activation::$instance->domain      How can I adjust this so that it will work properly with translations?


Dashboard widget custom positioning?

I cannot figure out how to arrange my custom widgets one left and one right. I'm using this code to create custom widgets:               //Add my comments. Shows user his last 5 comments     function dashboard_user_comments_widget_function() {         echo 'beh!';     }          function dashboard_user_add_comments_widget_function() {          wp_add_dashboard_widget('my_comments_user_dashboard_widget', 'My comments', 'dashboard_user_comments_widget_function');     }     add_action('wp_dashboard_setup', 'dashboard_user_add_comments_widget_function');      Is there a way to pass a left/right variable into this function? I read the codex page for it and the way they explain doing positioning is quite complicated, I don't know how to incorporate it.


Need to do blank search.

When there is no value for parameter "s" , it redirects automatically to homepage. Instead of this , I want to show all the information from my custom sql query. how can i do this??


Loop to display random posts only if a  custom field matches category

Working on a website and need loop that will show posts ONLY if custom field value is equal to the current category name. I have category 'fun' and custom field 'genre'. I would like to show on custom archive page only posts that are selected to be under category 'fun' AND at the same time if the value in custom field 'genre' is 'fun'. Order I prefer is most visited posts first at the top - if possible.


Custom field image to Featured Image

I'm changing the theme of a blog. The problem is when I export the content from the old post and import it into the new one, I don't get the Featured Image. It's the same problem posted here: Move from old custom field to new post_thumbnails Only that I couldn't get that solution to work for me… I'm kind of a noob. The original blog uses a meta key of "mainimg_medium" for the "featured image", and the new blog uses "_thumbnail_id". Any help would be greatly appreciated, Thanks!


Auto creation of multisite blog on user registration

I'm looking for a way to have users register on a multisite setup and have a blog automatically created for them... no, not the way the standard ms registration system handles it. I want to get rid of the second step in the process completely. They register as 'user', and a blog is automatically created at http://my.site.com/user for them. Followup question... anyone know of a way of automatically pruning the multisite platform? IE, users who don't login for 'x' timeframe (or after a certain time period has elapsed) automatically have their site deleted.


SEO meta description and title tag Yoast SEO

I am using Yoast SEO and a custom header. this obv means that any code that yoast uses to input all the seo stuff such as title tag and meta description wont be there. I solved the title tag by using this code:               <title><?php         /*          * Print the <title> tag based on what is being viewed.          */         global $page, $paged;              wp_title( '|', true, 'right' );              // Add the blog name.         bloginfo( 'name' );              // Add the blog description for the home/front page.         $site_description = get_bloginfo( 'description', 'display' );         if ( $site_description && ( is_home() || is_front_page() ) )             echo " | $site_description";              // Add a page number if necessary:         if ( $paged >= 2 || $page >= 2 )             echo ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) );              ?></title>      and that seems to work. however, how do i get the meta descriptions to work and anything else I may need?


Mass check a certain box in an option panel for 3000+ WooCommerce products?

I am using WooCommerce and have 3000+ products. With WooCommerce, there is an option to enable/disable reviews for each product. The box looks like this on my edit product page: ![snapshot](http://i.stack.imgur.com/dU1xo.jpg) Unfortunately, the checkbox (highlighted in red) doesn't come checked by default. I have contacted WooCommerce about this and they told me that this box being checked depends on whether or not I have comments enabled in _Settings > Discussion_. However, comments are, and have always been enabled, yet none of my products have the reviews option checked by default. This is a huge burden because this would potentially mean that I would have to browse through each of the 3000+ products and check off the box manually. Is another way I can "mass check" these boxes for each of my products?


Disable edit option in Media library

Hovering my mouse over a file name or a thumbnail brings up the Edit option, I want to know is there any hook to disable all edit links in Media library on Multisite ![enter image description here](http://i.stack.imgur.com/TqkR1.jpg)


Creating a widget that displays the content of a page

I have a page that displays information from a query (I placed the output of the query in a custom page template and have the information display that way). How can I put this information into a sidebar widget? Do I need to pull it from the page, or is there a widget that allows you to put a dynamic query inside? Thanks.


If is_single in functions.php

I want the remove wpautop filter working only on posts from my blog. Because at some pages i need the autop, and at some pages i need it to not be there. I use the following rule and it is in my theme's functions.php:               remove_filter( 'the_content', 'wpautop' );      Because I only want it on blogposts I was thinking about an if statement, I searched the conditional tags page in Wordpress and found out I can use is_single . But it doesn't work. This is the code I use now.               if(is_single() ){          remove_filter( 'the_content', 'wpautop' );     }      It is still wraped by an p. And even if it would have worked, there is an other problem. That is that is_single effects ALL singles from post types. And I only want the single of a blog post(posts). Anyone know how to fix it?


Automatically add <!--nextpage--> after X number of paragraphs

Is it possible to automatically add the `<!--nextpage-->` quicktag after X number of paragraphs? My client isn't exactly tech savvy so I'm trying to find a way to help them break up their enormous pages without them having to come back to me time and time again asking how to do it.


what is name of this plugin used for photo gallery page

i need to now what is name of this plugin that's used for image gallery page in this site


What's the best user registration library to integrate WordPress?

I'm looking for a library that can handle user registration (name, address, e-mail etc.) into my existing WordPress website. What options exist today, or will I have to pull my own?


remove tags from posts in php

I feel like this should be a simple question, but I can't figure it out. If I have a post_id, how can I remove a particular tag from that post in php?? I know how to update meta information, but tag information is different.


call widget from within shortcode

I have a shortcode in my functions.php which runs a query on a category. I want to have a twitter feed on this particular page. I have a javscript option working on my page for twitter right now but it doesn't look good and will take way to long to edit the javascript ( in minified format ) to make it look good, so I thought I would use a plugin. I installed one and it looks good but I need to call it in a very specific spot within the shortocode. I noticed as is, it calls the widget at the top of my page from within the shortcode which breaks the layout. I did some reading and it looks like using the_widget() would allow me to call it where I want and it did put text in the right spot. Problem was instead of putting my tweets, it put an error message. I figured that If I use the_widget with the classname of the widget as shown on this page that it would work                http://codex.wordpress.org/Function_Reference/the_widget      for example. The twitter widget I downloaded is called "simple twitter tweets" and I figured that I could do                the_widget('PI_SimpleTwitterTweets');      and it would work. I was wrong. `PI_SimpleTwitterTweets` is the classname of the widget. Am I on the right track and just missing something?


how to get list of post formats supported by theme?

After adding support for a selection of post formats like this:               add_theme_support( 'post-formats', array( 'aside', 'video' ) );      how can I then get the list of supported post formats back? I'm building a theme where the user can toggle support for postformat, and I want other admin elements to reflect what post formats the user has configured the theme to support. so I'm looking for something like               current_theme_supports( 'post-formats'); // outputs boolean      but that outputs just true or false, whereas I want to get an array of the post formats actually registered.. what would be the correct WordPress function to call (or constant/global var) to look at for this? I want something like this:               get_supported_post_formats(); // out: array('aside', 'video')


Admin area 'toggle' w/ cookie

the wordpress admin already uses some kind of toggle on the menu and on metaboxes.. w/ "Click to Toggle" buttons that remember the open versus closed state. Does anybody know what code is responible for this? I'd like to implement it into sections of my custom metaboxs, and it doesn't seem like I should need to add a script to the admin area (b/c it is already slow) when WP has this functionality by default.


Post IDs missing on delete_postmeta action hook

I'm using metadata in pages to store variables and do server side caching for dynamic generated PayPal buttons and other variables about the pages (page specific). I'm trying to hook the page meta data's update, add and delete functions. The update and add works fine (both with same function) but I can't figure delete out. In order to use delete_post_data I need the `post_id` but the `do_action` doesn't return that (at least what I can figure) from WordPress's source code it seems to return this:               do_action( 'delete_postmeta', $postmetaids ); //sometimes $post_meta_ids      where               $postmetaids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key ) );      or               $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid ));      The code I'm using to call the hooks:               add_action ('update_postmeta', 'wp_paypal_meta_change',1,4);     add_action ('add_postmeta', 'wp_paypal_meta_change', 1, 4);     add_action ('delete_postmeta','wp_paypal_meta_delete', 1, 2);      The delete function:               function wp_paypal_meta_delete($post_id, $meta_keys){     /*      handles cases where the user intentionally deletes the metadata, and deletes       the appropriate hidden metadata variable in order to make sure the cached       PayPal form matches the product data.      */              if ($meta_keys == 'image'){         delete_post_meta($post_id,'_thumb');         } else if ($meta_keys == 'shipping' || $meta_keys == 'cost' || $meta_keys== 'bookname'){         delete_post_meta($post_id,'_paypal');         }          }      I know the `$post_id` doesn't get into the function, but it's there because I hoped WordPress somehow references it - didn't work.


How can I post Facebook fan page status updates to my WordPress blog?

Is it possible to get an RSS feed of Facebook status updates from a Page rather than a Profile? I want to use the feed in WP's RSS feed widget. It's easy to pull statuses from a profile page. I did this using an RSS feed widget. I tried doing the same thing for a fan page, but Facebook forces me to switch contexts (from viewing as the a page to viewing as myself), after which I'm redirected to my own status feed. There is an RSS for notifications, but I want it for statuses, not notifications.


How to change the link "Edit my profile"?

I am setting up a new membership website. I only have one issue that I can't resolve. Once a member is logged I don't want them to go to the dashboard to edit their profile but instead to the website profile page. Where and how do I change this?


Wordpress Page Template: Comment Filtering with Querystring

A custom Page Template was developed in order to display a list of products. A WordPress page (/products) was created and the template was applied to it. There is a database which the template's programming accesses to retrieve product information. Different products are displayed based on a GET querystring variable, "Id" (/products?Id=1). Comments are enabled on the /products page, so when users are viewing different products, they can comment. The issue here is that the comments are common to the products page. When a user comments on the product with Id = 1, the comment is displayed on all other product pages (Id = 2, 3, etc). Optimally, we would want each product to have it's own set of comments. What's the easiest way to implement the desired functionality on the products page?


Insert Shortcode exactly at the end of the content

<?php echo do_shortcode("[sharethis]"); ?>                  <?php wp_related_posts()?>       There are 2 short codes above 1) share this plugin short code 2) related posts short code now my QUESTION first see this LINK At the ending of the post you can see the author box i want want this author box below the above mentioned plugins i tried these shortcode by keeping in single.php page but they didnt worked. **Please help me, to insert both the shortcodes exactly below the content and above author box.**


How do I include javascript/jquery image resizing with wordpress?

I wan't to include this script in my wordpress theme, making it resize all of the images inside posts according to the current window height: https://github.com/gutierrezalex/photo-resize I've made a basic test page in my text editor and it resizes the image just fine. However, when I try to apply/include it in my wordpress theme I simply can't get it to work.


Deregistering and registering javascript breaks plugin

While you can view the full file here, here's the function that enqueues the JavaScript file(s) needed by the plugin:               function ippy_bcq_add_scripts() {          $options = get_option('ippy_bcq_options');     $valuebb = $options['bbpress'];     $valueco = $options['comments'];     $ippy_bcq_bbp_fancy = get_option( '_bbp_use_wp_editor' );            if ( function_exists('is_bbpress') ) {               if ( is_bbpress()  && ( $valuebb != '0') && !is_null($valuebb) && ($ippy_bcq_bbp_fancy == '0') ) {                 wp_enqueue_script("bcq_quicktags", plugin_dir_url(__FILE__) . "quicktags.js", array("quicktags","jquery"), "1.8", 1);                 wp_enqueue_style("bcq_quicktags", plugin_dir_url(__FILE__) . "quicktags.css", false, "1.8");                 wp_print_styles('editor-buttons');             }       }       if ( comments_open() && is_singular() && ( $valueco != '0') && !is_null($valueco) ) {                         wp_enqueue_script("bcq_quicktags", plugin_dir_url(__FILE__) . "quicktags.js", array("quicktags","jquery"), "1.8", 1);                         wp_enqueue_style("bcq_quicktags", plugin_dir_url(__FILE__) . "quicktags.css", false, "1.8");                         wp_print_styles('editor-buttons');       }     }          if( !is_admin() ) {         add_action('wp_print_styles', 'ippy_bcq_add_scripts');     }      Now, as you can see, `quicktags` ($handle) is one of the dependencies (alongside jQuery) required the JavaScript enqueued by the plugin. `quicktags` represents this file: `http://example.com/wp- includes/js/quicktags.js`, and I need to have the file served from a different domain, like this for instance — `http://static-domain.com/wp- includes/js/quicktags.js`. How do I do it? I tried these two in my theme's functions.php, but they seem to break the JavaScript output by the plugin for some reason:   * **TRY - 1:**              add_action('wp_enqueue_scripts','aahan_register_script');     function aahan_register_script(){              wp_deregister_script('quicktags');         wp_register_script('quicktags', 'http://static-domain.com/wp-includes/js/quicktags.js', false, false, true);         wp_enqueue_script( 'quicktags' );          }        * **TRY - 2:**              add_action('wp_print_styles','aahan_register_script');     function aahan_register_script(){              wp_deregister_script('quicktags');         wp_register_script('quicktags', 'http://static-domain.com/wp-includes/js/quicktags.js', false, false, true);         wp_enqueue_script( 'quicktags' );          }      I also did try a few other variants, but none worked. What am I doing wrong? * * * ## More Info By default the plugin outputs code like this in the footer:               <script type='text/javascript'>     /* <![CDATA[ */     var quicktagsL10n = {"wordLookup":"Enter a word to look up:","dictionaryLookup":"Dictionary lookup","lookup":"lookup","closeAllOpenTags":"Close all open tags","closeTags":"close tags","enterURL":"Enter the URL","enterImageURL":"Enter the URL of the image","enterImageDescription":"Enter a description of the image","fullscreen":"fullscreen","toggleFullscreen":"Toggle fullscreen mode","textdirection":"text direction","toggleTextdirection":"Toggle Editor Text Direction"};     /* ]]> */     </script>     <script type='text/javascript' src='http://example.com/wp-includes/js/quicktags.js?ver=3.4.1'></script>     <script type='text/javascript' src='http://static-domain.com/wp-content/plugins/basic-comment-quicktags/quicktags.js?ver=1.8'></script>      But when I try the aforementioned functions, the output code is this (essentially broken):               <script type='text/javascript' src='http://whatthenerd.com/wp-includes/js/quicktags.js?ver=3.4.1'></script>     <script type='text/javascript' src='http://wtn-static.whatthenerd.net/wp-content/plugins/basic-comment-quicktags/quicktags.js?ver=1.8'></script>


Custom Post Type Archives by Date with Custom Permalink

I'm a bit stuck with getting the custom permalink for custom post type (CPT) archive to work. I've registered my 'press_release' CPT as following:               add_action('init', 'press_release_post_type_init');     function press_release_post_type_init() {       $labels = array(         'name' => _x('Press Releases', 'post type general name'),         'singular_name' => _x('Press Release', 'post type singular name'),         'add_new' => _x('Add New', 'Press Release'),         'add_new_item' => __('Add New Press Release'),         'edit_item' => __('Edit Press Release'),         'new_item' => __('New Press Release'),         'view_item' => __('View Press Release'),         'search_items' => __('Search Press Releases'),         'not_found' =>  __('No press release found'),         'not_found_in_trash' => __('No press release found in Trash'),          'parent_item_colon' => ''       );       $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'has_archive' => 'press-release',         'rewrite' => array('slug' => 'press-release/%year%/%postname%','with_front' => false),         'query_var' => true,         'capability_type' => 'post',         'hierarchical' => false,         'show_in_nav_menus' => false,         'menu_position' => 20,         'supports' => array(           'title',           'editor',           'author',           'revisions'         )       );       register_post_type('press_release', $args);     }      At the moment if I go to URL `http://mysite.press-release` then I get to the `archive-press_release.php` template, which is correct. However, I would like my CPT archive permalinks to be of the type `press- release/%year%` I have tried to specify the above permalink structure when registering CPT:               'has_archive' => 'press-release/%year%'      However, with that permalink structure when I go to `http://mysite.press- release` or `http://mysite.press-release/2011` in both cases I'm redirected to the `index.php` template not the archive one. What do I add to make WordPress understand that `press-release/%year%` permalink with an optional year part are actually the archive templates? I would really appreciate any help! I'm hoping it's possible to do. I was planning on constructing my own SQL in the `archive-press_release.php` to get the records of the correct year. Many thanks, Dasha


Hide links to pages that dont have any content

Its that possible?Than when something is added to page in admin panel, page link to that page appears.


How to enqueue scripts on custom post add/edit pages?

I'm trying to enqueue a JS script only when someone is adding or editing a custom post type I created called "recipes". Currently the script works ok when I do this:               if (is_admin()){         wp_enqueue_script( 'my-script' );     }      But this loads it in every admin page, I'm assuming I need to hook it to a function but I hvae no idea what it'd be. Thanks in advance!


Wordpress links/bookmarks - need to urlencode because spaces are getting stripped

Wordpress is stripping spaces out of links. For example putting this into the web address of a new link:               mailto:my@email.com?subject=Hello there      and saving results in this:               mailto:my@email.com?subject=Hellothere      I know that a space is `%20` but my clients can't be expected to use this. Plus they may be uploading PDFs/Word documents with spaces in the filename and copying and pasting the link. How can I remedy this? I know I have to use urlencode, however I don't really want to edit the core wordpress admin, because on upgrading I'll have to change it again. However, I will do if its the only way (having a look I can't seem to find a hook or anything that will let me do this!), but I just can't figure out where to put it. Thanks for any/all help you can give me.


Allowing WordPress.org/com accounts on a self-hosted install

Hopefully a basic question, but one that plagues me nonetheless. I have a couple of self-hosted WordPress installs on my website. An issue that I have is that I have common users registered for each site....however some of them feel its a pain to have to go through the signup process each time, and have to juggle multiple accounts in order to comment. Is it possible to commonize accounts, for instance simply using a WP.com/org account and accessing my blogs in that manner?


Automatically Display Sub Menu

To start... I am new to Wordpress and developing themes. I've got a main menu which I've placed in my header using the following code:               <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'topNav', 'after' => '<span> </span>' ) ); ?>      I've also defined my menu like so: ![Menu Definition](http://i.stack.imgur.com/PVQ7R.jpg) It works out as I desire (well, mostly): ![Page View](http://i.stack.imgur.com/1232W.jpg) Now, I want to display a sub menu in the white page content area below. The sub menu would display just like the main menu (ContentTopNavigation). So, if the menu were set up like (demonstration purposes only): ![Sub Menu Definition](http://i.stack.imgur.com/J7ZU2.jpg) And the STORE main menu item were selected, the STORE page would have a menu at the top which shows the 3 sub menu items. How do I make this relation ship automatic? Meaning, the sub menu for the page is automatically shown based on the top level menu item shown.


Menu Custom link - using relative link when WP is in a subdirectory

I tend to develop sites in a subdirectory, and I tend to use a fair amount of custom links in my menu ( the "Custom Links" option in the WP admin Appearance > Menus section) to display archive pages. I am constantly annoyed at the fact that a relative link entered there will not take the subdirectory into account. For example, I have WP is installed in domain.com/dev. I put a custom link "/events" in the menu, but it returns domain.com/events, which is 404, instead of properly returning domain.com/dev/events. How can I change this behavior?


What is true chmod for WordPress?

For all the folders and files. Please give some explained answer.


How to add an RSS logo to my blogs header?

I have started a new site (here), I want to add the theme a RSS icon/logo on the top right of the theme (like in this theme). What is the best way for doing that? (PHP/CSS wise)


Hosting the WordPress website on someone else's web URL

Its my first attempt at any sort of web development with WordPress or otherwise. I volunteered to create a website for an Organization with whom I am temporarily working for a project. I don't want to set up the website at my end and forward the files to them (we are in different cities), since updating the web pages later on may be a hassle for me (I guess). My question, how do I achieve the following with WordPress- I keep the files at my end and host the website at a server at my end, at (say) `the-ip-address/wordpress`. But the URL of the website remains what that Organization wants it to be, say, `wwww.their-homepage/several/sub- directories/wordpress`. What all will my colleagues at the other end need to do to allow this re- direction?


Help me tidy up my widget code

I'm a newbie in WordPress and PHP. I created a small widget to embed video's from YouTube or other video hosting. Everything works fine. I know I have messy code, therefore I would appreciate it if someone is able to tidy up my code. This is my code:               <?php     /**      * Plugin Name: Widget Name      * Author: Author Name      * Author URI: Site URL      */          class Today_video extends WP_Widget {              /**          * Widget setup.          */         function Today_video() {             /* Widget settings. */             $widget_ops = array( 'classname' => 'tm_widget_today_video', 'description' => __('Display today video on your site', 'today_video') );                  /* Widget control settings. */             $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'today_video' );                  /* Create the widget. */             $this->WP_Widget( 'today_video' , __( 'Today Video' , 'today_video' ), $widget_ops );         }              /**          * The frontend function          */         function widget( $args, $instance ) {             extract( $args );                  /* Our variables from the widget settings. */             if(isset($instance))             {                 if( isset( $instance[ 'title' ] ) ) {                     $title = apply_filters( 'widget_title', $instance[ 'title' ] );                 }                      if( isset( $instance[ 'template' ] ) ) {                     $template = htmlspecialchars_decode( $instance[ 'template' ] );                 }             }                  /* Before widget (defined by themes). */             if( isset( $before_widget ) ) {             echo $before_widget;             }                  /* Display the widget title if one was input (before and after defined by themes). */             if( isset( $title ) ) {              echo $before_title . $title . $after_title;              }                  /* Display the widget video */             if( isset( $template ) ) {              echo '
 '.$template.'
';             }                  /* After widget (defined by themes). */             echo $after_widget;              }                   /**          * Backend widget settings          */         function update( $new_instance, $old_instance ) {             $instance = $old_instance;                  /* Strip tags for title and name to remove HTML (important for text inputs). */             $instance['title'] =            strip_tags( $new_instance['title'] );                  // htmlspecialchars to save html markup in database, at frontend we use htmlspecialchars_decode             $instance['template'] =         htmlspecialchars($new_instance['template']);                  return $instance;         }              /**          * Displays the widget settings controls on the widget panel.          *          * Backend widget options form          */         function form( $instance ) {             $defaults = array(                  'title' => __(  'Today Video', 'today_video'),                                  'template' => __('', 'today_video'),                             );                  $instance = wp_parse_args( (array) $instance, $defaults ); ?>
                 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'hybrid'); ?>                 <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:96%;" />

                 <label for="<?php echo $this->get_field_id( 'template' ); ?>"><?php _e('Embed Code:', 'hybrid'); ?>                 <textarea id="<?php echo $this->get_field_id( 'template' ); ?>" name="<?php echo $this->get_field_name( 'template' ); ?>"  style="width:100%;height:100px;"><?php echo $instance['template']; ?></textarea>
              <?php         }     } //Add function to widgets_init that'll load today_video     add_action( 'widgets_init', create_function( '', 'register_widget( "Today_video" );' ) );     ?>      Thank you.


Displaying the Name of the Queried Taxonomy Term on a Term Archive Page?

_( **Moderator's note:** post was originally entitled "Taxonomy.php title")_ How can I display the _"Posts classified under:"_ title for the `taxonomy.php` page? For example, this code is used in `tag.php`:               printf( __( 'Tag Archives: %s', 'twentyten' ),         '<span>' . single_tag_title( '', false ) . '</span>' );


Get the terms of a custom taxonomy for a specific author in author template

I am using a custom post type in my website and a custom taxonomy for it. An author selects one or many terms before publishsing its post. My goal is to display authors pages in front end, so I am using `author.php` template file. This file is by default displaying the archive of posts written by the specific author. How can I add to this file the list of the custom taxonomy terms for the author published posts? I give the following example if I wasn't clear in my explanation:               if Author-x has published:          **post1** with term1 , term2, term3     **post2** with term2, term5     **post3** with term1               then, in Author-x page I will have : term1, term2, term3, term5.      It is exactly the same principle as in user page in stack exchange. As you can see, there is a list of tags for each user which are tags of posts the user contributed in. Thank you for your usual help.


Hooking into add_submenu_page

Ever come across a plugin that is using the `manage_options` capability for a page that... really doesn't need to be? Well, I've come across just that. This may be more of a general question about hooking into `add_submenu_page`, so not just specific to my use-case. I looked at `add_dashboard_page` which is simply a wrapper for `add_submenu_page`:               function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {         global $submenu;         global $menu;         global $_wp_real_parent_file;         global $_wp_submenu_nopriv;         global $_registered_pages;         global $_parent_pages;              $menu_slug = plugin_basename( $menu_slug );         $parent_slug = plugin_basename( $parent_slug);              if ( isset( $_wp_real_parent_file[$parent_slug] ) )             $parent_slug = $_wp_real_parent_file[$parent_slug];              if ( !current_user_can( $capability ) ) {             $_wp_submenu_nopriv[$parent_slug][$menu_slug] = true;             return false;         }              // If the parent doesn't already have a submenu, add a link to the parent         // as the first item in the submenu. If the submenu file is the same as the         // parent file someone is trying to link back to the parent manually. In         // this case, don't automatically add a link back to avoid duplication.         if (!isset( $submenu[$parent_slug] ) && $menu_slug != $parent_slug ) {             foreach ( (array)$menu as $parent_menu ) {                 if ( $parent_menu[2] == $parent_slug && current_user_can( $parent_menu[1] ) )                     $submenu[$parent_slug][] = $parent_menu;             }         }              $submenu[$parent_slug][] = array ( $menu_title, $capability, $menu_slug, $page_title );              $hookname = get_plugin_page_hookname( $menu_slug, $parent_slug);         if (!empty ( $function ) && !empty ( $hookname ))             add_action( $hookname, $function );              $_registered_pages[$hookname] = true;         // backwards-compatibility for plugins using add_management page. See wp-admin/admin.php for redirect from edit.php to tools.php         if ( 'tools.php' == $parent_slug )             $_registered_pages[get_plugin_page_hookname( $menu_slug, 'edit.php')] = true;              // No parent as top level         $_parent_pages[$menu_slug] = $parent_slug;              return $hookname;     }      It honestly doesn't look like there's anything I can actually plug into with an existing dashboard page to change the capability. So I'm trying to decide if I'm better off using `remove_submenu_page` and then attempt to redeclare that same submenu. I know there will be things I need to look out for (if the display function used for the page has anything that is additionally checking for the capability or displaying anything vital to the site). Always helpful to have a second pair of eyes on these so I don't over complicate things. Thanks all! # Update Thanks to both @toscho and @userabuser here's what I got:               function wpse_71303_change_menu_cap()     {         global $submenu;         foreach ($submenu['index.php'] as $dashboard => $key) {             if ($key[0] == 'Analytics360°') {                 $submenu['index.php'][$dashboard][1] = 'analytics';             }         }     }     add_action( 'admin_head', 'wpse_71303_change_menu_cap' );      If I run a `print_r($submenu) I do see the new capability - but I still can't access the menu item under the client role I created (with the`analytics_360` capability) (used the Members plugin to create). Possibly firing too late? Definitely a bit odd. Thanks as always! **The code from _Update_ works for anyone that comes across this. It was an unneeded check around `add_dashboard_page()` giving me the issue.**


numberposts not showing specific number

I'm using List Category Posts plugin to show up the specific posts from a category on a page. It works well, but if I'm trying to reduce the number of my latest posts to 3, for example this way:               [catlist id=13 numberposts=3]      It shows up all the posts from that category. Am I doing somwthing wrong?


How to enable WPML in BuddyPress Multilingual Plugin in a single website?

There is a plugin called BuddyPress Multilingual version 1.4.0. I installed this plugin in wordpress. But I can't see it anywhere in the admin panel nor in plugins. There is very little documentation else where on the website. **Where are the options for that plugin?** If this is a broken plugin then **what is the alternative to implement multilingual option?** I prefer to make a blog in wordpress which can support multilanguages. It's better if a plugin is able to translate the post or page after selecting a language on the wordpress editor.


Changing search terms results a 403 - dsIDXpress Pro plugin

I face an issue with the dsIDXpress Pro SEARCH. Everytime I try to change the search terms the site gives a 403 error. http://lagunaagent.com/idx/city/laguna-niguel/ From the error.log               [Wed Nov 07 10:51:30 2012] [warn] [client ******.46] mod_fcgid: stderr: PHP Warning:  Cannot modify header information - headers already sent by (output started at [****]/httpdocs/wp-includes/class.wp-styles.php:92) in [****]/wp-content/plugins/dsidxpress/client.php on line 407, referer: http://lagunaagent.com/idx/city/laguna-niguel/?idx-q-BedsMin=4&idx-q-ImprovedSqFtMin=2500&idx-q-PropertyTypes=545      `/dsidxpress/client.php` line 407 :                   // track the detail & result views, do this at the end in case something errors or w/e         $views = intval(@$_COOKIE["dsidx-visitor-$action-views"]);         setcookie("dsidx-visitor-$action-views", $views + 1, time()+60*60*24*30, '/');              if (isset($seo_keywords) || isset($seo_description) || isset($seo_title)) {             $dsidxpress_seo = new dsidxpress_seo($seo_title, $seo_description, $seo_keywords);             add_action('wp_head', array($dsidxpress_seo, 'dsidxpress_head_action'));             add_filter('wp_title', array($dsidxpress_seo, 'dsidxpress_title_filter'));         }      Could you kindly point me if it's something server related??? I have already done some troubleshooting changing theme (twenty eleven) and switching on/off plugins with no results.


How to prevent automatic redirection?

Wordpress has a feature whereby it will automatically redirect your URLs if it percieves them to be written wrongly. Here is an example: I have a page called `my-page` If I go to:               www.mysite.com/something/my-page/      it will immediately redirect me to               www.mysite.com/my-page/      as nothing exists at the first URL. How can I turn this feature off, and instead just get a 404 if incorrect URL's are typed in?


How i can get blog info using site url in multi-site for eg : if i give the site url as `http://a.somename.com` and this should return me the value like Site Name Site Tag line Site Database Table Prefix **Used Code**               $blog_id = get_blog_id_from_url("http://192.168.0.89/dev/sareepuram/ss/");     echo get_blog_option( $blog_id, 'blogname' );     echo get_blog_option( $blog_id, 'blogdescription' );      If i use the above code i get the details for the below link               http://192.168.0.89/dev/sareepuram/      I use wordpress multi-site The below link is the main site               http://192.168.0.89/dev/sareepuram/      And this link is the sub site `http://192.168.0.89/dev/sareepuram/ss/` **My Code Page Looks Like Below**               <?php     define('WP_USE_THEMES', false);     require('wp-load.php');          $blog_id = get_blog_id_from_url("http://192.168.0.89/dev/sareepuram/ss/");     echo get_blog_option( $blog_id, 'blogname' );     echo get_blog_option( $blog_id, 'blogdescription' );          ?>


Getting posts by taxonomy

I want to get a set of posts from a CPT based on a taxonomy term being present. I thought I'd use WP's get_posts() function: > $results = get_posts(array $options); This function works fine when I specify the CPT i'm interested in: > $results = get_posts( array('post_type' => 'my_cpt_name') ); But then I tried this with my UOM custom post type and tried to filter on the metric system which is a taxonomy called "uom_system": > $results = get_posts( array('post_type' => 'uoms', 'uom_system' => 'metric- > system' ); Sadly, the taxonomy section gets ignored and I get the full list of posts in the UOM posts table. What am I doing wrong?


Theme seems to have different options on wordpress.com and own-server install

I am trying to transfer a blog from wordpress.com to my own server. The site on wordpress.com uses the Origin theme, with a custom header image set. I have installed that theme on Wordpress on my own server, but I don't seem to have the option to select a header image. If I look at the options under Appearance, on my own site they are:   * Themes   * Widgets   * Menus   * Background   * Theme Settings   * Editor (and there is nothing under Theme Settings about a header image) but on wordpress.com the options are:   * Themes   * Widgets   * Menus   * Header   * Background   * Custom Design   * Mobile Is there any way for me to get the Header options (including the Header Image setting) for my own personal install? Alternatively, is there a simple way to edit the theme code to fix a header image in there? I would look at the theme code on wordpress.com, but of course there isn't an option to edit it there.


rewriting search-permalink with htaccess - search results are are "opened" automatically?

when typing "a" into my search field (/?s=a) I my `search.php` template is loaded and all results that match that letter are shown. If I add this to my .htacess …               RewriteCond %{REQUEST_URI} ^/$     RewriteCond %{QUERY_STRING} ^s=(.+)$     RewriteRule .* /searchmyblog/%1/? [R,L]      and then type "a" into my search the first result of my search is shown. So there is no `search.php` template shown with all the results but rather the page is redirected to "mypage.com/somecategory/amore-mio" Why is that happening? I simply want to rewrite the normal `/?s=` to `/search/` or any other custom url. Any ideas on that? I found heaps of posts online, but none of them seem to be state of the art or use some weird JS-hacks that I find unnecessary. Ideas on that?


Limit Contact Form 7 hook to specific form

I'm using a Contact Form 7 filter to take action after the email is sent. How can I limit this action to only one form? There are multiple forms on different pages, and I don't want this action to run after every form, only one specific form. I tried limiting the action to the page where the form is using an if clause, but then the "action" doesn't complete. Once I remove the if clause, then the action works.               function foo() {             if(is_page('bar') {               // some action         }     }     add_action( 'wpcf7_mail_sent', 'foo', 1 );


How to show list authors with at least five posts published

i'm wondering if there is a way to use wp_list_authors to list only the authors with at least five (or even more, but anyway more than just one or two) published post in the blog. Actually I don't see any "arg" to do that. Thanks Bye Carletto


Exclude uploaded files from appearing in the excerpt()

In a post I have some text and some media attachments and when I use the_excerpt(), it strips all the anchor tags from the attachments and shows just their file names and its causing me problems as some of the filenames are really long. Is there a way of excluding media attachment content from the_excerpt()? If not, is there a way to show the anchor tags when using the_excerpt() that wont leave unclosed tags and what not?


Common single page template options

I am developing a common theme for 25 websites, the default requirements are done. Each site has got different single post template. I need to group it as a single theme so i don't need to hard-code every time and maintain a common platform. The various single posts template are normal-blog / tab structure / List view I am now creating an option page for my theme, so that the user can create a layout on his own for the single-page without hardcoding(options might be drag and drop). I need to create certain components like tab,sidebar, list, and save templates for different categories. the values in tabs could be from a custom field,taxonomy. user can create n no of templates for various categories/tags/taxonomy and save it. For Eg: Template 1 for category sports,education. I trying to do it but i don't have any clue to it, might be the theme atuhalpa came close. how to solve it.


how to use Easy Docs theme to write a book?

I installed this theme http://shakenandstirredweb.com/theme/easy-docs but I don't understand how it works: after install I have only page menu, post menu has disappeared. Page only appears as menu not as content. So how does it work ?


Restore Image Title Text

In WordPress 3.5, when images are inserted into posts, the title attribute is not included in the image tag. The Lightbox plugin I am using requires the title tag to be present on images; besides, I like having a hover tool-tip. Is there some way to restore the previous behaviour of including the title attribute?


Saving fields in a drop-down in Wordpress

Below is code that successfully displays a drop-down menu of page templates in my Wordpress theme. I'm using this menu in a custom post type, and don't quite understand how to label it in order to make it save the chosen value after the user "updates". The value is, in fact, being saved to the database and displaying correctly to the table, it's just not maintaining the chosen value after update. I've seen some other examples of this, but my drop-down is based on a PHP function all in one line. Any suggestions would be great appreciated.               <?php _e('Page Template') ?>          <select name="page_template" id="page_template">          <option value='page_template'><?php _e('Default Template'); ?></option>     <?php page_template_dropdown($template); ?>     </select>      HERE IS THE UPDATED CALLBACK FUNCTION THAT IS SUPPOSED TO DISPLAY THE DROPDOWN:                // The Callback for Page Template Assignmets Metabox      function pagetemplate() {      global $post;      // Noncename needed to verify where the data originated      echo '<input type="hidden" name="pagetemplatemeta_noncename" id="pagetemplate_noncename" value="' .      wp_create_nonce( plugin_basename(__FILE__) ) . '" />';      // Get the title data if its already been entered      ?>     <?php _e('Page Template') ?>      <select name="page_template" id="page_template">      <option value='default'><?php _e('Default Template'); ?></option>      <?php template_dropdown($template); ?>      </select>           <?php          }                //Creates the page template dropdown menu display and functionality     function template_dropdown( $default = '' ) {      $templates = get_page_templates();      ksort( $templates );      foreach (array_keys( $templates ) as $template )          : if ( $default == $templates[$template] )              $selected = " selected='selected'";          else              $selected = '';      echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";      endforeach;      }


Make custom post type display as a page

I am trying to make my custom post type display on the front end as if it were a page. Depending on the theme, it won't have the date, author, etc... I've looked into creating a template such as 'single-<CPT>.php'. But that's too static to work for any theme design. Is it possible to somehow tell the current theme to display the custom post type in the same way it would display a normal page. Thanks!


How do I remove certain HTML elements with specific classes from the feed?

What filters can I use to remove specific HTML elements with certain classes from the Wordpress feed? _Not remove everything inside the element_ , mind you, **but just remove the markup itself**. For example:

Yada yada bla bla whatever dummy text

      The result should be:
Yada yada bla bla whatever dummy text
           Why? We have a syndication agreement with a big web portal. They will get articles from our feed and automatically put it in their CMS. The problem is that I've used shortcodes to allow varied multi-column layouts, which won't work properly because the CSS I defined for the layouting is of course not available on the web portal. The shortcodes resolve into divs with specific classes attached to them. The trick is of course removing the trailing elements for those that have opening and closing tags, without touching the content wrapped inside. Thus I'm not sure if Regex is the best (and most efficient) approach here.


Capability to prevent upload of files

I need the ability to allow users to insert media (images) into a page / post, but not allow them to upload the files. The only capability I can see is 'upload_files', which allows a user to upload / insert files. Is there a way to prevent upload of files but still show the media manager (via the 'Insert Media' button on the Edit screen) allowing users to insert the images? My thought of how to approach this would be via jQuery - run a script when the capability is something like 'my_insert_media', which would hide the 'Upload' tab of the media uploader. Of course this could be worked around by disabling Javascript in the browser, but that's not a major concern for this project. Any other suggestions, or holes in this approach? Thanks, Dan


Plugin: Relative URL to images in another folder accessed inside a JS file

I have this Wordpress plugin file structure with "myfolder" as the main folder. There is another subfolder inside this main folder named as "resources". Inside this resources folder contains two subfolders: a) JS b.) images Inside images folder I have one image "myimage.png". Inside JS file, I have a script named "myscript.js". I would like to access the image "myimage.png" in images folder inside my javascript file "myscript.js". I have tried the following but it does not work(does not resolve):                                              Of course the absolute URL path works but I want this application to work with other sites so coding the absolute URL path is not a feasible solution. I know that Wordpress also has this magic function:               $myicons= plugins_url('resources/images/myimage.png', __FILE__ );      But that will work only inside the PHP plugin file and I'm accessing the image inside a JS file. Any ideas how to make this work without rearranging the current file structure? Is there a JS function equivalent of "plugins_url" in Wordpress? Thanks for any tips.


Pagination of RSS2 feed

How to have pagination of RSS2 feed ? My current RSS link is similar to :               http://www.example.com/?feed=rss2      I tried:               http://www.example.com/?feed=rss2&page=2      But WordPress still returns me with same set of result, given that I set 10 posts per page in > Dashboard > Settings > Reading > Syndication feeds show the most recent (of course I have more than 10 posts)


Refresh loop of custom posts (div) after new post is published

**GOAL** Wondering if following should be done, I would like to (ajax?) refresh not necessary only (custom) post type loop or div example custom post query :               <div class="refreshed posts">     <?php          global $post;          $myposts = get_posts('post_type=employer&numberposts=5&orderby=modified&offset=0');          foreach($myposts as $post) :          setup_postdata($post);          ?>     </div>      **CONCLUSION** Auto refresh posts can help my website users to see that when for example somebody submits a post type employer entry, at the same moment all online users can see all updated "employer" posts including that one submitted post. I would like to avoid using plugins. In the similar manner uses facebook etc their notifications (I believe they scheduled to refresh in minute intervals)


Auto Select Child categories on Multiple Dropdown - Jquery

I am using the wp_dropdown_categories to generate the form and select option, with multiple select jquery plugin. What I want is that, when the user selects the Parent category or (level-1) then the child categories (level-2 or level-3) should be auto selected. Since there is no grouping, can this be done by Jquery? Following is the html code.               <optgroup  label="Categories">     <option class="level-1" value="519">Parent 1</option>         <option class="level-2" value="521">Parent 1 child 1</option>         <option class="level-2" value="522">Parent 1 Child 2</option>             <option class="level-3" value="523">1st Sub Child of 2</option>             <option class="level-3" value="524">2nd Sub Child of 2</option>     <option class="level-1" value="519">Parent 2</option>             <option class="level-2" value="525">Parent 2 Child 1</option>             <option class="level-2" value="526">Parent 2 Child 2</option>             <option class="level-2" value="527">Parent 2 Child 3</option>     </optgroup>


Changing status of Published posts which have less Content to "Draft"

function draftpost(){         global $wpdb;         $prefix = $wpdb->prefix;         $wpdb->query("UPDATE ".$prefix."posts SET post_status='draft' WHERE LENGTH( post_content ) <500");     }     add_action('publish_post', 'draftpost');      This code is working Fine for changing Published Items to Draft. Issue is that this code removes my Custom Menu and make all Items in Menu to PENDING. How can I solve this?


Problem with caching, W3TC

Am using W3TC from a long time but from past few weeks am stuck, as I can't see my edits working. It was all fine in past but from a week my edits in style.css reflects back in like an hour after. http://i.imgur.com/f3LwQ.png http://i.imgur.com/rzydS.png http://i.imgur.com/bMffA.png http://i.imgur.com/XWniN.png http://i.imgur.com/6cpnf.png http://i.imgur.com/pBN0X.png http://i.imgur.com/ZrJsP.png http://i.imgur.com/4RaSj.png http://i.imgur.com/B6w3o.png


Including a JS source with an admin page

The administration part for my plugin is divided into several pages and for some pages I would like to enqueue a JS source which would add jQuery functionality to various elements. Right now this is my approach:               function admin_register_init() {           if ($_GET['page'] == 'worldexplorer_admin_location_hub')       wp_enqueue_script('worldexplorer_admin_hub', WP_PLUGIN_URL.'/worldexplorer/admin/admin_hub.js');     }     add_action('admin_init', 'admin_register_init');      However, this requires me to check the page index of the $_GET array. Is there another way to achieve what I wish to do?


Adding a media image without generating thumbnails

I'm not sure whether my request is insane or legitimate, but I would like to control how my images are stored in Wordpress, avoiding that for each of them a set of thumbnails is created. Is this feasible? How can I specify the path where images are saved? Thanks


List upcoming events, ordered by date in a custom field

I want to display a list of events with dates in upcoming order. Ex:   *     1. 23 March, 2013,    *     1. 30 March, 2013 Below is the query I'm using to filter out posts from my database:               query_posts(          'post_type=myevents&meta_key=_datepicker&orderby=meta_value&order=ASC&showposts=20'     );      But this doesn't work. I get my events listed in following order:   * 07 April, 2013,    * 18 April, 2013,    * 19 June, 2013,    * 20 October, 2013,    * 23 March 2013,    * 24 March 2013 Events happening in March are listed at last. There is no order at the start too. I'm using a custom field to store event date and the date format is `23-Mar-2013`, but I show the front end dates in the format `23 March 2013`. How can I get the correct order?


Get all content on a "single page" site depending on language

I'm developing a "single page" WordPress based site that has content in multiple languages (using the plug-in WPML) and I need to retrieve it in a more efficient manner to avoid slow page load time.      An example of the code that I'm currently using -               $query = new WP_Query();     $query->query( array( 'post_type' => 'any', 'orderby' => 'id', 'order' => 'ASC' ) );          while ( $query->have_posts() ) {         $query->the_post();              // Gather the content for the first section of the page         if( $post->ID == 100 ) {             $firstSection .= get_content();         }              // Gather next content section etc...          }      Essentially, what I'm doing right now is looping through all posts looking for a specific ID, for which I then retrieve content tied to a certain part of the page. As you may understand, this gets quite messy after a while, having to create an if statement for each section content for each language. I have around 20 statements inside the while loop currently and I'm sure there is a better way to retrieve the data. Any ideas?


Allow editors to post iframes

I just found out that editors are not allows to post iframes (e.g. YouTube videos). Is it possible to allow it somehow? I use WP Multisite.


How to remove_filter that filters iframes in posts?

Which filter if removed allows iframes to be inserted into wordpress posts?


How can I control an external php (with external database) page with WordPress?

I need to control an external page designed and developed in php that takes values from an external database. What I actually need is to edit and change some hardcoded content of the page with wordpress. How can this be done?? Any sugestions?


Custom Post Types relationships

I have a custom post type for my videos. I need do related it with other post category. And i have 10 category Like this :               Post Category - Video Category     Tech            Tech     Marketing       Marketing     News            News     .....................      I want to do for this. I have a post Category Tech and I have custom post type Category(Taxonomy) Tech.. When I currently viewing Tech (Post) Category, How can i list (on sidebar) Tech videos?


Fatal error in comments.php

I am using customized theme for my development. The site was working fine and in last few days started seeing this error > Fatal error: Call to a member function is_singular() on a non-object in > /home/content/29/11116929/html/studyus/wp-includes/comment.php on line 2399 The error is on line 2399 which is               if ( empty( $posts ) || ! $query->is_singular() || ! get_option( 'close_comments_for_old_posts' ) )     return $posts;      comments.php is wordpress file and we have not changed anything. This is what I have done so far a) upgraded to latest version 3.9.1 b) disabled all plugins c) checked comments.php in my theme's file, reverted to base version and still same issues. This is my site and this is where search query is being executed


Adding labels to Setting titles with API

If I add a setting using `add_settings_field()`, it doesn't create a `<label>` around the title so that it can be clicked to focus on the field. Some of the core settings do this, but they just add it in the raw HTML rather than using the settings API. Is there any way to add labels with the settings API?


Init hook for header send

I am working on a checkout proces where if I submit the checkout I get an error "headers already send" because I use a PHP header() function to send the customer to my payment provider url. My idea is now to put the checkout code in a Wordpress 'init' hook, do you think this will resolve the problem? This is the handling code:               // Include Mollie     include "initialize.php";          if( isset( $_POST['submit'] ) ) {              $order_id = time();              // Create payment         $payment = $mollie->payments->create( array(             'amount'        => $data['price'] * ( $vat + 1 ),             'description'   => __( 'Splashback order' ),             'method'        => $_POST['sbg_payment'],             'redirectUrl'   => site_url( '/success/?order_id=' . $order_id ),             'metadata'      => array(                 'order_id'  => $order_id,             ),         ));               // Json product composition         $composition = json_encode( $data );              // Check fields and json         $fields = array(             'name'      => array( 'req' => false ),              'street'    => array( 'req' => false ),              'number'    => array( 'req' => false ),              'zipcode'   => array( 'req' => false ),              'city'      => array( 'req' => false ),              'country'   => array( 'req' => false ),              'email'     => array( 'req' => false ),             'phone'     => array( 'req' => true ),             'payment'   => array( 'req' => false ),         );              foreach( $fields as $key => $val ) {             if( isset( $_POST['sbg_' . $key] ) ) {                 if( $val['req'] === false ) {                     if( empty( $_POST['sbg_' . $key] ) ) {                         $errors = true;                     } else {                         $customer[$key] = $_POST['sbg_' . $key];                         }                 } else {                     $customer[$key] = $_POST['sbg_' . $key];                     }             }         }      I have tried to make a function in the init hook of the piece below, but cannot get it work, because I give some arguments to the function to fill the variables I get errors for all the empty variables. Can anyone help me with this?                   if( ! $errors ) {                  // Json customer details             $customer = json_encode( $customer );                  // Insert transaction to database             $wpdb->insert( $wpdb->prefix . 'mollie_transactions',                 array(                     'transaction_id'        => $payment->id,                     'order_id'              => $order_id,                     'amount'                => $data['price'] * ( $vat + 1 ),                     'composition'           => $composition,                     'customer_details'      => $customer,                     'date'                  => current_time( 'mysql' ),                      'status'                => __( 'Progress' ),                 )             );                  // Redirect             header( "Location: " . $payment->getPaymentUrl() );              }          }