Find page IDs with specific meta tag key value pairs

Is there a way to find the ids of the pages who contain meta tags/custom fields with a certain key-value pair? Say, for instance, that I wanted to find all of the pages who had a meta- tag/custom-field key of "weather" with a value of "raining", is there a way to do that?


What is the significance of _e("Some String", 'String')?

I have seen this in lots of wordpress themes and using it for a while but don't know what is the significance of it. It seems it does the same work as echo something out. Look for it in codex but failed to find anything about it. May be i have looked in wrong place. So, my question is what does `_e("Some String", 'String');` means? And is it different from `echo "Some String";` ?


wordpress widget textbox in the sidebar

I have a normal textbox widget that I am using in certain sidebars. The text widget generates a div within a ul. Is there anyway to make the widget generate another ul li instead?

Heading


How can I process all requests for a given directory in a URL with my plugin?

I'd like to pass all requests for a given directory using a plugin or template file. For instance, all of the following requests would be sent to the plugin:               mysite.com/directory/blah     mysite.com/directory/foo/bar     mysite.com/directory/another/one/here      I would then like to do some custom processing on the "blah", "foo bar", and "another one here" data, outputting resulting content. I've looked into rewrite rules, but I can't figure out if this is just used for "prettifying" URLs or if it can be used for more complex processing. **Edit:** I do not believe I need an endpoint. I don't want to add an action to some other post types. For instance, let's say /directory/ is retrieving content from another server.


I've created a custom meta box to handle certain custom post meta fields and I don't want the clutter of having these custom fields duplicated down in the "Custom Fields" area. How can I remove specific custom post meta from the "Custom Fields" fieldset?


Is there a way to upgrade a theme without losing custom templates?

I recently updated the main theme of a production site. Unfortunately, the upgrade process deleted all our custom templates. Is there any way I can prevent this happening again?


Automatically sorting custom post type admin area by a custom field

I have created a custom post type to display future events, with the event's date stored in a custom field (YYYY/MM/DD format). I'd like the admin screen for this custom post type to be automatically sorted by the event date custom field. Having tried out MikeSchnickel's excellent tutorial on creating a 'sort by' column, I think I've worked out that I need to use something similar to the parse_query filter he uses. But I can't seem to adapt it to my needs, I'm pretty new to customizing wordpress like this, so some simple guidance would be much appreciated! Here's my code to register the custom type post (gs_events), add meta box for the custom field (event_date), and set up custom columns for the admin screen....               add_action('init', 'my_custom_init');          function my_custom_init() {       $labels = array(         'name' => _x('Events', 'post type general name'),         'singular_name' => _x('Event', 'post type singular name'),         'add_new' => _x('Add New', 'event'),         'add_new_item' => __('Add New Event'),         'edit_item' => __('Edit Event'),         'new_item' => __('New Event'),         'view_item' => __('View Event'),         'search_items' => __('Search Events'),         'not_found' =>  __('No events found'),         'not_found_in_trash' => __('No events found in Trash'),          'parent_item_colon' => ''       );       $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,          'query_var' => true,         'rewrite' => array('slug' => 'events'),         'capability_type' => 'post',         'hierarchical' => false,         'menu_position' => 5,         'supports' => array('title','editor','thumbnail','comments')       );        register_post_type('gs_events',$args);     }          register_taxonomy("Location", array("gs_events"), array("hierarchical" => true, "label" => "Cities", "singular_label" => "City", "rewrite" => true));          add_action("admin_init", "admin_init");          function admin_init(){       add_meta_box("event_date-meta", "Event Date", "event_date", "gs_events", "side", "high");     }          function event_date(){       global $post;       $custom = get_post_custom($post->ID);       $event_date = $custom["event_date"][0];       ?>       <label>Date:</label>       <input name="event_date" value="<?php echo $event_date; ?>" />       <?php     }          add_action('save_post', 'save_details');          function save_details(){       global $post;       update_post_meta($post->ID, "event_date", $_POST["event_date"]);     }          add_action("manage_posts_custom_column",  "events_custom_columns");     add_filter("manage_edit-gs_events_columns", "events_edit_columns");          function events_edit_columns($columns){       $columns = array(         "cb" => "<input type=\"checkbox\" />",         "title" => "Venue",         "location" => "Location",         "event_date" => "Date",       );            return $columns;     }     function events_custom_columns($column){       global $post;            switch ($column) {         case "event_date":           $custom = get_post_custom();           echo $custom["event_date"][0];           break;         case "location":           echo get_the_term_list($post->ID, 'Location', '', ', ','');           break;       }     }      And I reckon I need to add some modification of this code from Mike Schnickels's aforementioned tutorial, but I'm not sure how to implement it in this case...               add_filter( 'parse_query', 'sort_movie_by_meta_value' );     function sort_movie_by_meta_value($query) {         global $pagenow;         if (is_admin() && $pagenow=='edit.php' &&                 isset($_GET['post_type']) && isset($_GET['post_type'])=='movie' &&                  isset($_GET['sortby'])  && $_GET['sortby'] !='None')  {             $query->query_vars['orderby'] = 'meta_value';             $query->query_vars['meta_key'] = $_GET['sortby'];         }     }


WordPress 3 botches my Custom Meta Box values on Save

My theme has code that places a custom meta box on the Page editor interface for toggling noindex and/or nofollow attributes to the page. Its a simple little deal with two checkboxes, one says noindex, the other says nofollow. These work flawlessly in all versions of WP prior to 3.0.1 I've found that in 3.0.1, the values of the checkboxes are not saved. No matter what I do, they always come up unchecked, and the values are not being passed to the database either (its not just reporting unchecked in the interface, it never sends the values to the db) I'm at a loss at what's different and how to get my code to work with 3.0.1 Does anyone know of what might have changed to make these checkbox values not pass when the page is Updated in WP 3.0.1?               // ===================     // = POST OPTION BOX =     // ===================          add_action('admin_menu', 'my_post_options_box');          function my_post_options_box() {         if ( function_exists('add_meta_box') ) {              add_meta_box('categorydiv', __('Page Index Options'), 'post_categories_meta_box_modified', 'page', 'side', 'high');         }     }          //adds the custom categories box     function post_categories_meta_box_modified($post) {     global $post, $noindexCat, $nofollowCat;         $noindexCat = get_cat_ID('noindex');         $nofollowCat = get_cat_ID('nofollow');         if(in_category("noindex")){ $noindexChecked = " checked='checked'";}          if(in_category("nofollow")){ $nofollowChecked = " checked='checked'";}     ?>

             <li id='category-<?php echo $noindexCat ?>' class="popular-category"><input value="<?php echo $noindexCat ?>" type="checkbox" name="post_category[]" id="in-category-<?php echo $noindexCat ?>"<?php echo $noindexChecked ?> /> noindex
              <li id='category-<?php echo $nofollowCat ?>' class="popular-category"><input value="<?php echo $nofollowCat ?>" type="checkbox" name="post_category[]" id="in-category-<?php echo $nofollowCat ?>"<?php echo $nofollowChecked ?> /> nofollow

<input value="1" type="checkbox" name="post_category[]" id="in-category-1" checked="checked"/> Uncategorized

     <?php     }


Displaying a featured image (only img url) as the img src?

I have the following code:               if (themedy_get_option('product_gallery')) { add_action('genesis_post_content', 'themedy_product_images', 1); }     function themedy_product_images() { ?>         <?php          global $post;         $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'numberposts' => 999, 'order'=> 'ASC', 'orderby' => 'menu_order' ) );          if ( $images ) { ?>
     <?php echo get_the_post_thumbnail( $post->ID, 'product-400x600' ); ?>

                 <?php                 foreach ( $images as $image ){                     $gallery_image_info = wp_get_attachment_image_src( $image->ID, 'full' );                     $gallery_image = $gallery_image_info[0];                          $gallery_thumb_info = wp_get_attachment_image_src( $image->ID, 'Gallery Thumb' );                     $gallery_thumb = $gallery_thumb_info[0];                          $gallery_image_alt = get_post_meta($image->ID, '_wp_attachment_image_alt', true) ? trim(strip_tags( get_post_meta($image->ID, '_wp_attachment_image_alt', true) )) : trim(strip_tags( $image->post_title ));                          echo '';                 }                 ?>

      Issue #1: Where it says:               <?php echo get_the_post_thumbnail( $post->ID, 'product-400x600' ); ?>      _I need it to say_               <a id="product" class="MagicZoomPlus" href=" <?php echo get_the_post_thumbnail( $post->ID, 'large' ); ?> " rel="selectors-class: Active"><img src=" <?php echo get_the_post_thumbnail( $post->ID, 'product-400x600' ); ?> " alt="" />`      Where it echo's the images (large and product-400x600), I need it to only echo the img url, without all the other html that comes with it. How can i fix my above code to have it rendered the way I require? Issue #2: Where it says:               echo '';      It is a loop of all the other images in that gallery. For each image in the loop.. _I need it to say_               <a class="Selector" href="<?php echo get_the_post_thumbnail( $post->ID, 'large' ); ?>" rel="zoom-id:product" rev="<?php echo get_the_post_thumbnail( $post->ID, 'medium' ); ?>">      Again, same issue as #1 where I need it to echo just the image url/src. The way it should function is like in this example: http://www.magictoolbox.com/magiczoomplus/ Thank you in advance! **Edit** My first attempt as per Brian's suggestion below for the featured image, works!               <?php         $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');         $image2 = wp_get_attachment_image_src(get_post_thumbnail_id(), 'product-400x600');     ?>     <?php echo ''; ?>      **Now the question is, how do I go about this for the image gallery items?**


How To Put Multiple Image Galleries In A Single Post?

Is there a way to place multiple image galleries in a single post? **Please note that:**   1. I would only like to use Wordpress' built-in gallery function, and not something else, like NextGen gallery.   2. I know that I can group images in a post using `[gallery include="23,39,45"]` or `[gallery exclude="21,32,43"]`, but the thing is, when the user goes to the attachments page (after clicking a thumbnail in the image gallery in a post), all the images are together. I would like to have two completely different galleries in a single post.   3. I know that I can create two pages, add the two sets of images that I have, and then add the two image galleries in a post using `[gallery id="n1"]` and `[gallery id="n2"]`. I do NOT want to do this, as pages are not meant for this (unless, of course, there's no way around).   4. There are plugins that claim to do this, but most of them:     * Only group images, like I mentioned in point (2).     * Others have been developed at least 6 months ago, and the questions by users in the support forums are left unanswered by the plugin authors. So, they are a no-go for me. Is there at all a way to post multiple image galleries in a single post? It would be awesome if there's. Thanks.


the_post(); prints out style text into my HTML?

Every time I use `the_post();` in my theme code, the following is echo'ed into my pages:               <style type="text/css">         <!--         .formTitle {             font-size:20px;             font-weight:bold;             margin-bottom:10px;         }         .formDescription {             font-size:16px;             margin-bottom:15px;         }         .formElement {             margin-bottom:15px;         }         .formElement .textbox {             font-size: 16px;             width:97%;             font-weight: bold;             padding:2px;         }         .formElement .title {             font-weight:bold;         }         .checkbox, .radio {             font-weight:normal;         }         .button {             margin-top:10px;             font-size: 14px;         }         .required {             color:red;         }         -->         </style>      Where in the world is this from? What is it? How do I stop it from being printed out?


Unable to access dashboard (wp-admin) only

I have a site with wp 3.8.1. After I'm logged in to site, white screen welcomes me instead of dashboard page. It logged me in the site, I can access another admin pages & main site but not dashboard. On the other hand, it seems like js/jquery not working in admin pages like "widgets". Here I can't drag or drop widgets. In the console while I visit admin pages, I get `Uncaught ReferenceError: wp is not defined` error. In addition, I've checked here before I post this issue but not related with that.


Empty title on front page/Home

My main problem is around the title. In my index.php, I have specified a title tag and inserted the following:               <?php wp_title(); ?> | <?php bloginfo( 'name' ); ?>      My problem is the it is only printing the blog "name" - wp_title() prints nothing i.e. This is what is being printed from the above: > | Wordpress Test Site NOTE: The Page Title should be: Home Strangely, when I visit My Sample Page, it presents the following: > » Sample Page | Wordpress Test Site And they are both using the same header.php file! Am I missing a setup somewhere that doesn't work on the home page? FYI - I've set the Page - Home as the static front page. Thanks


WordPress Create Post from front-end

I'm having to design an e-commerce site where users should be able to create a product from front-end. In WordPress, the product will simply be a post with custom fields like Price, Condition,....... Also, from front-end, the user should be able to upload pictures. I just need some advice from you guys. What would be the best-practice for this. I've not come across any e-commerce plugin that allow front-end posting of product. So can you please advise me


Need help with simple "if statement" checks to output particlular CPT data depending on what client uploads/fills out

In short, Im not a master of PHP yet and Im not entirely sure how to place a series of checks (if statements) in my template so that it will know what to display depending on what the client uploads/fills out in the CPT ive created... What Im trying to have it do is:   (1) Check to see if there is a URL entered (custom meta box) - if so, display it and wrap it around the featured image...   (2) If no URL is chosen - then only display the featured image by itself...   (3) and lastly, if no banner image is created at all - then display a default image.... Thanks for the help! Here is what I have thus far which is currently not working:               <?php if (get_post_meta($post->ID, 'meta_box_topbanner_url', true))?>         <a href="<?php echo get_post_meta ($post->ID, 'meta_box_topbanner_url', true); ?>" target="_blank">            <?php the_post_thumbnail('top-banner-img', array('class' => 'top-banner-img', 'title' => '')); ?>                   <?php elseif the_post_thumbnail('top-banner-img', array('class' => 'top-banner-img', 'title' => '')); ?>          <?php else '' ?>


Is a multisite install what I need?

I have a client who owns a chain of clubs - all of them unique and requiring different sites, however, there will be one GLOBAL login for members. The members area will include things like club deals, booking in forms, VIP info etc but needs to be the same for all sites. Can someone tell me if a multisite with a membership plugin is what I need to accomplish this. Thanks


change output location of plugin function using a custom hook

I'm running the YouTube Video Fetcher plugin and it fetches youtube videos and displays it on your website. However, instead of displaying the video after the post, I want to hook the code into a custom container. Here is the function in the plugin used to display the video after the post:               //The below function is used to display the video after the post.     function append_the_video($content){         return $content.youtube_video();     }     add_filter('the_content', 'append_the_video');      I tried swapping out the following line:               add_filter('the_content', 'append_the_video');      with this line but it is not working:               add_action('my_custom_hook_name', 'append_the_video');


Change Default Custom Fields Metabox Name

I found that the title of the meta box cannot change via the cctm plugin. It shows "Custom Fields" as default, which is pretty annoying to see. Image So I decided to change it in function.php, here is my code :               add_filter('add_meta_boxes', 'change_meta_box_titles');     function change_meta_box_titles() {     $wp_meta_boxes['my_post_type']['normal']['core']['cctm_default']['title']= 'Details';}      But it failed to work, any idea?


Custom Meta Boxes and Fields for WordPress: Change directory upload based on user-edit page

I have already published this on StackOverflow, but I realised it would be better to post it here instead. I am using the CMB script (Custom Meta Boxes and Fields for WordPress) for uploading files for different users that have the custom role of `cliente`. I am able to show the fields and make them work (though they only appear when editing a user, and not when creating it, but this is for another question). What I am trying to achieve now is to upload files to different folders for different users. Here is the code:               // Here we add a new user role, "cliente"     add_role( 'cliente', 'Cliente' );          add_filter('wp_handle_upload_prefilter', 'my_upload_prefilter');     add_filter('wp_handle_upload', 'my_upload_postfilter');          function my_upload_prefilter( $file ) {         add_filter('upload_dir', 'custom_upload_dir');         return $file;     }          function my_upload_postfilter( $fileinfo ) {         remove_filter('upload_dir', 'custom_upload_dir');         return $fileinfo;     }          function custom_upload_dir( $path ) {         global $pagenow;              // Check if we are on the user-edit.php page         if ( $pagenow == 'user-edit.php' && isset($_GET['user_id']) ) {             // Set the role we want to change the path for             $role_to_check = 'cliente';             // Get a bunch of user info for later use             $user_id = filter_var( $_GET['user_id'], FILTER_SANITIZE_NUMBER_INT );             $meta = get_user_meta($user_id);             $roles = unserialize($meta['wp_capabilities'][0]);             // If we are on the chosen role page, set the $customdir to first_name + last_name             if ( !empty($roles[$role_to_check]) ) {                 $customdir = '/' . $meta['first_name'][0] . $meta['last_name'][0];             }         } else {             // Here we are not on the user-edit.php page. This is just a check to prove that WP is not recognizing the correct page, maybe because we are doing an Ajax call when this function is called. Confusing.             $customdir = '/did-not-work';         }              // If there is any error, just return the $path and abort the rest.         if ( !empty( $path['error'] ) ) {             return $path;         }              // Here we set the new $path with the $customdir set above         $path['path']    = str_replace($path['subdir'], '', $path['path']); //remove default subdir (year/month)         $path['url']     = str_replace($path['subdir'], '', $path['url']);               $path['subdir']  = $customdir;         $path['path']   .= $customdir;          $path['url']    .= $customdir;          return $path;          }      From a few checks I have run it seems like my code does retrieve the user id and the data stored in the db, but it does not detect it when uploading the images. Might this be related to the fact that we are uploading images via Ajax or something like that? Just to be clear, I don't want the upload based on the current logged in user, but on the user I, as a super-admin, am editing using the edit-user.php page. Any help would be much appreciated.


Custom ID for certain menu item?

I'm displaying Wordpress menu using this function:               wp_nav_menu( $args );      Menu is set in wp-admin/nav-menus.php. Can I somehow attach ID of my choice to one of the items? I want the menu to look like: [ Link 1 ] [ Link 2] [ LOGO (that is Link 3 also ] [ Link 4 ] [ Link 5] I know I could style ID of the logo link such as "menu-item-123", but I'd love to change it to "logo" or something that has a meaning :) Thanks.


Comparing Time with the_time();

I am trying to make a function that will check the time associated with a future event (cpt) with the current time, to see if the event has past. When I first collect the time it is in seconds and I can then convert it easily with date_i18n() to whatever, but I am not sure how to compare that results with the wordpress function the_time() to retrieve the current time. Is there a way to have the_time() spit out the result in seconds, and I can then compare the two simply by ><= ? or is there a way to compare two dates formatted in the same way? So formatting my date_i18n() result the same way as the_time() result and then comparing somehow


How to integrate video slide using custom post types?

currently i know how to make a jquery slider and pull images by get thumbnail . But is there any way to make a option (using custom post types/custom fields/meta boxes) to get a video by id and show that video in the slider? I have seen many theme developers are using flex slider and they included option for users to add videos to the slider .


get_terms with more than x post count

Is there an argument for get_terms which I can fetch terms that only have say over 2 posts associated with it?   I have a terms page which lists all my terms for 'artists', the page is huge but a lot of these terms that only have one post so I would like to show only significant terms.


prefix to post permalinks without affecting category permas

I'm trying to make my links like this:               site.com/article-sample-post      as "article" is a fixed prefix and "sample-post" is the post slug.. but that prefix affect the category link structure making it :               site.com/article-category/sample-cat      which is not desired! my question: does there any simple hack or plugin so i can make working permalinks like this:               site.com/article-sample-post     site.com/sample-cat      Thanks,


Custom Menu url is Empty

I added a new menu using this code:               wp_update_nav_menu_item($menu->term_id, 0, array(                 'menu-item-title' => 'Custom menu',                 'menu-item-url' => 'http://mylink.com',                          'menu-item-db-id' => 0,                 'menu-item-object' => 'custom',                 'menu-item-parent-id' => 328,                 'menu-item-type' => 'Custom',                            'menu-item-status' => 'publish',)             );      That code generates a menu the way I wanted. But the link is totally empty. What did I do wrong?


How to prevent loading of all plugin's resources?

Wordpress is loading all client resources of all plugins, not just the plugin of interest. It may make sense to load jqery globally but it makes no sense to load all other plugin's Javascript in a back-end plugin. Now, how can I prevent that Wordpress is loading other plugin's resources? There's wp_dequeue but I am not sure there is another callback at the end of loading all plugins, so I can clean it up alltogether myself. I am currently interested in filtering back-end plugin resources only. ps: i am really stuck at this and I am actually very surprised that it seems to be designed like this, I mean, wp_enque is fine but WP doesn't care for what it is ,so you need to do all the leg-work yourself. Simply imagine 2+ different Dojo/CommonJS/Require-JS based applications with their own configs and versions being loaded : trouble non stop, that's what I am facing now. thank you, any idea is welcome.


Where do hackers usually run their hacking script?

So in my quest to solve this mystery, I actually found some script that might be similar to one used to deface our sites: http://pastebin.com/raw.php?i=hcvPE8YV Now my question is where do they usually run this? Do they run it inside the hacked server or their own PCs?


Associating custom submenu item with post type of top level menu item

I'm working on a plugin that sets admin menu submenu pages on all different post types. I need to be able to associate these new submenu pages with the corresponding post type of the top level menu item. Is this possible without having to rely on using `$_GET`? I see that `$typenow` is used on `edit.php`, but I cannot use that on my custom page, as it only returns `NULL`. So basically: How do I set appropriate/associate post type to a custom menu item. **UPDATED:** Here's an image that hopefully describes a little bit better what I'm after. ![http://i.imgur.com/4q4Dy.jpg](http://i.stack.imgur.com/VPo8Y.jpg) As it is now, the Custom Item in the submenu is only available when Pages is active since otherwise `$_GET` can't fetch `post_type`. I'm using:               $post_type = esc_attr( $_GET['post_type'] );     $post_type_object = get_post_type_object( $post_type );         $title = $post_type_object->labels->name;          $page = add_submenu_page( 'edit.php?post_type=' . $post_type, $title, $title, 'edit_pages', 'order-' . $post_type, 'cmspo_menu_order_page' );      So I need a way to grab the appropriate post type that the custom item should be associated with, in this case it's "page", but there will be custom items under each custom post type that's been registered with the `capability_type` "page" rather than "post".


Return only posts in a primary menu within loop in the order in which they appear in the menu post__in

I'm working on a single scroll site. I want to include ONLY pages which appear in the primary menu of the site. If a page is not in the primary menu, it should NOT be included in the loop. I also want the order of pages output by the query to be in the same order which they are in the menu. Here is what I have so far:               $page_sort_sections = sort_sections();          $args = array(         'posts_per_page' => -1,         'post_type' => 'page',         'post__in'  => (array) $page_sort_sections,         'orderby' => 'post__in',         );          $home_query = new WP_Query($args);            if($home_query->have_posts()):  while($home_query->have_posts()) : $home_query->the_post();              get_template_part('page-sections');              endwhile;          else:              get_template_part( '404');          endif;      That takes care of setting up the query. Here is the code of the function which I am using to pass in the post__in array:               if ( ! function_exists( 'sort_sections' ) ){              function sort_sections(){                  if(!has_nav_menu( 'primary' )){                 return;             }                  if ( ( $locations = get_nav_menu_locations() ) && isset( $locations['primary'] ) ) {                      $menu = wp_get_nav_menu_object( $locations['primary'] );                      $items  = wp_get_nav_menu_items($menu->term_id);                      $sections = array();                      foreach((array) $items as $key => $menu_items){                          if('page-sections' == $menu_items->object){                              $sections[] = $menu_items->object_id;                     }                      }                      return $sections;                  }              }          }      I did a var_dump on the query and its returning:               ["post__in"]=>     array(0) {     }     ["orderby"]=>     string(8) "post__in"     }      Any thoughts on why this not returning the IDs of the items in the menu?


Listing and accessing categories for a custom post type

I have two post types: Projects and Events. I want each of these post types to have their own categories: Upcoming and Past. I have an archive page displaying the posts in these types. However, on this page I want to _list the categories_ that this post type has. I've done some research but to no avail. I then want that list to link to the category, showing the posts in the category for the current post type (Projects or Events). So I have two questions:   1. How do I generate the list of categories with links?   2. What would the URL be for showing a category in a custom post type? I've tried creating a category.php page and accessing `/projects/upcoming/` but again, to no avail.


open selected wordpress post with javascript

I'd like to create a link that opens the selected post via javascript onclick in the loop. If I use `<a href="<?php the_permalink(); ?>More...</a>` in the loop it opens the correct post. But If I use                         More...      it just won't open the correct selected post. How can I make this work?


How to check if current static page is frontpage from admin plugin

I set static page as front page. I need to know if user currently on homepage in my custom plugin. Functions **is_home()** and **is_front_page()** doesn't works, since homepage is static page. I can get an id of this page :               $frontpage_id = get_option('page_on_front');      But how to get id of current page from admin plugin? (Then i'll be able to compare those ids and detect if current page is homepage!) 2 vancoder Code: 1) Set any static page as frontpage. 2) Create dummy plugin 3) Code of plugin :               $d = is_front_page();     var_dump($d);          ==>           bool(false)      **UPD** http://codex.wordpress.org/Conditional_Tags#The_Front_Page should work, by didn't 2 Vancoder Admin plugin means just plugin :) sorry And those two lines is all context for now, try it yourself, it doesn't works. WP version 3.3.2


Using one custom taxonomy.php for two custom taxonomies?

I have registered 2 custom taxonomies, 'allergy' and 'gmc_allergy' which are of post type 'gmc_recipe'. I have a taxonomy-allergy.php and when I go to blah.com?allergy=test then it correctly lists all posts that have 'allergy' assigned to them. It also correctly lists any 'gmc_allergy' as long as there are some 'allergy' in the list too (due to my custom logic in the taxonomy-allergy.php). How can I make blah.com?allergy=test return results for 'gmc_allergy' when there are 0 results for the taxonomy 'allergy' but there are results for 'gmc_allergy'? Currently I get a 404 error which is understandable since my logic for showing 'gmc_allergy' is within the taxonmy-allergy.php and that never gets executed as there are 0 results for 'allergy'. I have created:               function gmc_pre_get_posts($query)     {       if (!is_admin() && $query->is_main_query())       {         if (is_tax())         {            $query->set('taxonomy', array('gmc_allergy', 'allergy')); //So now it will also include gmc_allergy where before it was only checking for allergy which was in the url?            $query->set('post_type', array('post', 'page', 'gmc_recipe');         }       }       return $query;     }      But this still gives me a 404, am I on the right path? What am I doing wrong?


Saving multiple Metabox contents

I'm putting together a fairly simple Custom Page for a friend on their WordPress site, but I'm having some real difficulties getting the contents of the Metaboxes to save correctly. WordPress doesn't seem to behave like I'd expect PHP to, so when I place echo statements around the place to see where it got up to, they don't always appear, even when the code must be running. Very strange. Can anyone help point out what I've done wrong? (Sorry for the large amount of code!)               function metabox_exhibition_setup() {         /* Add 'start_date' hook. */         add_meta_box('gc_start_date',                  esc_html__('Exhibition Start Date'),                 'create_metabox_exhibition_start_date',                 'gc_exhibition',                  'side',                  'default');              /* Add 'finish_date' hook. */         add_meta_box('gc_finish_date',                  esc_html__('Exhibition Finish Date'),                 'create_metabox_exhibition_finish_date',                 'gc_exhibition',                  'side',                  'default');              /* Add 'subtitle' hook. */         add_meta_box('gc_subtitle',                  esc_html__('Exhibition Subtitle'),                 'create_metabox_exhibition_subtitle',                 'gc_exhibition',                  'normal',                  'core');              add_action( 'save_post', 'save_metabox_exhibition', 10, 2 );             }          /* Save the meta box's post metadata. */     function save_metabox_exhibition( $post_id, $post ) {         $fields = 0;              if($_POST) {         $metaboxes[0]['nonce'] = $_POST['exhibition_finish_date_nonce'];         $metaboxes[0]['data'] = $_POST['gc_finish_date'];         $metaboxes[1]['nonce'] = $_POST['exhibition_start_date_nonce'];         $metaboxes[1]['data'] = $_POST['gc_start_date'];         $metaboxes[2]['nonce'] = $_POST['exhibition_subtitle_nonce'];         $metaboxes[2]['data'] = $_POST['gc_subtitle'];         $fields = count($metaboxes);             $fields = count($metaboxes);         }              //print_r($metaboxes);              for($i = 0; $i <= $fields ; $i++ ) {             /* Verify the nonce before proceeding. */             if ( !isset( $metaboxes[$i]['nonce'] ) || !wp_verify_nonce( $metaboxes[$i]['nonce'], basename( __FILE__ ) ) )                     return $post_id;                  /* Get the post type object. */             $post_type = get_post_type_object( $post->post_type );                  /* Check if the current user has permission to edit the post. */             if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )                     return $post_id;                  /* Get the posted data and sanitize it */             $new_meta_value = ( isset( $metaboxes[$i]['data'] ) ? sanitize_html_class( $metaboxes[$i]['data'] ) : '' );                  /* Get the meta key. */             $meta_key = $metaboxes[$i]['data'];                  /* Get the meta value of the custom field key. */             $meta_value = get_post_meta( $post_id, $meta_key, true );                  /* If a new meta value was added and there was no previous value, add it. */             if ( $new_meta_value && '' == $meta_value )                     add_post_meta( $post_id, $meta_key, $new_meta_value, true );                  /* If the new meta value does not match the old value, update it. */             elseif ( $new_meta_value && $new_meta_value != $meta_value )                     update_post_meta( $post_id, $meta_key, $new_meta_value );                  /* If there is no new meta value but an old value exists, delete it. */             elseif ( '' == $new_meta_value && $meta_value )                     delete_post_meta( $post_id, $meta_key, $meta_value );         }


Register a script to be enqueued both in admin and front end

As i understand it, admin scripts are supposed to be registered and enqueued through the `admin_enqueue_scripts` hook and all other scripts at `wp_enqueue_scripts` so i have set up the following functions to register and enqueue all my scripts in a clear and organized way. My question is, what if i need certain scripts (eg. jquery validate plugin) both in admin and on the front end? what is the recommended method for registering and enqueuing the script in this case? register it twice with diferent a $handle or register it through `wp_enqueue_scripts` only and if so, is there not the risk of it not being called when required ? (i mean, why else would `admin_enqueue_scripts` exist if not to make those scripts available at an earlier time? I would really appreciate someone explain this to me to fully understand the nuances of enqueuing scripts in wp. Thanks My code:               // REGISTER ALL NON-ADMIN SCRIPTS     add_action( 'wp_enqueue_scripts', 'register_all_non_admin_scripts' );     function register_all_non_admin_scripts() {          wp_register_script( ... );     wp_register_script( ... );          }          // ENQUEUE NON-ADMIN SCRIPTS CONDITIONALLY     add_action( 'wp_enqueue_scripts', 'enqueue_scripts_where_required' );     function enqueue_scripts_where_required() {          // scripts to be loaded at all times     wp_enqueue_script( '' );          // scripts to be loaded conditionaly     if( is_page( '' ) ) {         wp_enqueue_style( '' );     }     }          // REGISTER ALL ADMIN SCRIPTS     add_action( 'admin_enqueue_scripts', 'register_all_admin_scripts' );     function register_all_admin_scripts(){     wp_register_script( ... );     wp_register_script( ... );     }          // ENQUEUE ADMIN SCRIPTS     add_action( 'admin_enqueue_scripts', 'enqueue_admin_contact_cpt_js' );     function enqueue_admin_contact_cpt_js(){          global $post_type;          // scripts to be loaded at all times     wp_enqueue_script( '' );          // scripts to be loaded conditionaly by post type     if( 'contact' == $post_type ){         wp_enqueue_script( '' );         ...     }     }


Rewrite url / permalink for default archive - yearly / monthly

I want to change the structure of yearly/monthly archive URL of default post type `'post'`. As we know be default the URLs are like: Default: `http://wwww.domain.com/2013/09` but want them rewritten, so end up like this: New: `http://wwww.domain.com/about/blog/archive/2013/09` i tried following but do seem to work:               add_rewrite_rule("about/blog/archive/([0-9]{4})/([0-9]{2})/page/?([0-9]{1,})/?",'index.php?post_type=post&year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]','top');          add_rewrite_rule("about/blog/archive/([0-9]{4})/([0-9]{2})/?",'index.php?post_type=post&year=$matches[1]&monthnum=$matches[2]','top');          add_rewrite_rule("about/blog/archive/([0-9]{4})/page/?([0-9]{1,})/?",'index.php?post_type=post&year=$matches[1]&paged=$matches[2]','top');          add_rewrite_rule("about/blog/archive/([0-9]{4})/?",'index.php?post_type=post&year=$matches[1]','top');      I'd like someone to point to the right direction, need more info do leave a comment. thanks.


Recent Posts+, how to solve multiwidget?

I have installed the Recent Posts plugin, that came with a widget. Now, i can only add one instance of the widget to the widget areas. I want one instance to show in my widgetarea that only appears on my startpage, and one instance of the widget to my widgetarea that appears on other pages. Now, the widget doesnt seem to support "multiwidget", but the "widget instances" are supposed to have the exact same configuration. Is there any way to "Force" WP into adding the widget to my other widget area too, even if it means "hacking" the DB?


What is the best way to move a plugin´s subdirectory+files to wp-content/uploads-directory?

I am developer of the plugin Leaflet Maps Marker (http://www.mapsmarker.com \- "Pin, organize & show your favorite places through OpenStreetMap, OGD Vienna or any custom WMTS-map") and have one question: the plugin contains about 100 marker icons from Maps Icons Collection (mapicons.nicolasmollet.com) which can be used to mark your favorite places. These icons are stored in **wp-content\plugins\leaflet- mapsmarker\img\mapicons**. Now users can upload other own icons from the collection (which consist of more than 700 icons). Problem is, that if the users upload the custom icons to the plugins-directory and I release an plugin update in the future, the uploaded icons get deleted and have to be uploaded again by the user. So I started working on moving the mapsicons-directory to **wp- content/uploads/leaflet-maps-marker-icons**. Creating a directory works quite fine with the wordpress function wp_mkdir_p():               $target = ABSPATH . 'wp-content/uploads/leaflet-maps-marker-icons';     wp_mkdir_p( $target );      as a next step, I wanted to move the directory from plugins by also using the (undocumented) wordpress file api function copy_dir():               $source = WP_PLUGIN_DIR . '/' . end(explode('/', dirname(__FILE__))) . '/img/mapicons'; //allows plugin directory names other than leaflet-maps-marker     $target = ABSPATH . 'wp-content/uploads/leaflet-maps-marker-icons';     copy_dir($source, $target, $skip_list = array() );      Unfortunately this didnt work - I get the error: > Fatal error: Call to a member function dirlist() on a non-object in /wp- > current/wp-admin/includes/file.php on line 756 Has anyone here used this function in one of his projects before and knows how to use it correctly? or: do you know any other safe ways to copy/move files using wordpress functions? I don´t want to use PHP command directly, as from my experience, there are too many possible configurations of webservers leading to increased support requests (safemode on/off, having to enter ftp credentials...). Any help is really appreciated! To be complete, here is the code for the function copy_dir() from file.php:               function copy_dir($from, $to, $skip_list = array() ) {     global $wp_filesystem;          $dirlist = $wp_filesystem->dirlist($from);          $from = trailingslashit($from);     $to = trailingslashit($to);          $skip_regex = '';     foreach ( (array)$skip_list as $key => $skip_file )         $skip_regex .= preg_quote($skip_file, '!') . '|';          if ( !empty($skip_regex) )         $skip_regex = '!(' . rtrim($skip_regex, '|') . ')$!i';          foreach ( (array) $dirlist as $filename => $fileinfo ) {         if ( !empty($skip_regex) )             if ( preg_match($skip_regex, $from . $filename) )                 continue;              if ( 'f' == $fileinfo['type'] ) {             if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) {                 // If copy failed, chmod file to 0644 and try again.                 $wp_filesystem->chmod($to . $filename, 0644);                 if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) )                     return new WP_Error('copy_failed', __('Could not copy file.'), $to . $filename);             }         } elseif ( 'd' == $fileinfo['type'] ) {             if ( !$wp_filesystem->is_dir($to . $filename) ) {                 if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) )                     return new WP_Error('mkdir_failed', __('Could not create directory.'), $to . $filename);             }             $result = copy_dir($from . $filename, $to . $filename, $skip_list);             if ( is_wp_error($result) )                 return $result;         }     }     return true;     }      updated code (as within comments code was not formatted properly)               WP_Filesystem();     $target = ABSPATH . 'wp-content/uploads/leaflet-maps-marker-icons';         if (!is_dir($target)) //check for multisite installations         {             wp_mkdir_p( $target );             $source = WP_PLUGIN_DIR . '/' . end(explode('/', dirname(__FILE__))) . '/img/mapicons';             copy_dir($source, $target, $skip_list = array() );             $zipfile = ABSPATH . 'wp-content/uploads/leaflet-maps-marker-icons/mapicons.zip';             unzip_file( $zipfile, $target );         }


how can i simple change upload folders to %year%/%month%/%day%?

Is there a easy way to do that? Godaddy have a silly limit of 1024 files in one folder and my client upload more than 500 and with the thumbnails we get lot over the limit. If im able to changed folders into %year%/%month%/%day% i will be safe about that limit Also another question is if i can make wordpress to generate thumb only when needed. For example home slider will only use 10 images i dont want the other 1000 images have that thumbnail generated. Thanks for the help!


How to set my main menu items

I am new to WordPress development, hope this is not a too stupid question. How can I setup my Menu such that it has links to   * Home   * About (Page)   * Blog (I think posts in all categories except Portfolio & In the Works)   * Portfolio (Category)   * In the Works (Category) I think all is easy except I dont immediately see a way to point to the home page (maybe I need to "hardcode" something like `http://domain.com`?) Also how can I have a link to the Blog Just in case, I am refering to the below screen ![](http://imgur.com/AjPhM.jpg)


HTML tables in content areas

Is there a plugin that would allow me to create and edit tables within the content block in posts and pages? I suppose a bit like the 'insert table' command in MS Word.


Does not work bookmarklet in the theme Tagology

There is a theme for WordPress - http://cuppster.com/tagology/ I installed it, but bookmarklet does not work! I did everything as written on the website of the topic, but if you click on the link "Tag It", then nothing happens. In what could be the problem? Help please.


Converting primary keys from autoincrement integers to UUIDs

## The Goal I'd like to have WordPress use a unique identifier instead of auto incrementing on the primary key, which is currently the WP standard approach, in order to facilitate integration of several WP websites. ## The Reasoning I need the key to be universally unique, at least within the domain of the several WordPress websites. The idea is to synchronise posts and other data between the sites in such a way that a post created on any site is available to every other site as well. The different websites will be on different servers in different locations. ## The Issue The autoincrement functionality which WP relies on will clearly cause the same key to be used in the corresponding table of each WP site for different posts, i.e. the first post in each website will be `1`, whilst I need it to be unique across all installations so that I can merge the data from each of them into every other website. When WP retrieves the primary key it casts those values to integer. When PHP receives the BIGINT from MySQL, it would normally manage it as a float because it is bigger than PHP's int limit, but casting it as int in PHP has the effect of truncating it in my case. ## What i've done so far I am currently using PHP's `uniquid()` function to generate the key which produces a 13 character string, which then converts into a decimal in the area of `1388661576514060` (tonight), which is smaller than a `BIGINT` in MySQL (up to `18446744073709551615`), so that's cool and an override i've applied to `wpdb` successfully writes it into the database, but PHP's integer limit is much smaller, up to `2147483647`. It is fairly straightforward to do this by overriding the `insert_replace` helper function and the query function in `wpdb` with functions in a new class which set and remember a unique value to be used as a primary key. I'm currently aiming to try and remove the `(int)` casting and see if that solves my problem, though i'd prefer not to make changes to the WP core, it appears it may be my only option. * * * ## Thoughts I am concerned with taking this approach, because whilst it may solve my immediate need it could cause worse problem somewhere else down the line and i'm wondering if anyone had attempted something similar before. Additionally i'm curious as to why the developers have used specific casting - I love PHP's loose data typing, so it's not something that I would do unless there was a specific reason. I have sufficiently burnt fingers to respect other programmer's reasons enough to try and find out what they are, thus the question. I would really prefer not to hack the core at all for all the obvious reasons, could anyone offer and thoughts or ideas on how to work-around this problem or alternatively a different way to approach it?


How to prevent plugin, theme installation failures on Wordpress?

I am unable to install any theme/plugin to my wordpress 3.0               Downloading install package from http://downloads.wordpress.org/plugin/contact-form-7.2.3.1.zip…         Unpacking the package…         Installing the plugin…         Could not copy file. /public_html/blog/wp-content/plugins/contact-form-7/languages/wpcf7-lt_LT.po         Plugin install failed.               Downloading install package from http://wordpress.org/extend/themes/download/piano-black.2.2.zip…     Unpacking the package…     Could not create directory. /public_html          Downloading install package from http://downloads.wordpress.org/plugin/contact-form-7.2.3.1.zip…     Unpacking the package…     Could not create directory. /public_html/blog/wp-content/upgrade/contact-form-7.tmp/contact-form-7      I get similar messages everytime. Is there any solution? **Update 12/01/2012** : If you're using a latest version of WP (3.1 and above, 3.3.1 as of today), you will not have any problems. These issues have been removed. Enjoy your WP.


Post loop count is not in order

I am using custom post type. But on landing page Count of post loop is not in order               <?php $loop = new WP_Query( array( 'post_type' => 'focus-areas' ,'get' => 'all') );  ?>                  <?php while ( $loop->have_posts() ) : $loop->the_post(); $counts++; ?>     <?php echo $counts; ?>      This printing as 16, 1, 3, 4, 5,.... All the post are getting display but it's not in order. i searched in google and wordpress site but din't get any solution


Show related posts on single.php, grouped by taxonomy terms, with Advanced Custom Field post object selected

I have posts of custom taxonomy called Areas with terms such as Articles, Presentations, News etc. These terms are applied to the normal post-type "post". Under a custom-post-type called "Company", I added an Advanced Custom Field Post Object with the field name `associated_items` to select posts related to this Company. Currently I have this function on my `single-company.php` which shows the posts selected in ACF field `associated_items`...               <?php $post_objects = get_field('associated_items');?>     <?php if( $post_objects ): ?>

Related Posts
                 <?php foreach( $post_objects as $post): ?>                 <?php setup_postdata($post); ?>                         <?php get_template_part( 'content', 'excerpt' ); ?>                 <?php endforeach; ?>
         <?php wp_reset_postdata(); ?>     <?php endif; // end if( $post_objects ) ?>      The above code only outputs the posts selected in the ACF custom field `associated_items` but in chronological order whereas I'd like it to be grouped according to taxonomy terms, for example like the following: ## Posts related to the Company Articles   * a post under the area "Articles"   * another post under the area "Articles"   * and another post under the area "Articles" Presentations   * a post under the area "Presentations"   * another post under the area "Presentations"   * and another post under the area "Presentations" News   * a post under the area "News"   * another post under the area "News"   * and another post under the area "News" Many many many thanks in advance!


Specific html within wordpress loop

I am trying to setup a wordpress slider, how can I achieve exact below result within a wordpress loop

Slide 1 Description Goes Here

Slide 2 Description Goes Here

Slide 3 Description Goes Here

                     Show Me
Slide 1                     Show Me
Slide 2                     Show Me
Slide 3
      for example, I want to show above code within                $my_query = new WP_Query('cat=49&showposts=4&orderby=RAND');     while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID;     ?>           above code          <?php endwhile; ?>      Please do let me know if there is any other way to achieve the same result but orderby=RAND is important for me BR


WP_Error with get_category_parents

I get this error in my theme: > Catchable fatal error: Object of class WP_Error could not be converted to > string in `/home/winentra/public_html/s1.ssonline.co.in/wp- > content/themes/peekaboo/admin/common-functions.php` on line 186 Line No. 186:               echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');      Context:                elseif ( is_single() ) {               $cat = get_the_category();                    $cat = $cat[0];               echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');               echo $currentBefore;               the_title();               echo $currentAfter;     }      Any ideas on this please?


Exclude pages by menu order

i have a "Default Page Generator" on theme activation i have created...   in that file i set 'menu_order' for each page. **i want to exclude pages with menu order bigger then 50 from the default wp_list_pages menu** Is there a way to check for / retrieve 'menu_order' of each page? and if there is can you think of a way to intergrate it into the wp_list_pages function?


Show image on the left and content on the right using ul li

Well im looking for a way to do this. In the index to show each post, with the "thumb" on the left and the content of the right using ul li to do so.(http://ae.tutsplus.com/ for example) So far i figure out that with the usual loop i cant separate text and iamge, so im guessing i need to add some php to the mix?


Set font size automatically according to number of words in post

By submitting a post for publication will be made a count of the number of words in the post and will add a div with font-size pre-set according to the number of words. If the post contains up to 50 words, returns with font-size:18px;

Text with up to 50 words.

       If the post contains 50 to 100 words, returns with font-size:16px;

Text with 50 to 100 words.

      The span will be closed after the last `</p>`.

paragraph 1

paragraph 2

paragraph 3

      Does anyone know of any function to it? Thank you.


Give visitor access to password protected page/post via external script

**Overview:**   On my site I want to do a customer area. There is a form where the visitor enters a name (e.g. "event_xyz") and a password. Only some well informed circles (participants of the event xyz who want to download some files) will know the access data. By submitting, the visitor is redirected to a pp- redirect.php which should set the cookie to access the specific site the visitor wants to access - $_POST['name'] equals the post's slug. I found this script to set that cookie and tried to solute my problem like this:               global $wp_hasher;     if ( empty( $wp_hasher ) ) {         require_once( ABSPATH . 'wp-includes/class-phpass.php' );         $wp_hasher = new PasswordHash(8, true);     }          setcookie( 'wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword( stripslashes( $_POST['pw'] ) ), 0, COOKIEPATH );          wp_safe_redirect( "http://www.domain.com/wordpress/".$_POST['name'] );     exit();      But this shows me the error that in this file and in wp-includes/pluggable.php the headers were already sent. I also don't know how the script, which is taken from the wp-login.php?action=postpass, knows which site I want to access. Any solutions?


I have posted a question on StackOverflow (sorry for the cross link) and while I'm striving to find a solution to this, I stumbled across this warning : > Warning: urlencode() expects parameter 1 to be string, array given in > /var/www/.../httpdocs/wp-includes/formatting.php on line 3192 And doing a backtrace, I find it originates in `query.php` : **wp_includes/query.php** , _lines 1710...1712_               if ( isset( $t->rewrite['hierarchical'] ) && $t->rewrite['hierarchical'] ) {          $q[$t->query_var] = wp_basename( $q[$t->query_var] );     }      Now, I get this error because one of my URL param is an array of categories, where I'm trying to search and return all product (custom post type) that has one or more of the defined categories assigned. Why is WordPress trying to call `basename` on an array of `GET` parameter is beyond me. Anyone care to explain this to me? Thanks!


Why is an array created in a function hooked to customize register populated when customizer is loaded but not when the front-end is loaded?

I have a function that is designed to do two things: 1) create color picker controls/ settings in the customizer and 2) create a multi-dimensional array `$customizeData` to be outputted in header styles and used to localize variables for customizer.js. The first objective is successful. The second one has driven me here. I added a var_dump for `$customizerData` to index.php the array is null on the front end, but is populated as expected when I load it inside the customizer. Here is the function in question:               if (! function_exists('_sf_customzier_color_loop') ) :     function _sf_customzier_color_loop($colors, $countStart = 10, $section) {     //Not sure why I have to do this first thing     global $wp_customize;     //declare $customizerData as a global variable     global $customizerData;     //start the counter at 10 or whatever was set.     $count = $countStart;     foreach ($colors as $things) {         $slug = $things['slug'];         $id = "_sf[{$slug}]";         //If current array has a priority set, use it, if not use the counter.         if (! isset($things['priority']) ) {             $priority = $count;         }         else {             $priority = $things['priority'];         }         $wp_customize->add_setting( $id, array(             'type'              => 'option',              'transport'     => 'postMessage',             'capability'     => 'edit_theme_options',             'default'       => $things['default'],         ) );              $control =          new WP_Customize_Color_Control(                 $wp_customize, $slug,              array(             'label'         => __( $things['label'], '_sf' ),             'section'       => $section,             'priority'      => $priority,             'settings'      => $id             )          );         $wp_customize->add_control($control);         //create array to be used for the outputting styles to wp_head and customizer.js         $customizerData [] = array(             'id' => $id,             'slug' => $slug,              'selector' => $things['selector'],             'property' => $things['property'],         );              //advance priority counter         $count++;     }     }     endif;     // ! _sf_customzier_color_loop exists       You can see an example of what I am feeding to this at: https://github.com/Shelob9/_sf_lib/blob/1.1-fancy-data/customizer/customizer- sidebar.php What do I need to do so that that the array is populated on the front end?


Translating plugin or locale file

I need to have custom translation for a single country and give people the option to select between it and english... is there a plugin to provide a alternate set of text for pages and posts? thanks


custom post type taxonomy "tag" archive : no post found

I've registered a custom post type "object" and registered the taxonomy "post_tag" so that these objects can be tagged.               register_taxonomy_for_object_type('post_tag', 'object');      When I visit `domain.com/tag/{object-slug}` it does not find any post, although there are. Here is how my CPT was declared:               register_post_type( 'objet',              array('labels' => array(/* removed for clarity */),                 'description' => __( 'blabla' ),                  'public' => true,                 'publicly_queryable' => true,                 'exclude_from_search' => false,                 'show_ui' => true,                 'query_var' => true,                 'menu_position' => 3,                  'menu_icon' => get_stylesheet_directory_uri() . '/library/images/custom-post-icon.png',                  'rewrite'   => array( 'slug' => 'stock', 'with_front' => false ),                  'has_archive' => 'stock',                 'capability_type' => 'post',                 'taxonomies' => array('post_tag'),                 'hierarchical' => false,                 'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', 'sticky')             )          );


$attachment->post_title not displaying title

I have this little piece of php.               $attr = array(                 'class' => 'bigImg',                 'alt' => trim(strip_tags( $attachment->post_excerpt )),                 'title' => trim(strip_tags( $attachment->post_title )) );      I have this in the html:               <?php echo the_post_thumbnail( 'featured', $attr ); ?>      and as you might have guessed I want to output the alt and title from the post, but it doesn't seem to be doing it. Here's the output:               <img width="1081" height="608" src="http://lart.co.uk/wordpress/wp-content/uploads/2013/07/img4.jpg" class="bigImg wp-post-image" alt="" title="" />       So why do I have no title and alt?


BP Profile search results won't link to user's profile page

I have installed the bp profile search along with s2member and want to perform profile searches amongst the different levels of membership, however, when the search results display and I click on one of the search results, their profile page will not display. It always puts "author/" before the members profile name in the url. How can I remove the "author/" from the url?


Custom Meta Boxes: multiple fields within a repeatable field

I am working on a meta box for events. Each event has it's own page with a meta box for the line-up, background image, tickets page URL and some text. To create the line-up I would like to use the repeatable fields from the "Reusable Custom Meta Boxes tutorial" from WP Tuts +: http://wp.tutsplus.com/tutorials/reusable-custom-meta-boxes-part-1-intro-and- basic-fields/. However, I don't know how to add multiple fields within the repeatable fields. This is the idea: [repeatable]   \- Text field: Name of the artist   \- Text field: Artist website   \- Checkbox: Headliner (Yes or no)   [/repeatable] This is the code from the tutorial:               function meta_box_callback($fields, $page) {         global $post;         echo '<input type="hidden" name="'.$page.'_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';              // Begin the field table and loop         echo '
';         foreach ($fields as $field) {             // get value of this field if it exists for this post             if ($field['label'])    $label      = $field['label'];             if ($field['desc'])     $desc       = ''.$field['desc'].'';             if ($field['id'])       $id         = $field['id'];             if ($field['type'])     $type       = $field['type'];             if ($field['value'])    $value      = $field['value'];             if ($field['options'])  $options    = $field['options'];                  $meta   = get_post_meta($post->ID, $id, true);             // begin a table row with             echo '
                     '.$label.'	                     ';                     switch($field['type']) {                         case 'repeatable':                             echo '+
';                             $i = 0;                             if ($meta) {                                 foreach($meta as $row) {                                     echo '
|||                                                 <input type="text" name="'.$field['id'].'['.$i.']" id="'.$field['id'].'" value="'.$row.'" size="30" />                                                 -
';                                     $i++;                                 }                             } else {                                 echo '
|||                                             <input type="text" name="'.$field['id'].'['.$i.']" id="'.$field['id'].'" value="" size="30" />                                             -
';                             }                             echo '
                                 '.$field['desc'].'';                         break;                     } // switch             echo '
';         } // foreach         echo '
'; // table     }     function meta_box_save($post_id, $fields, $page) {              // verify nonce         if (!wp_verify_nonce($_POST[$page.'_meta_box_nonce'], basename(__FILE__)))              return $post_id;         // check autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)             return $post_id;         // check permissions         if ($page != $_POST['post_type']) {             if (!current_user_can('edit_page', $post_id))                 return $post_id;             } elseif (!current_user_can('edit_post', $post_id)) {                 return $post_id;         }              // loop through fields and save the data         foreach ($fields as $field) {             if($field['type'] == 'tax_select') {                 // save taxonomies                 $term = $_POST[$field['id']];                 wp_set_object_terms( $post_id, $term, $field['id'] );             }             else {                 // save the rest                 $old = get_post_meta($post_id, $field['id'], true);                 $new = $_POST[$field['id']];                 if ($new && $new != $old) {                     update_post_meta($post_id, $field['id'], $new);                 } elseif ('' == $new && $old) {                     delete_post_meta($post_id, $field['id'], $old);                 }             }         } // foreach     }      Hope you guys can help me out :-).


Multisite sub-directories IIS 7.5 change media/uploads location

I am running WP 3.8.1 Multisite. Sub-directories is configured. I have 10 sub- directory sites and 1 primary site. WordPress is running on a Windows 2008 R2 datacenter 64bit server with IIS 7.5. I have 2 partitions on this server; 60GB drive C for OS, IIS (inetpub), and WordPress and 100GB drive D intended for all the uploads that will be going into WordPress (pictures, docs, videos, etc...) I'm trying to point each site's upload path to a folder on drive D, to do this I highlight My Sites > highlight Network Admin > click Sites > I pick a site and click Edit on one of the sites > and on the Edit Sites screen I click on the Settings tab and scroll down to the field "Upload Path". I want each site to have its own folder on the D drive, for example: 1.) Primary site (http://mydomain.com/) = D:\wordpress\uploads\primary\ 2.) Sub-directory site named "foo" (http://mydomain.com/foo) = D:\wordpress\uploads\foo 3.) Sub-directory site named "bar" (http://mydomain.com/bar) = D:\wordpress\uploads\bar 4.) Sub-directory site named "test" (http://mydomain.com/test) = D:\wordpress\uploads\test etc... So after creating all the folders and editing each site's upload path I did an upload test       **Test #1 - Primary site** Dashboard > Media > Add New > Select File > choose file test.jpg > progress bar says "100%" then "Crunching" > I immediately notice the thumbnail for the image is broken, so I click Edit Media. Permalink is http://mydomain.com/?attachment_id=184 and thumbnail is still broken so I click on "View Attachment Page" which takes me to a standard post page with broken image. I go back to Edit Media screen and check out the File URL which is http://mydomain.com/wp-content/uploads/test.jpg so I try to open that URL and get standard post page that says Page Not Found If I open Windows Explorer and navigate to D:\wordpress\uploads\primary\, my image is there and the appropriate thumbnails that WordPress generates e.g. test.jpg (original), test-50x50.jpg, test-80x80.jpg, test-120x90.jpg, etc... If I open Windows Explorer and navigate to C:\inetpub\wwwroot\wp- content\uploads\ the folder is empty       **Test # 2 - Sub-directory site "foo"** Dashboard > Media > Add New > Select File > choose file test.jpg > progress bar says "100%" then "Crunching" > I immediately notice the thumbnail for the image is broken, so I click Edit Media. Permalink is http://mydomain.com/foo/?attachment_id=18 and thumbnail is still broken so I click on "View Attachment Page" which takes me to a standard post page with broken image. I go back to Edit Media screen and check out the File URL which is http://mydomain.com/foo/wp-content/uploads/sites/2/test.jpg so I try to open that URL and get IIS error page that reads: **Error Summary** HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. **Detailed Error Information** **Module:** IIS Web Core **Notification:** MapRequestHandler **Hander:** StaticFile **Error Code:** 0x80070002 **Requested URL:** http://mydomain.com:80/wp-content/uploads/sites/2/test.jpg **Physical Path:** C:\inetpub\wwwroot\wp-content\uploads\sites\2\test.jpg       If I open Windows Explorer and navigate to D:\wordpress\uploads\foo\, I see that wordpress created a folder that I did not create called "sites", when I click on "sites" I find another folder wordpress created called "2", I click on the folder "2" and I find that my image is there and the appropriate thumbnails that WordPress generates e.g. test.jpg (original), test-50x50.jpg, test-80x80.jpg, test-120x90.jpg, etc... If I open Windows Explorer and navigate to C:\inetpub\wwwroot\wp- content\uploads\ the folder is empty       I'm guessing it might have something to do with my rewrite rules in web.config so I'll post that here: ` <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <httpProtocol> <customHeaders> <clear /> <add name="X-UA-Compatible" value="IE=edge" /> </customHeaders> </httpProtocol> <staticContent> <remove fileExtension=".svg" /> <mimeMap fileExtension=".svg" mimeType="image/svg+xml" /> </staticContent> <handlers> <remove name="PHP54_via_FastCGI" /> <remove name="PHP55_via_FastCGI" /> <remove name="PHP53_via_FastCGI" /> <add name="PHP5_5_via_FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.5\php-cgi.exe" resourceType="Either" /> </handlers> <rewrite> <rules> <rule name="WordPress Rule 1" stopProcessing="true"> <match url="^index\.php$" ignoreCase="false" /> <action type="None" /> </rule> <rule name="WordPress Rule 2" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" /> <action type="Rewrite" url="wp-includes/ms- files.php?file={R:2}" appendQueryString="false" /> </rule> <rule name="WordPress Rule 3" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" /> <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" /> </rule> <rule name="WordPress Rule 4" stopProcessing="true"> <match url="^" ignoreCase="false" /> <conditions logicalGrouping="MatchAny"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" /> </conditions> <action type="None" /> </rule> <rule name="WordPress Rule 5" stopProcessing="true"> <match url="^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" /> <action type="Rewrite" url="{R:1}" /> </rule> <rule name="WordPress Rule 6" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> <action type="Rewrite" url="{R:2}" /> </rule> <rule name="WordPress Rule 7" stopProcessing="true"> <match url="." ignoreCase="false" /> <action type="Rewrite" url="index.php" /> </rule> </rules> </rewrite> <defaultDocument> <files> <clear /> <add value="index.php" /> <add value="index.html" /> <add value="index.htm" /> </files> </defaultDocument> </system.webServer> </configuration> `       Here are my versions: Windows 2008 R2 datacenter 64bit IIS 7.5 IIS Rewrite Module 2 PHP Manager 1.2 for IIS 7 MySQL Server 5.5 MySQL Connector Net 6.5.4 WordPress 3.8.1


How to obfuscate theme directory URLs

I'm rewriting this question because I realized it was totally unclear what I want to do. I'm looking for a way to "obscure" the theme directory so that absolute URLs that reference things like images and stylesheets in that theme directory don't have the "wp-content/themes/my_theme/" structure, but are rather more direct, like a normal website, eg: "/images/my_image.gif" and "/css/stylesheet.css". It's easy to hard-code the path to your theme's folder using the recommended get_template_directory_uri() to programmatically bring up the theme folder, but the theme folder structure is completely exposed this way. I'm hoping that the answer can leverage `wp_rewrite` in some way, because the only other solution I can think of involves editing `.htaccess` and that means hard-coding the theme directory into your htaccess file. I suppose this could be automated via a plugin or your theme activation function that edits the htaccess file, but I'm hoping that someone out there knows of a more "built- in" way to do it.


What does setup_postdata ($post ) do?

The codex defines it as 'Set up global post data. Helps to format custom query results for using Template tags.' I don't really understand this. Here is a code example :               global $post;     $args = array( 'numberposts' => -1);     $posts = get_posts($args);     foreach( $posts as $post) : setup_postdata($post);     echo $post->ID;     endforeach;       Please can you explain?


Handling URLs in WordPress application

We have a web application that we run inside of WordPress in order take advantage of WordPress's authentication. To make this work, we created a template type for our application that simply includes our application's start page. While a little bit of hack, this works great, except for once aspect - all the relative URLs now use the WordPress's page as its base, instead of the actual path to the resource. For example, if my application's page is at `http://mysite.com/myapp`, a relative link to a stylesheet would result in `http://mysite.com/myapp/css/stylesheet.css`, as expected. Unfortunately, this is not the actual location of the stylesheet. The actual location of the stylesheet is something like this: `http://mysite.com/directory1/directory2/directory3/css/stylesheet.css`. How should I go about linking to this resource in my web application if the base URL won't accurately reflect the location of the resource? Note: I am not able to use absolute links as we develop locally, which obviously does not have the same directory structure as the WordPress site.


Custom post type archive - error in nav-menu-template.php

I created a custom post type called 'vehicle' using the CCTM plugin and copy/pasted archive.php to archive-vehicle.php but this has resulted in an error in my header:               Warning: in_array() expects parameter 2 to be array, null given in /home/.../public_html/wp-includes/nav-menu-template.php on line 439      I get the same error repeated for every main menu item (there are no submenus). If I remove archive-vehicle.php and view the same posts using archive.php no errors appear. Why would this be? **Update** Line 439 of nav-menu-template.php is               in_array( $parent_item->object_id, $queried_object->ancestors )       `print_r($queried_object)` right before line 439 generates the following - there's no 'ancestors' key:               stdClass Object ( [labels] => stdClass Object ( [name] => Vehicles [singular_name] => Vehicle [add_new] => Add New [add_new_item] => Add New Vehicle [edit_item] => Edit Vehicle [new_item] => New Vehicle [view_item] => View Vehicle [search_items] => Search Vehicles [not_found] => No Vehicles Found [not_found_in_trash] => No Vehicles found in Trash [parent_item_colon] => Operator [all_items] => Vehicles [menu_name] => Vehicles [name_admin_bar] => Vehicle ) [description] => Each vehicle is linked to an Operator [publicly_queryable] => 1 [exclude_from_search] => [capability_type] => post [map_meta_cap] => 1 [_builtin] => [_edit_link] => post.php?post=%d [hierarchical] => 1 [public] => 1 [rewrite] => Array ( [slug] => vehicle [with_front] => 1 [pages] => 1 [feeds] => 1 [ep_mask] => 1 ) [has_archive] => 1 [query_var] => [register_meta_box_cb] => [taxonomies] => Array ( [0] => category [1] => features [2] => colours [3] => drivers ) [show_ui] => 1 [menu_position] => [menu_icon] => [can_export] => 1 [show_in_nav_menus] => 1 [show_in_menu] => 1 [show_in_admin_bar] => 1 [delete_with_user] => [cctm_hierarchical_custom] => 1 [cctm_hierarchical_includes_drafts] => [cctm_hierarchical_post_types] => Array ( [0] => operator ) [cctm_custom_columns_enabled] => 0 [post_type] => vehicle [use_default_menu_icon] => 1 [label] => Vehicles [cctm_show_in_menu] => 1 [cctm_show_in_menu_custom] => [rewrite_with_front] => 1 [permalink_action] => /%postname%/ [rewrite_slug] => [include_in_search] => 1 [include_in_rss] => 1 [cctm_enable_right_now] => 1 [custom_order] => ASC [is_active] => 1 [custom_fields] => Array ( [0] => passenger_capacity [1] => luggage_capacity [2] => hourly_rate [3] => included_milleage [4] => additional_mileage_price [5] => additional_image ) [map_field_metabox] => Array ( [passenger_capacity] => cctm_vehicledetails [luggage_capacity] => cctm_vehicledetails [hourly_rate] => cctm_vehicledetails [included_milleage] => cctm_vehicledetails [additional_mileage_price] => cctm_vehicledetails [additional_image] => cctm_default ) [original_post_type_name] => vehicle [name] => vehicle [cap] => stdClass Object ( [edit_post] => edit_post [read_post] => read_post [delete_post] => delete_post [edit_posts] => edit_posts [edit_others_posts] => edit_others_posts [publish_posts] => publish_posts [read_private_posts] => read_private_posts [read] => read [delete_posts] => delete_posts [delete_private_posts] => delete_private_posts [delete_published_posts] => delete_published_posts [delete_others_posts] => delete_others_posts [edit_private_posts] => edit_private_posts [edit_published_posts] => edit_published_posts [create_posts] => edit_posts ) ) stdClass Object ( [labels] => stdClass Object ( [name] => Vehicles [singular_name] => Vehicle [add_new] => Add New [add_new_item] => Add New Vehicle [edit_item] => Edit Vehicle [new_item] => New Vehicle [view_item] => View Vehicle [search_items] => Search Vehicles [not_found] => No Vehicles Found [not_found_in_trash] => No Vehicles found in Trash [parent_item_colon] => Operator [all_items] => Vehicles [menu_name] => Vehicles [name_admin_bar] => Vehicle ) [description] => Each vehicle is linked to an Operator [publicly_queryable] => 1 [exclude_from_search] => [capability_type] => post [map_meta_cap] => 1 [_builtin] => [_edit_link] => post.php?post=%d [hierarchical] => 1 [public] => 1 [rewrite] => Array ( [slug] => vehicle [with_front] => 1 [pages] => 1 [feeds] => 1 [ep_mask] => 1 ) [has_archive] => 1 [query_var] => [register_meta_box_cb] => [taxonomies] => Array ( [0] => category [1] => features [2] => colours [3] => drivers ) [show_ui] => 1 [menu_position] => [menu_icon] => [can_export] => 1 [show_in_nav_menus] => 1 [show_in_menu] => 1 [show_in_admin_bar] => 1 [delete_with_user] => [cctm_hierarchical_custom] => 1 [cctm_hierarchical_includes_drafts] => [cctm_hierarchical_post_types] => Array ( [0] => operator ) [cctm_custom_columns_enabled] => 0 [post_type] => vehicle [use_default_menu_icon] => 1 [label] => Vehicles [cctm_show_in_menu] => 1 [cctm_show_in_menu_custom] => [rewrite_with_front] => 1 [permalink_action] => /%postname%/ [rewrite_slug] => [include_in_search] => 1 [include_in_rss] => 1 [cctm_enable_right_now] => 1 [custom_order] => ASC [is_active] => 1 [custom_fields] => Array ( [0] => passenger_capacity [1] => luggage_capacity [2] => hourly_rate [3] => included_milleage [4] => additional_mileage_price [5] => additional_image ) [map_field_metabox] => Array ( [passenger_capacity] => cctm_vehicledetails [luggage_capacity] => cctm_vehicledetails [hourly_rate] => cctm_vehicledetails [included_milleage] => cctm_vehicledetails [additional_mileage_price] => cctm_vehicledetails [additional_image] => cctm_default ) [original_post_type_name] => vehicle [name] => vehicle [cap] => stdClass Object ( [edit_post] => edit_post [read_post] => read_post [delete_post] => delete_post [edit_posts] => edit_posts [edit_others_posts] => edit_others_posts [publish_posts] => publish_posts [read_private_posts] => read_private_posts [read] => read [delete_posts] => delete_posts [delete_private_posts] => delete_private_posts [delete_published_posts] => delete_published_posts [delete_others_posts] => delete_others_posts [edit_private_posts] => edit_private_posts [edit_published_posts] => edit_published_posts [create_posts] => edit_posts ) )      **Update 2** archive-vehicle.php:               <?php     /**      * The template for displaying Archive pages.      *      * Used to display archive-type pages if nothing more specific matches a query.      * For example, puts together date-based pages if no date.php file exists.      *      * Learn more: http://codex.wordpress.org/Template_Hierarchy      *      * @package WordPress      * @subpackage Twenty_Ten      * @since Twenty Ten 1.0      */          get_header(); ?>

          <?php         /* Queue the first post, that way we know          * what date we're dealing with (if that is the case).          *          * We reset this later so we can run the loop          * properly with a call to rewind_posts().          */         if ( have_posts() )             the_post();     ?>
     <?php if ( is_day() ) : ?>                     <?php printf( __( 'Daily Archives: %s', 'twentyten' ), get_the_date() ); ?>     <?php elseif ( is_month() ) : ?>                     <?php printf( __( 'Monthly Archives: %s', 'twentyten' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyten' ) ) ); ?>     <?php elseif ( is_year() ) : ?>                     <?php printf( __( 'Yearly Archives: %s', 'twentyten' ), get_the_date( _x( 'Y', 'yearly archives date format', 'twentyten' ) ) ); ?>     <?php else : ?>                     <?php _e( 'Blog Archives', 'twentyten' ); ?>     <?php endif; ?>
          <?php         /* Since we called the_post() above, we need to          * rewind the loop back to the beginning that way          * we can run the loop properly, in full.          */         rewind_posts();              /* Run the loop for the archives page to output the posts.          * If you want to overload this in a child theme then include a file          * called loop-archive.php and that will be used instead.          */          get_template_part( 'loop', 'archive' );     ?>

                               <?php get_sidebar(); ?>

               <?php get_footer(); ?>      **Update 3** wp-content\plugins\custom-content-type- manager\controllers\create_post_type.php:               <?php     /*------------------------------------------------------------------------------     Create a new post type.     ------------------------------------------------------------------------------*/     if ( ! defined('CCTM_PATH')) exit('No direct script access allowed');     if (!current_user_can('administrator')) exit('Admins only.');     require_once(CCTM_PATH.'/includes/CCTM_PostTypeDef.php');          $data=array();     $data['page_title'] = __('Create Custom Content Type', CCTM_TXTDOMAIN);     $data['help'] = 'http://code.google.com/p/wordpress-custom-content-type-manager/wiki/CreatePostType';     $data['msg'] = '';     $data['menu'] = sprintf('%s', __('Cancel'), __('Cancel'));     $data['edit_warning'] = ''; // only used when you edit a post_type, not delete.          // Variables for our template          $fields   = '';          $data['action_name']  = 'custom_content_type_mgr_create_new_content_type';     $data['nonce_name']  = 'custom_content_type_mgr_create_new_content_type_nonce';     $data['submit']   = __('Create New Content Type', CCTM_TXTDOMAIN);     $data['action'] = 'create';          $data['post_type'] = ''; // as default     $data['def'] = self::$default_post_type_def;     //      $def = self::$post_type_form_definition;          // Save data if it was properly submitted     if ( !empty($_POST) && check_admin_referer($data['action_name'], $data['nonce_name']) ) {         $sanitized_vals = CCTM_PostTypeDef::sanitize_post_type_def($_POST);         $error_msg      = CCTM_PostTypeDef::post_type_name_has_errors($sanitized_vals, true);              if ( empty($error_msg) ) {             // Clean slate.  This nukes any instance of 'is_foreign' (and potentially other issues)             // that may arise if the post-type name was used by another plugin and the CCTM tracked             // custom fields for that plugin, and then later the other plugin was deactivated and              // the CCTM wants to use the same post-type name.             unset(CCTM::$data['post_type_defs'][ $sanitized_vals['post_type'] ]);             CCTM_PostTypeDef::save_post_type_settings($sanitized_vals);                  $data['msg'] = CCTM::format_msg( sprintf(__('The content type %s has been created', CCTM_TXTDOMAIN), ''.$sanitized_vals['post_type'].''));             self::set_flash($data['msg']);             include CCTM_PATH . '/controllers/list_post_types.php';             return;         }         else {             // clean up... menu labels in particular can get gunked up. :(             $data['def']  = $sanitized_vals;             $data['def']['labels']['singular_name'] = '';             $data['def']['label'] = '';             $data['msg'] = CCTM::format_error_msg($error_msg);         }     }     $data['icons'] = CCTM_PostTypeDef::get_post_type_icons();     $data['columns'] = CCTM_PostTypeDef::get_columns($post_type);     $data['orderby_options'] = CCTM_PostTypeDef::get_orderby_options($post_type);     $data['content'] = CCTM::load_view('post_type.php', $data);     print CCTM::load_view('templates/default.php', $data);     /*EOF*/      wp-content\plugins\custom-content-type-manager\includes\CCTM.php register_custom_post_types function:               public static function register_custom_post_types() {     //return;         $post_type_defs = self::get_post_type_defs();              foreach ($post_type_defs as $post_type => $def) {             $def = self::_prepare_post_type_def($def);                  if ( isset($def['is_active'])                 && !empty($def['is_active'])                 && !in_array($post_type, self::$built_in_post_types)                 && isset($def['post_type'])                 ) {                 register_post_type( $post_type, $def );             }         }         // Added per issue 50         // http://code.google.com/p/wordpress-custom-content-type-manager/issues/detail?id=50         if (self::get_setting('flush_permalink_rules')){             global $wp_rewrite;             $wp_rewrite->flush_rules();              }     }


Use oEmbed in List Items

I'm aware that WordPress has oEmbed functionality. But the content to be embedded has to be on it's own line like so:               Lorem Ipsum          http://www.youtube.com/link/to/content          More Lorem Ipsum      Unfortunately, my markup looks like this so oEmbed doesn't work and I have to use a plugin.

http://www.youtube.com/link/to/content

http://www.youtube.com/link/to/content

      Is there anyway I can get oEmbed to work without this plugin? A line or two in functions.php would be better than this plugin.


How to show blog post details on a different page?

I have currently made a template to list my blog posts               <?php      /*template name: Figures */     get_header(); ?>          <?php nectar_page_header($post->ID); ?>

                     <?php                          $args = array(                             'posts_per_page'   => 5,                             'orderby'          => 'rand',                             'post_type'        => 'post',                             'post_status'      => 'publish'                         );                               $myposts = get_posts( $args );                              echo '
';                         foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
                                 <?php echo get_the_post_thumbnail($post->ID, 'medium'); ?>                                 <a href="<?php the_permalink(); ?>"><?php echo $post->post_title; ?>
                         <?php endforeach;                          echo '
';                      ?>

                     <?php get_sidebar(); ?>

          <?php get_footer(); ?>      What i am unfamiliar of is, can i make a different page to show the results? Because if i click the posts permalink it takes me to the default blog details view and i need to change that


Convert all dates in field to Unix time, except those already in Unix time

I have a meta field that is mixed with MM/dd/yy hh:mm dates and Unix timestamp dates. How do I convert all of the MM/dd/yy hh:mm dates in the db to Unix? I have only limited PHP and SQL knowledge so be gentle. Thanks!


meta_query with array as value with multiple arrays

Already got some clues on how to do this, see here: meta_query with array as value but i am confused over multiple meta_queries like this:               for ($i=0; $i< count($amenities); $i++)         {             $count = count($arrays);             $arrays[$count] = array(                         'key' => 'amenities',                         'value' => $amenities[$i],                         'compare' => 'LIKE'                         );         }          for ($j=0; $j< count($amenities2); $j++)         {             $count2 = count($arrays2);             $arrays2[$count2] = array(                         'key' => 'amenities',                         'value' => $amenities[$j],                         'compare' => 'LIKE'                         );         }      then how to include $arrays2 in below query with 'relation' => 'AND'?               $the_query = new WP_Query(array(             'post_type' => 'listing',             'post_status' => 'publish',              'category_name' => 'private_rental',             'meta_query' => $arrays         ));


List posts by their custom taxonomy term, with a condition

I have two custom taxonomies called "custom-category" and "file_type". I am using the below code to list all the terms of "file_type" along with their associated posts. Like so: File_Type Term 1   * post   * post   * post File_Type Term 2   * post   * post   * post and so on... My problem is that I need to add another condition to this. I want to only show the posts if they **also** have a specific term in "custom-category" taxonomy. So, for each file_type term, I want it to only show posts that have that term AND have the term "learning-units" in the custom-category taxonomy (term ID is 9). I'm so confused. Here is my working code for listing posts by file_type term. How do I add that extra condition?               <?php              $categories = get_terms('file_type');              foreach ( $categories as $category ) :              ?>
<?php echo $category->name; ?>
              <?php                  $posts = get_posts(array(               'post_type' => 'product',               'taxonomy' => $category->taxonomy,               'term'  => $category->slug               ));          // Here's the second, nested foreach loop that cycles through the posts associated with this category                  foreach($posts as $post) :               setup_postdata($post);              ?>

<?php the_title(); ?>
                <?php the_post_thumbnail('product'); ?>                <a href="<?php the_permalink(); ?>" class="button">Learn More
                       <?php endforeach; ?>                <?php endforeach; ?>


Use Tag input metabox style for Categories

I am using Categories to create news timelines, For example http://newslines.org/misha-collins/ (check the cloud at the bottom of the page for more examples) The problem is in the Add Post screen. The Categories input metabox uses checkboxes. As the list of categories grows, scrolling through this list is becoming very timeconsuming. I could convert the Categories to Tags (which is very easy) so that I could use the Tag input metabox, which has an ajax autocomplete, but then I would have to change the theme code to throughout the site so that it would display tags instead of categories. So I was wondering if I could just change the Category Metabox to have the same Ajax autocomplete style as the Tags Metabox. All advice appreciated!