How to validate inputs with filter in register_setting callback

I now have this function that works well :               function wpPartValidate_settings( $input ) {        if ( check_admin_referer( 'wpPart_nonce_field', 'wpPart_nonce_verify_adm' ) ) {              // Create our array for storing the validated options         $output = array();              foreach( $input as $key => $value ) {                // Check to see if the current option has a value. If so, process it.           if( isset( $input[$key] ) ) {                  // Strip all HTML and PHP tags and properly handle quoted strings             $output[$key] = strip_tags( stripslashes( $input[ $key ] ) );                } // end if         } // end foreach       } // end if       // Return the array processing any additional functions filtered by this action       return apply_filters( 'wpPartValidate_settings', $output, $input );     }      I wonder how to implement filters into that function. The goal is to inform the administrator that one input has not been correctly filled (with a correct email, url, numbers, date...)


matisse theme show excerpts not whole content

I want to only show the excerpts, not the entire content, This question has been asked and answered in respect of the twenty eleven theme. Matisse theme is different. where can i find the files to alter content to excerpts


Tips for managing code when developing a parent theme framework

I have started work on an open source theme framework that pulls in lots of great code & resources from elsewhere. For example it uses:   * jQuery   * Option Framework Theme   * LESS etc etc. Most of these external projects are hosted on Github or SVN. Rather than continually download and integrate the latest versions of these other libraries into my framework I am looking for a way to automate this process. I would be prepared to change the way I work considerably to accomodate an automated work flow that ensures I am always up to date and not always downloading or duplicating files. Any suggestions are greatly appreciated.


Wordpress 3.3 custom post type with /%postname%/ permastruct?

There is earlier post with similar title, but it does not look in to the WordPress 3.3, and that is important as 3.3 advertises interestingly: "Use the postname permalink structure without a performance penalty" Problem with Wordpress 3.2 and earlier was that first it looked page names, and then 404. It didn't check the arbitrary post types first. 3.3 on the other hand _must_ look post types, then pages, and finally 404 (as it advertises this feature). This implies that custom post types without slug should be _simple_ , if they didn't hard code `post_type=post` somewhere. I can't find a 3.3 specific solution yet though. **Question** : How can I define permalink struct "/%postname%/" for any given custom post type "xyz"? Thanks.


Development of arabic version of wordpress site without using plugin or google translate

I got a site which is now in English and the site is just static without any dynamic functionality. So, the client wants to frequently edit the site content by its own and he also told me to change the entire site to the Arabic language so I have decided to convert it to wordpress cms to give him editing flexibility. I have stuck at what should I do to convert the site content into Arabic as far as I know we can implement google translate api or other translation plugins to switch the site language on the go but we all know using such plugins isn't a good choice as sometimes they break words and characters of the language and not work proper as we expect so here I need some appropriate approach to do this task efficiently and effectively. Many thanks.


Pass number of images as parameter to NextGen Gallery

Hi is there a way to pass through a parameter indicating the number of images (thumbnails) displayed on a page? Thanks


Editing Loop So It Targets Specific Tags?

Confused on how to achieve this, but what I'm trying to do is load posts with the tag "reviews" in the loop on the homepage. Index.php:               <?php /* Start the Loop */ ?>     <?php while ( have_posts() ) : the_post(); ?>              <?php             get_template_part( 'content-reviews', get_post_format() );         ?>               <?php endwhile; ?>               <?php else : ?>          <?php get_template_part( 'no-results', 'index' ); ?>          <?php endif; ?>


Check if on last page of paginated post using wp_link_pages

A client of mine reviews products on his site, and wants to display the review criteria and score on the last page of each posts. Typically, there are 3-5 pages per post, and I'm looking for a way to check if we're on the last page. ‹!--nextpage--› is used in the post to divide it into pages, and wp_link_pages on the front-end to display pagination links. I've been able to find ways of checking if we're on page one, or not on page one, or on a specific page. But nothing for checking if we're on the very last page.


How to add page content into another page

I'll try to explain myself and what I'm trying to gain. I run a DJ business and am trying to get into the Wedding market. One way is to make sure the slug of each page has "wedding-(venue name).html for example. I've got 20 of these pages and they work really well. Problem is that the title H2 header on the page is customised to the venue name (Thinking of getting married at "venue name"?). the rest of the page is the same as the rest. Is there a way of me creating a unique page for the H2 title and then using php to call another single page or post to add underneath? This way I'll only ever need to change one post of page to change all of the pages. Hope I make sense... Cheers, Lee


How to Debug: My Plugin Interferes With My Theme

I'm learning how to write a plugin. My plugin is a google map that places markers based on the selected criteria. It works fine. The problem is that it interferes with one part of the theme I'm using. The theme is called Superb. The theme has a uBillboard, basically, it's a slider. For some reason, my plugin prevents the uBillboard from appearing-- the first maybe 30 pixels of the image are visible. I'm not sure where to begin in order to debug this. What should I be looking for? What are common reasons for plugins interfering with themes? I can post code, but I don't think that it makes sense to post the whole theme and my plugin. Thank you.


Passing form inputs into multi-taxonomy query

I'm in the process of building out a search page to perform a query on a custom post type and its associated meta and taxonomy. Eventually, I would it to query multiple taxonomies as well as compare values to those in the meta (ie - find posts with foo between X and Y). I have a pretty good understanding of the query function, thanks to the posts by Otto and Scribu. The problem is I'm struggling to figure out how to pass the variables in via a form. My first attempt was to try the method recommended in this post, but I'm not returning any results (address bar shows: `http://sitename.com/?brand=22`. Here's my first attempt ("brand" is one of my taxonomy names):               <form action="<?php echo home_url('/'); ?>" method="get">
<?php wp_dropdown_categories('taxonomy=brand&name=brand'); ?>

<input type="submit" value="Search!" />
     </form>      Will a simple HTML form such as this suffice? Or should I be building a function in my functions.php file? My second attempt was to incorporate a function:               <?php     function get_terms_dropdown($taxonomies, $args){         $myterms = get_terms($taxonomies, $args);         $output ='<select multiple="yes" size="3" name="'.$taxonomies.'">';         foreach($myterms as $term){             $root_url = get_bloginfo('url');             $term_taxonomy=$term->taxonomy;             $term_slug=$term->slug;             $term_name =$term->name;             #$link = $root_url.'/'.$term_taxonomy.'/'.$term_slug;             #$link = $term_taxonomy;             $output .="<option value='".$term_name."'>".$term_name."</option>";         }         $output .="</select>";     return $output;     }     $args = array('orderby'=>'count','hide_empty'=>true);     ?>               <form role="search" method="get" id="searchform" action="<?php bloginfo('home'); ?>">     <?php echo get_terms_dropdown(array('brand'), $args); ?>     <input type="submit" id="searchsubmit" value="Search" />     </form>      But again, I'm not able to submit the form/generate results. Am I on the right track here? Any suggestions are appreciated.


Conditional Tags and Echo HTML / divs or CSS and Display: none?

If I wanted to show a slider on the home page only, is it better or does it make a difference if I:   * use a PHP if/then statement and echo a division and markup, or    * use CSS along with a body class and display none the division? or   * a combination of both What's the best practice?


Comments on Author page

**Update:** Ok,the DEBUG log says:               PHP Notice:  Undefined offset: 0 in /home/content/00/8437600/html/test/wp-includes/query.php on line 3105          PHP Notice:  Trying to get property of non-object in /home/content/00/8437600/html/test/wp-includes/query.php on line 3939          PHP Notice:  Trying to get property of non-object in /home/content/00/8437600/html/test/wp-includes/query.php on line 3941          PHP Notice:  Trying to get property of non-object in /home/content/00/8437600/html/test/wp-includes/query.php on line 3943          PHP Notice:  Trying to get property of non-object in /home/content/00/8437600/html/test/wp-includes/query.php on line 3944          PHP Notice:  Trying to get property of non-object in /home/content/00/8437600/html/test/wp-includes/query.php on line 3952          PHP Notice:  Trying to get property of non-object in /home/content/00/8437600/html/test/wp-includes/query.php on line 3967      **NOTE:** At the top of my `author.php` I use the following code in order to get user meta for the page:               <? $curauth = (get_query_var('author_name')) ? get_user_by('slug',             get_query_var('author_name')) :             get_userdata(get_query_var('author'));     ?>      **End of update** **Original Post** First - I am teaching myself how to write php and am also new to this forum. I am trying to follow the instructions from the top answer for this question Author page: Comments and Ratings? to add comments to author.php - without any luck. The following is the steps I have taken:   1. Created a custom post type to hold the comments   2. Created a new post in said post type   3. Created custom field in user meta called -> author_post_id   4. Added newly created post id to user meta for particular user Note: this works because I can add echo statement in the code provided and the above link and it echos the correct post id so I know I did something write (lol)   5. Copy/pasted the code given on the above link (answer #3) into my author.php Nothing is showing up. What am I missing? I even added `wp_reset_query();` after the loop that displays post by the author and it made no difference. Here is my test author page http://test.thesingleparentperspective.com/author/ckmatthews/


WordPress TwentyTen Search

Could someone please explain why when I submit an empty search form I get sent to a page with no navigation menu? The navigation menu is there when a search term that has no matches is submitted and the error message is the exact same: "Sorry, but nothing matched your search criteria. Please try again with some different keywords." looking at the seach.php file there's only one else clause that handles the no result found code so why isn't functioning the same? I haven't modified the search from the original theme                   <?php     get_header(); ?>

     <?php if ( have_posts() ) : ?>
<?php printf( __( 'Search Results for: %s', 'twentyten' ), '' . get_search_query() . '' ); ?>
     <?php     /* Run the loop for the search to output the results.     * If you want to overload this in a child theme then include a file     * called loop-search.php and that will be used instead.     */     get_template_part( 'loop', 'search' );     ?>     <?php else : ?>

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

<?php printf( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentyten' ); ?>

     <?php endif; ?>

     <?php get_sidebar(); ?>     <?php get_footer(); ?>


Custom post type title of each author in his own post

I have a seriously problem :( maybe someone can help me The users registered in my wordpress page have one post only, and i created custom_post_type named "ofertas". The users can create one oferta only. With this code show the oferta title on index.php, the problem is show the oferta title in ALL POSTS. I want only show his own oferta title (if they have).               <?php      // First loop     while ( have_posts() ): the_post();      author_id = get_query_var('author');         $ofertas = array();          // Second Loop     $i = 0;     $args = array(         'author' => $author_id,         'post_type' => 'ofertas'     );     $the_query = new WP_Query( $args );     if ($the_query->have_posts()) :          while ($the_query->have_posts()) : $the_query->the_post(); // check if it has offers, if it has, loop over the offers             $ofertas[$i]['title'] = get_the_title(); // or anything you need             $i++;         endwhile; // close the loop     else: // if it has no post         continue; // we don't display the post     endif;          wp_reset_postdata();      ?>     <div class="post">     <?php     the_title(); // or anything you need          foreach ($ofertas as $oferta):         echo $oferta['title']; // we display the title of the offer     endforeach;     ?>     </div>     <?php  endwhile; ?>      I created the custom_post_type with this code               add_action('init', 'crear_tipo_ofertas', 0);          function crear_tipo_ofertas() {     $labels = array(       'name'               => _x( 'Ofertas', 'Post Type General Name', 'text_domain' ),       'singular_name'      => _x( 'Oferta', 'Post Type Singular Name', 'text_domain' ),       'menu_name'          => __( 'Ofertas', 'text_domain' ),       'parent_item_colon'  => __( 'Oferta Padre', 'text_domain' ),       'all_items'          => __( 'Ofertas', 'text_domain' ),       'view_item'          => __( 'Ver Oferta', 'text_domain' ),       'add_new_item'       => __( 'Añadir Oferta Nueva', 'text_domain' ),       'add_new'            => __( 'Añadir', 'text_domain' ),       'edit_item'          => __( 'Editar Oferta', 'text_domain' ),       'update_item'        => __( 'Actualizar', 'text_domain' ),       'search_items'       => __( 'Buscar Ofertas', 'text_domain' ),       'not_found'          => __( 'Ofertas no encontradas', 'text_domain' ),       'not_found_in_trash' => __( 'Ofertas no encontradas en Papelera', 'text_domain' ),       );          $rewrite = array(       'slug'                => 'oferta',       'with_front'          => true,       'pages'               => true,       'feeds'               => true,       );          $args = array(       'label'               => __( 'oferta', 'text_domain' ),       'description'         => __( 'Ofertas Spas y Balnearios', 'text_domain' ),       'labels'              => $labels,       'supports'            => array( 'title', 'editor', 'comments', 'thumbnail', 'custom-fields'),       'taxonomies'          => array( 'category', 'post_tag' ),       'hierarchical'        => false,       'public'              => true,       'show_ui'             => true,       'show_in_menu'        => true,       'show_in_nav_menus'   => true,       'show_in_admin_bar'   => true,       'menu_position'       => 5,       'menu_icon'           => site_url().'/wp-content/plugins/my_plugin/images/logo.png',       'can_export'          => true,       'has_archive'         => 'ofertas',       'exclude_from_search' => false,       'query_var'           => 'ofertas',       'rewrite'             => $rewrite,       'capability_type'     => 'post',       );          register_post_type('ofertas', $args);     }          add_action('init', 'crear_tipo_ofertas', 0);


Is there a Wordpress Event Manager that links with your user database?

I'm presently moving my site from a different CMS. Geeklog to Wordpress. They have an event plugin that I used which is very simple. This is it... http://www.portalparts.com/staticpages/index.php?page=glEventMgr&query=event I run comedy open mics and everyone on the website is a comedian. They all have a login. The ones out there for Wordpress are great, but they don't seem to tie in with your user database. On this plugin above for the other CMS they were able to login, click an event and register for it with one more click. I could set a limit on how many could sign up, they could unregister themselves, Email registrants etc... No forms to fill out, nothing but logging in and making a couple clicks. I've been searching through all the WP event plugins and none seem to do this. They all make you fill out fields to register. If anyone knows of a plugin that does what I'm looking for or can help in any way, please let me know! Thanks, B


Get post ID from the Create post/page admin interface?

I am adding a meta box in the create post/page interface and I want to get the ID of the post being edited/created so I can dynamically display the value of the input field. From the wordpress codex http://codex.wordpress.org/Function_Reference/add_meta_box:               /* Prints the box content */     function myplugin_inner_custom_box() {            // Use nonce for verification       wp_nonce_field( plugin_basename(__FILE__), 'myplugin_noncename' );            // The actual fields for data entry       echo '<label for="myplugin_new_field">' . __("Description for this field", 'myplugin_textdomain' ) . '</label> ';       echo '<input type="text" id= "myplugin_new_field" name="myplugin_new_field" value="whatever" size="25" />';     }      How do I pass the ID to `myplugin_inner_custom_box()`? So I can use the following within it:               // Get the value of the meta key that is associated to the page       $as_meta_value = get_post_meta( $post_id, 'as_link_to_image', true );      and replace the `whatever` value with the value of the meta key in the input field.


How to load default scripts included with WordPress correctly?

I want to know the correct way to load existing scripts in `wp- includes/js/jquery/` Example I want to load `jQuery UI Tabs` What I have done for now               function sample_exists_code() {        echo '<script type="text/javascript" src="'. CONSTANTS_JS .'/jquery.js"></script>'."\n";         echo '<script type="text/javascript" src="'. CONSTANTS_JS .'/jquery-ui.js"></script>'."\n";      }         add_action('admin_head', 'sample_exists_code');      and this code working fine to load the UI tabs. But when I try use this code and it's not working               function sample_exists_code() {         wp_enqueue_script('jquery');            wp_enqueue_script('jquery-ui-tabs');                 }         add_action('admin_head', 'sample_exists_code');      Let me know the correct way to call the existing scripts. * * * Update :               // load existings js and template css.     function sample_admin_js_head()     {         wp_enqueue_script('jquery-ui-tabs', null, array('jquery-ui-core','jquery'), null, false);         echo '<link rel="stylesheet" type="text/css" href="' . CONSTANTS_STYLES . '/style.css" />' . "\n";     }          // load up the menu page     function sample_add_page()     {         $optionpage = add_theme_page(__('Theme Options'), __('Theme Options'), 'edit_theme_options', 'sample', 'sample_do_template');         add_action( "admin_print_scripts-$optionpage", 'sample_admin_js_head' );     }          add_action('admin_menu', 'sample_add_page');


HTML editor accessing quicktag buttons

I'm stuck in searching a way to access the quicktag buttons on the html editor with jQuery. I tryed to access the buttons with `.each()` and `.children()` but both won't work.               jQuery( document ).ready( function( $ ) {            $( '#ed_toolbar input.ed_button' ).children().css( 'color', 'red' );            $( '#ed_toolbar input.ed_button' ).each( function() {         $( this ).css( 'color', 'red' );       });               });      I think the buttons are not inserted when the DOM is ready.


Ajax URLs without #!, how to prevent falling into single.php on load or reload?

I'm trying to make things properly with a single page ajax powered portfolio. I've read that there is no need of `#!` to make it crawlable by google. So I have clean URLs that updates with `.pushState` when I load a post. My problem is that if you hit F5 or load directly an URL, you fall into the single.php. You can try it yourself here: `http://www.youpiemonday.com/` How can I prevent falling into the article page? I thought about redirecting from the single.php to the home and trigger the opening of the post there. But seing the comments, it doesn't seems to be a great idea. Anyway I'm stuck right now... You can see my thought process on StackOverflow here. I'd love to here some feedback from Wordpress specialists... :) * * * **EDIT:** I may have found a simple/quick way to redirect to the homepage if the request is done when on single.php. I simply added this to function.php               add_action('wp', 'RedirecToPost');       function RedirecToPost(){          if($_SERVER['HTTP_X_REQUESTED_WITH']=='' && is_single()){ // if http request AND on single.php                  wp_redirect( home_url() ); // redirect to home                 // THEN check the post requested AND trigger a click on its thumbnail                  }       }      But I'm still at the same point. I need a way to check what was the requested post and trigger a click on its thumbnail. Now I'm really stuck by my scripting knowledge. How can I check the last page url (referer?) and find the href pointing to it in the current page?


Disable directory browsing of uploads folder

I'm using Wordpress as a CMS for a simple website. I want to prevent users from being able to browse the directories such as the wp-content/uploads folder or any directories of my theme. My host does not allow me to use "Options" or "DirectoryIndex" within a .htaccess file. I have tried putting a .htaccess file in the /uploads/ folder with "IndexIgnore *" in it. However none of my images from the /uploads/ folder will show up on my site with that option. I also tried password protecting the directory with a .htpasswd file but this gives any visitor of my site a popup asking them to enter the credentials. So my question is how do I prevent people from browsing the directories while enabling me to embed files from those directories in my wordpress posts/pages. For example, can I place .htaccess file in the /uploads/ directory and add RewriteRules so WordPress can still show the files on my website?


How do you avoid caching during development?

Is there a simple way do prevent all caching when testing the appearance of changes to the site? I use WP Super Cache. I can delete its cache using the option provided, delete the cache for my browser, and still some changes to css or widgets do not refresh. I try other work-arounds like switching browsers or computers, but there must be a more stream-lined workflow where I can ensure I'm viewing the changes I made and not some cached earlier format? What's the best solution for this?


Plugin to embed local video into Wordpress?

What's the best way to achieve this: I have local videos on my server, but if I use the WP add media button I just get a link to a video, rather than it embedded. Are there any good plugins which will let me embed local video? Everything seems to support video sharing from Google, YouTube, Vimeo etc.


Using wp_login_form passowrd as undefined

Hi I am using the wp_login_form function and when it displays the password field always displays the word undefined. If I remove that when logging in the form works fine. Anyone know why this placeholder value is there no matter what instance I use it in (page, post,theme) Thanks.


What would be a proper name for a custom post type created for static content?

I recently divided my posts into 3 types: Posts (blog entries) Pages (individual web pages) Static Content (content that goes to specific sections of a Page. For example, the Tagline). I'm not sure if the end user will understand what static content means. I thought about Page Content but I think Blog entries are page content too (the same as Web Content). Any suggestions?


Images not rendering

I have a baking blog that I run and recently I have changed the url. The problem I have now is when I add images to the posts or libary they are not showing/rendering. The uploading steps go through OK, but the image does not render. Can you assist, I just don't where I have gone wrong.


Search result conditonal tag

Is there a conditional tag (or a similar concept) that can tell me wether the search returned posts or not?


Get Parent Custom Taxonomy Term and Color Div background

I am currently displaying posts from a CPT. Each has a taxonomy term from a parent. I would like to create a function that would color the background of a div of particular parent terms. Here is my set up: Lets call this Cars: > Domestic   >  --Dodge --Ford --Chrysler > > Import   >  --Honda --Toyota --Kia > > European   >  --BMW --Benz The parent is Domestic, Import, European. My posts displays as follows: > Ford   >  Post Title   >  Post Content   > > > Toyota   >  Post Title   >  Post Content   > Etc. My goal is to color the DIV that the child term is held in. For example:
Ford
 (background green)     Post Title
      Post Content

Toyota
 (background red)     Post Title
      Post Content
      I am trying to construct the following:               if (parent_term == 'domestic'){     .car_type{     background-color:green;     }     }          if (parent_term == 'import'){     .car_type{     background-color: red;     }     }      So far I have checked out get_terms. Any help pointing me in the right direction would be amazing. Thank you, I hope this makes sense.


Add a meta box to ALL Pages

I'd like to add a meta box to all my pages (not posts) but it looks like I am only able to add it for a specific post based on the codex?               add_meta_box( $id, $title, $callback, $page, $context = 'advanced', $priority = 'default', $callback_args = null );


Wordpress and isotope filtering

Im trying to use Isotope(http://isotope.metafizzy.co/) to filter my Wordpress posts, http://i44.tinypic.com/fco55k.jpg this is how my site looks like, i would like to filter posts depending on a post category so i need to add a class name to each post and then filter it using isotope
show all

design

typography
      those are the names of my categories, and then i would like to add class name of a post depending on a category he is in.
               <?php               $args = array('orderby' => 'rand' );               $random = new WP_Query($args); ?>               <?php if(have_posts()) : ?><?php while($random->have_posts()) : $random->the_post(); ?>              <a href="<?php the_permalink() ?>"> <div id="img" class="<?php  $category = get_the_category();                      echo $category[0]->cat_name; ?>">                 <?php                      the_post_thumbnail();?>
<?php the_title(); ?>

      and javascript im using


How can I add extra attribute in the 'Page Attribute' section in wp-admin for pages?

I would like to add a select list in the `Page Attribute` box you see on the right side in the administration interface for pages. Does anyone know if that is possible? Or at least add a custom box below this box?


How do I update a specific object in an array, in user meta?

I have this array, below, to set custom user meta (`lh_userbadges`) in `user_meta` but I'm not exactly sure how to update just parts of the array later on...               $lh_user_badges = array(         'lh_userbadge_comments25' => '0',         'lh_userbadge_comments50' => '0',         'lh_userbadge_comments75' => '0',         'lh_userbadge_comments100' => '0',         'lh_userbadge_comments150' => '0',         'lh_userbadge_submited' => '0',         //etc.     );     update_user_meta($user_id, 'lh_userbadges', $lh_user_badges);      From what I gathered in other stack overflow questions (How to update serialized data in the user meta data is a good example BUT it just increments, which I don't want. I want to set a specific number just once.), I think it something along these lines but, I'm just not sure....               $meta_value = get_user_meta($user_id, 'lh_userbadges', false);     $meta_value['lh_userbadge_comments25']  //....?      So, for example, I just want to update the object `lh_userbadge_comments25` from `lh_userbadges` from 0 to (lets say) 25, how would I do that? I think I'm on the right track with that 2nd part of code but I do not know... Any ideas? **Also, I'm not sure if this is the best way to do it but I figured this would save database clutter if I did it in this format rather than each type being it's own meta item.**


Plugin generated unexpected output - No PHP errors

I'm creating a plugin that creates a custom post type I'm working on. I followed this tutorial. I have just changed it from movie_reviews to staff members. I don't get any syntax errors in PHP and it all looks alright, but when I activate the plugin in WordPress it says it generated 3 characters of unexpected output. I think the problem is the display_staff_member_meta_box function, but there doesn't appear to be any errors in it. Below is the code I'm using.               <?php     /*     Plugin Name: Staff Members     Plugin URI: http://intranet.yourgroupuk.com     Description: Declares a plugin that will create a custom post type displaying staff members     Version: 1.0     Author: Harry Glozier     Author URI: http://intranet.yourgroupuk.com     */          function create_staff_member() {         register_post_type( 'staff_members',             array(                 'labels' => array(                     'name' => 'Staff Members',                     'singular_name' => 'Staff Member',                     'add_new' => 'Add New',                     'add_new_item' => 'Add New Staff Member',                     'edit' => 'Edit',                     'edit_item' => 'Edit Staff Member',                     'new_item' => 'New Staff Member',                     'view' => 'View',                     'view_item' => 'View Staff Member',                     'search_items' => 'Search Staff Members',                     'not_found' => 'Staff Member not found',                     'not_found_in_trash' => 'No Staff Members found in Trash',                     'parent' => 'Parent Staff Member'                 ),                      'public' => true,                 'show_in_menu' => true,                 'menu_position' => 80,                 'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ),                 'menu_icon' => plugins_url( 'staff-icon-2.png', __FILE__ ),                 'exclude_from_search' => false,                 'has_archive' => true             )         );     }          function my_admin() {         add_meta_box( 'staff_member_meta_box',             'Staff Member Details',             'display_staff_member_meta_box',             'staff_members', 'normal', 'high'         );     }      ?>          <?php     function display_staff_member_meta_box( $staff_member ) { //Causes error         // Retrieve current Job Title and Company based on staff ID         $job_title = esc_html( get_post_meta( $staff_member->ID, 'job_title', true ) );         $company = esc_html( get_post_meta( $staff_member->ID, 'company', true ) );              $table = <<<TEXT

                 Job Title	                 <input type="text" size="80" name="staff_member_job_title" value="$job_title" />

                 Company	                                      <select style="width: 200px" name="staff_member_company">                         <option value="Your Group">Your Group</option>                         <option value="Your Power">Your Power</option>                         <option value="Your Electrical">Your Electrical</option>                         <option value="Newmills Engineering">Newmills Engineering</option>                     </select>

     TEXT;         echo $table;     } //End of function      ?>          <?php     function add_staff_member_fields( $staff_member_id, $staff_member ) {         // Check post type for staff members         if ( $staff_member->post_type == 'staff_members' ) {             // Store data in post meta table if present in post data             if ( isset( $_POST['staff_member_job_title'] ) && $_POST['staff_member_job_title'] != '' ) {                 update_post_meta( $staff_member_id, 'job_title', $_POST['staff_member_job_title'] );             }             if ( isset( $_POST['staff_member_company'] ) && $_POST['staff_member_company'] != '' ) {                 update_post_meta( $staff_member_id, 'company', $_POST['staff_member_company'] );             }         }     }           /* function include_template_function( $template_path ) {         if ( get_post_type() == 'staff_members' ) {             if ( is_single() ) {                 // checks if the file exists in the theme first,                 // otherwise serve the file from the plugin                 if ( $theme_file = locate_template( array ( 'single-staff_members.php' ) ) ) {                     $template_path = $theme_file;                 } else {                     $template_path = plugin_dir_path( __FILE__ ) . '/single-staff_members.php';                 }             }         }         return $template_path;     } */     ?>          <?php     add_action( 'init', 'create_staff_member' );     add_action( 'admin_init', 'my_admin' );     add_action( 'save_post', 'add_staff_member_fields', 10, 2);     //add_filter( 'template_include', 'include_template_function', 1 );


Custom post type with specific category structure

I have successfully created a custom post type (aka "Instruction") and two different categories (aka "Program" and "Exercise"). An "Instruction" needs to be filed under an "Exercise" and an Exercise needs to have a "Program" as a parent category. This is how I have registered the taxonomies:                   function create_taxonomy() {             $programLabels = array(                 'name' => _x( 'Programs', 'taxonomy general name' ),                 'singular_name' =>_x( 'Program', 'taxonomy singular name' ),                 'search_items' =>  __( 'Search Programs' ),                 'popular_items' => __( 'Popular Programs' ),                 'all_items' => __( 'All Programs' ),                 'edit_item' => __( 'Edit Program' ),                 'update_item' => __( 'Update Program' ),                 'add_new_item' => __( 'Add New Program' ),                 'new_item_name' => __( 'New Program' ),                 'separate_items_with_commas' => __( 'Separate programs with commas' ),                 'add_or_remove_items' => __( 'Add or remove programs' ),                 'choose_from_most_used' => __( 'Choose from the most used programs' )             );             register_taxonomy(                 'category_program', // The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces).                 'cus_instruction',      // post type name                 array(                     'hierarchical'      => false,                     'label'             => __('Program'),                     'labels'            => $programLabels,                     'query_var'         => true,                     'rewrite'           => array(                         'slug'          => 'program',    // This controls the base slug that will display before each term                         'with_front'    => false        // Don't display the category base before                     )                 )             );                  $exerciseLabels = array(                 'name' => _x( 'Exercises', 'taxonomy general name' ),                 'singular_name' =>_x( 'Exercise', 'taxonomy singular name' ),                 'search_items' =>  __( 'Search Exercises' ),                 'popular_items' => __( 'Popular Exercises' ),                 'all_items' => __( 'All Exercises' ),                 'parent_item' =>  __( 'Program' ),                 'parent_item_colon' => ( 'Program:' ),                 'edit_item' => __( 'Edit Exercise' ),                 'update_item' => __( 'Update Exercise' ),                 'add_new_item' => __( 'Add New Exercise' ),                 'new_item_name' => __( 'New Exercise' ),                 'separate_items_with_commas' => __( 'Separate exercises with commas' ),                 'add_or_remove_items' => __( 'Add or remove exercise' ),                 'choose_from_most_used' => __( 'Choose from the most used exercises' ),                 'menu_name' => __( 'Exercises' )             );             register_taxonomy(                 'category_exercise',   // The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces).                 'cus_instruction',          // post type name                 array(                     'hierarchical'      => true,                     'label'             => __('Exercise'),                     'labels'            => $exerciseLabels,                     'query_var'         => true,                     'rewrite'           => array(                         'slug'          => 'exercise',    // This controls the base slug that will display before each term                         'with_front'    => false          // Don't display the category base before                     )                 )             );         }         add_action( 'init', 'create_taxonomy', 0);      Conceptually setting the "cus_instruction" as the post type for the category "Program" is not correct but that was the only way I could make Wordpress display it in the admin sidebar. Setting the 'parent_item' in the "Exercise" category doesn't have the effect of binding the category "Program" as a parent though, it only changes the label of the parent category. Is my requirement possible in Wordpress? And if so, how do I set up the category structure?


Custom post type permalink uses archive page to display posts

I can't figure out why my custom post type page template uses the archive page to display posts. I'm pretty sure I have the right files. These are the important files, regarding this issue, in my root folder: **Root**               mytheme     - archive.php     - home.php     - single.php     - team.php     - single-team.php     - archive-team.php      **Usage**                1. team.php is a custom page template. All team members are shown here.      2. single-team.php displays a single team member.      **My Post Type**                function create_post_type_team() { register_post_type( 'team',        array(            'labels' => array(            'name' => __( 'Team' ),            'singular_name' => __( 'Team' )           ),        'public' => true,        'has_archive' => true,        'supports' => array( 'title', 'editor', 'thumbnail' ),        'taxonomies' => array('post_tag')          )       );     }          add_action( 'init', 'create_post_type_team' );      **My Problem** When I visit mysite/team (team.php), the page is using archive-team.php to display posts. It should use team.php which is assigned to the page as page template via the admin panel. The weird thing is that when I change the page url from /team to /team2, it does use team.php and not archive-team.php. **Notes** Before this problem occurred, mysite/team/member (single-team.php) was not working. I went to my permalink settings - did nothing - and went back. From this point mysite/team/member worked, but team.php started using archive- team.php. If I set has_arhive => false, it falls back to home.php. Any help would be much appreciated!


How to use conditional statement with custom field

I think it is a simple thing but I am not good on php so :( can you guys tell me how I can use an if condition with my custom filed. Below is my current code.
<?php echo post_custom('courtesy'); ?>
      I want **courtesy** to show if it has a value. Right now if there is no value then a blank div is shown. I don't want a blank div.


Google font doesn't show in theme option

I have implemented the following tutorial in my theme's option panel. http://wptheming.com/2012/06/loading-google-fonts-from-theme-options/ Every thing is working fine. But in the themeoption panel the default system fonts are showing in the drop down list.               /**      * Returns an array of system fonts      * Feel free to edit this, update the font fallbacks, etc.      */     function options_typography_get_os_fonts() {         // OS Font Defaults         $os_faces = array(             'Arial, sans-serif' => 'Arial',             '"Avant Garde", sans-serif' => 'Avant Garde',             'Cambria, Georgia, serif' => 'Cambria',             'Copse, sans-serif' => 'Copse',             'Garamond, "Hoefler Text", Times New Roman, Times, serif' => 'Garamond',             'Georgia, serif' => 'Georgia',             '"Helvetica Neue", Helvetica, sans-serif' => 'Helvetica Neue',             'Tahoma, Geneva, sans-serif' => 'Tahoma'         );         return $os_faces;     }          /**      * Returns a select list of Google fonts      * Feel free to edit this, update the fallbacks, etc.      */          function options_typography_get_google_fonts() {         // Google Font Defaults         $google_faces = array(             'Arvo, serif' => 'Arvo',             'Copse, sans-serif' => 'Copse',             'Droid Sans, sans-serif' => 'Droid Sans',             'Droid Serif, serif' => 'Droid Serif',             'Lobster, cursive' => 'Lobster',             'Nobile, sans-serif' => 'Nobile',             'Open Sans, sans-serif' => 'Open Sans',             'Oswald, sans-serif' => 'Oswald',             'Pacifico, cursive' => 'Pacifico',             'Rokkitt, serif' => 'Rokkit',             'PT Sans, sans-serif' => 'PT Sans',             'Quattrocento, serif' => 'Quattrocento',             'Raleway, cursive' => 'Raleway',             'Ubuntu, sans-serif' => 'Ubuntu',             'Yanone Kaffeesatz, sans-serif' => 'Yanone Kaffeesatz'         );         return $google_faces;     }          /**      * Checks font options to see if a Google font is selected.      * If so, options_typography_enqueue_google_font is called to enqueue the font.      * Ensures that each Google font is only enqueued once.      */              function options_typography_google_fonts() {             $all_google_fonts = array_keys( options_typography_get_google_fonts() );             // Define all the options that possibly have a unique Google font             $google_font = woodpecker_get_option('google_font', 'Rokkitt, serif');             $google_mixed = woodpecker_get_option('google_mixed', false);             $google_mixed_2 = woodpecker_get_option('google_mixed_2', 'Arvo, serif');             // Get the font face for each option and put it in an array             $selected_fonts = array(                 $google_font['face'],                 $google_mixed['face'],                 $google_mixed_2['face'] );             // Remove any duplicates in the list             $selected_fonts = array_unique($selected_fonts);             // Check each of the unique fonts against the defined Google fonts             // If it is a Google font, go ahead and call the function to enqueue it             foreach ( $selected_fonts as $font ) {                 if ( in_array( $font, $all_google_fonts ) ) {                     options_typography_enqueue_google_font($font);                 }             }         }          add_action( 'wp_enqueue_scripts', 'options_typography_google_fonts' );     /**      * Enqueues the Google $font that is passed      */     function options_typography_enqueue_google_font($font) {         $font = explode(',', $font);         $font = $font[0];         // Certain Google fonts need slight tweaks in order to load properly         // Like our friend "Raleway"         if ( $font == 'Raleway' )             $font = 'Raleway:100';         $font = str_replace(" ", "+", $font);         wp_enqueue_style( "options_typography_$font", "http://fonts.googleapis.com/css?family=$font", false, null, 'all' );     }          /*      * Outputs the selected option panel styles inline into the <head>      */     function options_typography_styles() {          $output = '';          $input = '';          if ( woodpecker_get_option( 'google_font' ) ) {               $input = woodpecker_get_option( 'google_font' );           $output .= options_typography_font_styles( woodpecker_get_option( 'google_font' ) , '.google-font');          }          if ( $output != '' ) {         $output = "\n<style>\n" . $output . "</style>\n";         echo $output;          }     }     add_action('wp_head', 'options_typography_styles');          // Returns a typography option in a format that can be outputted as inline CSS          function options_typography_font_styles($option, $selectors) {             $output = $selectors . ' {';             $output .= ' color:' . $option['color'] .'; ';             $output .= 'font-family:' . $option['face'] . '; ';             $output .= 'font-weight:' . $option['style'] . '; ';             $output .= 'font-size:' . $option['size'] . '; ';             $output .= '}';             $output .= "\n";             return $output;     }      And in theme-option page added the following code:               //fonts             $options[] = array( 'name' => 'Selected Google Fonts',                 'desc' => 'Fifteen of the top google fonts.',                 'id' => 'google_font',                 'std' => array( 'size' => '36px', 'face' => 'Rokkitt, serif', 'color' => '#00bc96'),                 'type' => 'typography',                 'options' => array(                     'faces' => options_typography_get_google_fonts(),                     'styles' => false )                 );             $options[] = array( 'name' => 'System Fonts and Google Fonts Mixed',                 'desc' => 'Google fonts mixed with system fonts.',                 'id' => 'google_mixed',                 'std' => array( 'size' => '32px', 'face' => 'Georgia, serif', 'color' => '#f15081'),                 'type' => 'typography',                 'options' => array(                     'faces' => $typography_mixed_fonts,                     'styles' => false )                 );             $options[] = array( 'name' => 'System Fonts and Google Fonts Mixed (2)',                 'desc' => 'Google fonts mixed with system fonts.',                 'id' => 'google_mixed_2',                 'std' => array( 'size' => '28px', 'face' => 'Arvo, serif', 'color' => '#ee9f23'),                 'type' => 'typography',                 'options' => array(                     'faces' => $typography_mixed_fonts,                     'styles' => false )                 );      I am not getting the fonts listed in $os_faces array, in the drop down list of theme option panel. But the following defaults fonts are showing. View the image below.![enter image description here](http://i.stack.imgur.com/m9Vk2.png) Please help.


Order Terms by Custom Field

I have a custom post type that I am trying to order by terms. Each term has a custom field "order" associated with a number. I am trying to order the posts by term, in numerical order based on the custom field. $sections = get_terms('section', 'parent=0&orderby=meta_val_num&meta_key=list_order&order=ASC&hide_empty=1'); This solution does not work. It still prints the terms in alphabetical order.


Why can't I display attachment_image_src with Custom Size?

I'm trying to display an attachment with a custom size that I created with `add_image_size` called "custom-size-01" What the code returns is the word "Array" I've looked at the wordpress reference and been trying the `wp_get_attachment_image_src` reference and tried the example code it gives but i haven't been able to make it work. I haven't figured out what I'm doing wrong and could use any input to show me where I'm making a mistake.               if($imageid){      echo "<img src=\"";      echo  wp_get_attachment_image_src( $imageid, 'custom-size-01', false);       echo "\" width=\"100%\" >";       }


Remove sticky behavior from top navigation on twenty fourteen theme?

In wordpress theme twentyfourteen, I am wondering how to remove the sticky behavior of the top navigation with a 100% width header background image like this site? I would love to have a top image with full width and a max-height with the navigation just placed under it, but the navigation sticks to the top of the window in the browser when you scroll down. I ended up using the following .js with twentythirteen child theme               //$(document).ready(function() {     jQuery().ready(function($) {     var stickyNavTop = $('.navbar').offset().top;          var stickyNav = function(){     var scrollTop = $(window).scrollTop();          if (scrollTop > stickyNavTop) {      $('.navbar').addClass('sticky');     } else {     $('.navbar').removeClass('sticky');      }     };          stickyNav();          $(window).scroll(function() {     stickyNav();     });     });      and added                .sticky { position: fixed; z-index: 100; ... }      Thanks to a post found in here. I could have apply the same to the twentyfourteen, but it was tricky and I had no time to waste.


Possible to create placeholder images in Wordpress editor that are clickable (should bring up uploader)?

Working on a project where I would like to have buttons within the actual visual editor area where the user can click on the placeholder image and it brings up the upload dialog. I've seen that people create their own buttons that adds boxes that the user then should select with their mouse and then click the add media upload. To me that seems like it's bound for a bad user experience. Thus I'm looking to see if someone have seen a plugin that does this. ![http://s-plugins.wordpress.org/visual-editor-custom- buttons/assets/screenshot-4.png?rev=641514](http://i.stack.imgur.com/EmnJd.png) Imaging that you could actually click "insert image here" and have an upload dialog brought up.


Why won't this rewrite rule work?

Here's the setup. I have a custom post type 'Businesses'. I have a custom taxonomy 'Display Category'. And I have a second custom taxonomy 'Filters' Both taxonomies are set to work with the custom post type. I am trying to get a url structure that looks like this www.domain.com/businesses/display category term/filter term There are only 3 possible choices for the Display Category, those are eat,stay, and play. The Filters then have quite a few choices. so here is the rewrite rule I have so far but it's not working and I'm not sure why.               function test_add_rewrite_rules() {              global $wp_rewrite;              $new_rules = array(             'businesses/(eat|stay|play)/(.+)/?$' => 'index.php?post_type=businesses&display_category=' . $wp_rewrite->preg_index(1) . '&filters=' . $wp_rewrite->preg_index(2),             'businesses/(eat|stay|play)/?$' => 'index.php?post_type=businesses&display_category=' . $wp_rewrite->preg_index(1)              $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;     }          add_action( 'generate_rewrite_rules', 'test_add_rewrite_rules' );      I am using a rewrite rule inspector plugin so I know the rules are being added. But they are not returning the pages I want. I found this article about rewrite rules and it helped me get this far but I am stuck now. Any help would be greatly apprecieated! ## Update Here is the above code but instead using the add_rewrite_rule function. I have hooked in into init for now because the generate_rewrite_rules hook was firing too late for the new rules to be save. I also realized that I will need to get the paged rules to work as well but I'm not sure how to do that.               function test_add_rewrite_rules() {              global $wp_rewrite;              add_rewrite_rule('businesses/(eat|stay|play)/(.+)/?$', 'index.php?post_type=businesses&display_category=$matches[1]&filters=$matches[2]', 'top');         add_rewrite_rule('businesses/(eat|stay|play)/?$', 'index.php?post_type=businesses&display_category=$matches[1]', 'top');          }          add_action( 'init', 'test_add_rewrite_rules' );


Sticky Custom Post Types - Query returns nothing if no post marked as sticky

I am having an issue with sticky posts and custom post types. I want to display a sticky custom post type, but if there are no sticky posts, I simply want to display the latest post in that custom post type. I have it set up according to the codex here: http://codex.wordpress.org/Sticky_Posts. However, if I make a post sticky, it shows up. If I don't make a post sticky, nothing shows up. Here's my shortcode function: http://pastebin.com/s3jwx3xB I appreciate any help!


Select Multiple meta_value from WP DB; Single Query

I am trying to retrieve each user's first and last name, phone, email, and address from the usermeta table. I'm having trouble selecting multiple meta_values, each with its own meta_key, using a single sql query. I would like the data returned as First Name, Last Name, Phone, Address, Email First Name, Last Name, Phone, Address, Email First Name, Last Name, Phone, Address, Email First Name, Last Name, Phone, Address, Email I have access to the actual DB via phpMyAdmin, so I would like help with the mySql query.


Cannot Redeclare Fatal Error and Pluggable not Working with Child Theme

I am trying to make a child theme from the wordpress twentytwelve theme at http://thedragoon.ca and I followed the instructions at: http://www.elegantthemes.com/blog/resources/wordpress-child-theme-tutorial It broke my wordpress installation and no matter what fix I try, I keep getting this:               Fatal error: Cannot redeclare twentytwelve_setup()      (previously declared in /home2/thedrago/public_html/wp-content/themes/dragoon/functions.php:52) in /home2/thedrago/public_html/wp-content/themes/twentytwelve/functions.php on line 77      I have tried downloading a fresh wordpress zip and replacing the wp-includes folder while renaming my old one. I have also changed this part in the functions.php file to include the if(!function_exists).                if(!function_exists('twentytwelve_setup')) :     function twentytwelve_setup() {         /*          * Makes Twenty Twelve available for translation.          *          * Translations can be added to the /languages/ directory.          * If you're building a theme based on Twenty Twelve, use a find and replace          * to change 'twentytwelve' to the name of your theme in all the template files.          */         load_theme_textdomain( 'twentytwelve', get_template_directory() . '/languages' );              // This theme styles the visual editor with editor-style.css to match the theme style.         add_editor_style();              // Adds RSS feed links to <head> for posts and comments.         add_theme_support( 'automatic-feed-links' );              // This theme supports a variety of post formats.         add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote', 'status' ) );              // This theme uses wp_nav_menu() in one location.         register_nav_menu( 'primary', __( 'Primary Menu', 'twentytwelve' ) );              /*          * This theme supports custom background color and image,          * and here we also set up the default background color.          */         add_theme_support( 'custom-background', array(             'default-color' => 'e6e6e6',         ) );              // This theme uses a custom image size for featured images, displayed on "standard" posts.         add_theme_support( 'post-thumbnails' );         set_post_thumbnail_size( 624, 9999 ); // Unlimited height, soft crop     }     endif;


How to remove title from searchs parameters in WordPress?

I have a simple question about WordPress theme developpement. I'm trying to check if there is anyway to remove the_title() from parameters into the search engine of WordPress. Here is why : If I search something that is not in a page, post title, il will search into the_content (I supposed) and then shows the list of pages or posts. But if I search something in a title, the loop just show every pages content and it completly skips my search.php template... http://vincent.okidoomedia.com/miller/?s=tes As you can see, there is a list. http://vincent.okidoomedia.com/miller/?s=Sport When I type sport, you can see in the blue bar that it loads all the pages content instead of my list? Any idea how to fix it?


Make single widget area top level in 4.0 Customize Panel

So I have a widget area that, in v4.0, is burried in a dropdown within the secondary Widgets panel on the Customize panel page. Because it's the only widget area it feels rather silly being burried so deeply, so I'm wondering if there's a way to override the nesting and make that widget area dropdown a top-level section like it was in v3.x? It looks like this was brought up by the Core team here, but didn't gain any traction. Does anyone know how I might be able to do this?


Hide page name in wordpress page title

In my pages title I got for example "home-my title' and 'Books Archieves- my title', I want to drop those prefixes so I have only on page (home) 'My title' and on archive(category) 'Books- my title'. that's what I got inside the `head`: `<head> <?php wp_head(); ?> </head>`


Remove Wordpress.org Meta link

In my footer, I have a set of links labeled Meta, it has... Register   Log in   Entries RSS   Comments RSS   Wordpress.org How can I remove just the wordpress.org and and comments rss link from the meta links?


How to get the category of the post and link it to the archive (of the category)

I am trying to design a button in the sidebar which is related to the post displayed. The button is basically a "other news in CAT1". i have this piece of code:
     <?php      $category = get_the_category();      if($category[0]){     echo 'term_id ).'">

News su '.$category[0]->cat_name.'

';     }     ?>
      which unfortunately displays the wrong category. Can please anybody tell me how to do it. It shouldn't be that difficult, i just started with wordpress.


Register a custom post type as public = false, but have content appear in search engines?

I dont want the pages to exist ie. they go to 404 if you attempt to access them but I want the content on to be indexed in a search, google, bing etc the custom-post-type content will be displayed in a front page template, in the style of a 'one page layout'. like this site; http://www.bingu.name/demo/wpmiworks/


Custom Post Type with has_archive ignores my custom archive and single template

I'm trying to set up a new CPT called news (see code here: http://pastie.org/3148081) and I'm specifying the has_archive parameter. I've set up a new template called archive-news.php and single-news.php but its not being used when I go to /news/ or the permalink on the site. Instead the default archive.php and single.php gets loaded. I've flushed the rewrite rules but still does not work. This is the first time I'm using the has_archive parameter but after lots of searching I still can't see what I doing wrong. Hopefully it's just a stupid mistake somewhere that someone can spot for me.


Register User can post video

I have a blog. I need to add a functionality. Where Registered user can upload video and Registered user can view all video and Onclick on Particular video That video display and User can comment on video and total view. Is there any plugin that provide this functionality. or Any demo link or code.


Plugin recommendation for member management

I couldn't find any plugin to do that, so I need a help here. This is what I need. One page will have a small form with 6 fields. One field is to upload photo. Another page will show in a matrix layout (2 columns 5 rows) all the users that were registered from my form. On the backend, I just need to be able to see the registered people and manage them (accept, delete, and so on). Do you know any plugin or tutorial that show me how to achieve that?


Sort appearence order in the_content()

I have an About the Author plugin, echoing inside the_content(), and a Facebook Like Button, that I hardcoded in the HTML, after the_content(), here's how it is outputting: ![enter image description here](http://i.stack.imgur.com/JDfg7.png) The Facebook Like button should appear prior than the Author Box Single.php (handcoded by me, probably with some bad practices as I'm noob at PHP):               <?php get_header(); ?>

             <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_title(); ?>

por <?php the_author_link(); ?>

Em <?php the_category(' , ') ?>

<?php the_content(); ?>

                 <?php echo do_shortcode('[fbcomments width="450" count="on" num="10" title="Faça o social :)" countmsg="comments"]'); ?>             <?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
<?php endif; ?>

     <?php get_sidebar(); ?>     <?php get_footer(); ?>      I know **why** it is outputting bellow the author box, but I don't know how to **FIX** it. I've tried do_shortcode the Biographia plugin, but then it enters a infinite loop, echoing the post over and over again


Wordpress custom post type with folder structure in slug

I have setup a custom post type with the slug "interview" and it is working fine. I am trying to change the slug to "magazine/interview" but I keep getting 404 errors when I try to access the posts that are already there. Is there any specific trick to set a slug with "/" characters in it?


Custom Fields vs Separate Table

I have a client who wants to be able to upload Posts using information stored in a CSV file. I've already got this portion working. Just recently, I changed the CSV File Uploader from pure PHP to an AJAX Uploader in an effort to eliminate server timeouts as well as provide a nice interface to keep track of each new post's progress. ## The Problem: Each custom post contains about 130 Custom Fields total. Each one of my CSV Upload Tests contained roughly 20 new Posts. Even with async left on, it still takes a bit for each new Post to be processed. All of the Custom Fields are broken up into 5 separate Meta Boxes. Originally, I had it set up to store each Meta Box as a JSON Encoded string, and save that as part of the post's metadata. This brought the total number of Custom Fields from 130 to 5, and write time was increased dramatically. The drawback to this, however, is that each individual Custom Field is no longer searchable by Wordpress' standards. ## Proposed Solutions: I can do one of a few things:   1. I can leave it as-is and take the slower write times while retaining both searchable and queryable Metadata, but perhaps run into issues with CSV files that contain a few hundred or - God forbid - a few thousand Posts.   2. I can store each Meta Box as a single Custom Field and modify Wordpress' search functionality to find Metadata via custom SQL, but lose the ability to retrieve Posts via meta_query.   3. I can overhaul the existing structure and write all Custom Post Metadata to a separate table. This means losing the built-in search functionality, as well as the ability to use meta_query. ## The Question: What would be the best approach to handling this? Theoretically, there are going to be hundreds of thousands of these Custom Posts. Giving users the ability to search for these posts both by title, taxonomy, and metadata is required. Personally, I try to avoid writing any new tables to a Wordpress Installation at all costs. But would this be considered a situation that demands it? Or would I lose too much functionality by using my own less-sophisticated queries to fix a problem that might not even necessarily BE a problem? Most of all, is there any other way that I might be missing that can solve this issue? **UPDATE:**   In an effort to clarify what the data entails without violating my NDA, each Custom Post is a Guitar. Each Meta Box signifies a Section of a Guitar (Neck, Body, etc.), with each Custom Field being a fixed piece of information attributed to that particular section (Wood, Manufacturer, etc.).               class Guitar     {         public $ID;         public $Year;         public $Make;         public $Model;              public $Section1;         public $Section2;         public $Section3;         public $Section4;         public $Section5;         public $Section6;         public $Section7;         public $General;              private $_data;         private static $_dataFlags = array('Section1', 'Section2', 'Section3', 'Section4', 'Section5', 'Section6', 'Section7', 'General');         public function __construct($args)         {             $this->ID = $this->_query_existing();             foreach(self::$_dataFlags as $sec)                 $this->$sec = new $sec($args[$sec]);         }     }     abstract class Guitar_Section     {         public function __construct($arr=array())         {                 if(!empty($arr))                 $this->_set_props($arr); //Set Properties         }         public function update_meta($id, $useprops=false)         {             foreach(get_object_vars($this) as $k=>$v)             {                 $this->$k = !$useprops ? $_POST['guitar_'.$this->_get_section_name().'_'.$k] : $v;                 update_post_meta($id, '_guitar_'.$this->_get_section_name().'_'.$k, $this->$k);             }         }     }     class Section1 extends Guitar_Section     {         public $Wood;         public $Attachment;         public $etc;              protected function _get_section_name()         {             return 'Section1';         }     }      This displays how each Class works in tandem with each other. I have it so that each Guitar Section is encapsulated by the Guitar Class, with each section extending the abstract class. Each property is a Custom Field, and is set utilizing the Methods within the Abstract Class, while the Guitar Class essentially queries Wordpress and sets any available ID, Year, Make, and Model. Most of this requires a LOT of string manipulation due to the fact that CSV files are used to set the class and its properties.


How to hook into publish_posttype?

I'm trying to hook into WordPress publish. The code below is what I'm using, but it doesn't appear to be running. I have it in a plugin file that I deactivate/reactivate each time I make changes (not sure if that's necessary to do that though). Post type is "auction".               add_action( 'publish_auction', 'bvf_set_ceiling_once_on_first_publish' );          function bvf_set_ceiling_once_on_first_publish( $post ) {              $post_id = $post->ID;              if ( !get_post_meta( $post_id, 'ceiling', $single = true ) ) {              $reserve = get_post_meta( $post_id, 'reserve', $single = true );              $ceiling = $reserve * (rand(40,60) / 100);              update_post_meta( $post_id, 'ceiling', $ceiling );              }     }      Now I'm trying the following (01/16/13):               <?php     /**      * @package Bids_Views      * @version 0.0.1      */     /*     Plugin Name: Bids/Views     Description: None     Author: Jerry T.         Version: 0.0.1     */          add_action('publish_post', 'bvf_set_ceiling');     function bvf_set_ceiling( $post_id ) {          $post = get_post($post_id);          $reserve = get_post_meta( $post_id, 'reserve', true );          $ceiling = $reserve * (rand(40,60) / 100);          update_post_meta( $post_id, 'ceiling', $ceiling );          }          ?>


Show count of all comments by meta_value from a users posts

I'm trying to display the total number of comments for a users posts limited to a comment meta. I've tried using both `get_comments()` and `WP_Comment_Query()` but I get the same result of "1" for the comment count when it should be "3". Now in this example I can remove `'Count' => true` and just loop through the comments and that will return the correct amount of comments in a loop but the count still equals one. They provide an example here on how to get the count but it doesn't work for me. Here's my function.                function get_unseen_comment_count() {         if ( !is_user_logged_in() )             return false;         $user_id = get_current_user_id();         $postids = array();         $posts = get_posts( array(           'numberposts' => -1,           'post_type'       => 'fod_articles',           'author' => $user_id,           'post_status'     => 'publish'         ));              foreach( $posts as $post ) {             $postids[] = $post->ID;         }         $args = array(             'include'      => $postids,             'meta_query' => array(               array(                 'key'   => 'viewed_status',                 'value' => 'unseen'               )             ),                   'count' => true         );         // $comments_query = new WP_Comment_Query;         // $comments = $comments_query->query( $args );         $comments = get_comments($args);         echo '';           echo $comments;         echo '';      }      Now in the codex it doesn't say that `get_comment()` supports meta query but you can see on line 181 here that it does. It doesn't however show support for `include` but it definitely works when I test using a loop of the actual comments. Some further testing when I remove the meta_query I do get the total comment count for all posts by the user so my media query seems to be the problem interfering with the count. I tried also just using `meta_key` and `meta_value` without a meta query but I get the same result..."1".


Plugin options table,is the data serialized

I am planning on building a plugin and i need to know if the data stored in the options table i will create for the plugin will be serialized or it will be in the ordinary sql format.


Get post type on edit page

I am writing the backend for my theme and have 4 custom post types. I have registered them all and now I am writing the metaboxes and handlers. My question is in wordpress admin is there a way of determing which custom post type your editing. I.E. lets say I have a custom post type of Testimonials, I click add New and am presented with the various fields etc. Is there a function in wordpress that will tell me what this post type is. Ive tried get_post_type() but it returns nothing. Any help would be appreciated. Steve


Configuration Options for embedded YouTube Videos

I have some embedded You tube videos on my blog and I have a question about configuration as they are on static pages. Is there code or a WP plugin solution to make an embedded You Tube video to return to the "Play prompt" position when a video ends. Currently when a video ends on my site it promotes other Youtube material. Refreshing (manually)the screens brings it back to "Play prompt" but I would like to do this automatically.


Container class not appearing on navigation menu

I want to render a menu with a container like this: `<nav class="nav">` However, the container is just rendering with the default class name applied which I don't want. `<nav class="menu-main-nav-container">` I can't understand where I'm going wrong. Here's my code:               if ( has_nav_menu( 'nav-menu' ) ) {      wp_nav_menu( array(      'theme_location' => 'nav-menu',      'container' => 'nav',      'container-class' => 'nav',      'items_wrap' => '
%3$s
' ) );     }       Anyone able to help?


Only list categories that contain posts of a specific custom post type

I have three custom post types set up, `articles`, `videos` and `photos`.   I am using standard categories for these post types, and sharing the categories across all post types. I am trying to create a nav menu for each post type, listing the categories, that should follow the following structure:   * Photos     * Cat 1     * Cat 3     * Cat 5   * Videos     * Cat 2     * Cat 3     * Cat 5   * Articles     * Cat 1     * Cat 2     * Cat 4 Categories that do not contain the custom post type should be hidden. `get_categories()` with `hide_empty` set to `1` is obviously close, but it doesn't allow you to specify a post type.


Custom post type permalinks breaking due to 3.1 bug fix

So I just updated a site to 3.1 that uses several custom post types. When I had made the site I had not noticed at the time the `$post_type` parameter for `register_post_type` has to be in all lowercase letters! ( it was not well written in the codex but now it is **bold** ). http://codex.wordpress.org/Function_Reference/register_post_type#Parameters My custom post types were registered with a capitol letter for instance "Rentals" instead of 'rentals'. This was fixed in 3.1 thus any posts registered with upper case letters were totally broken in the back and front end. I was able to go back into the function and change it to lowercase and then call another function to update the database with the new name before it fires thanks to a post on wordpress.org by dennis_f. Here new function               if(!get_option('custom_type_updated')){     global $wpdb;     $wpdb->query("UPDATE $wpdb->posts SET post_type = 'custom-rental' WHERE post_type = 'Custom-Rental'");     update_option('custom_type_updated','true');     }      and here is the register re-written in lowercase               // Custom page template for rentals      -----------------     function Rental_register_post_type() {         register_post_type( 'custom-rental', array(             'public'        => true,             'can_export'    => true,             'has_archive'   => 'Rentals',             'rewrite'       => true,             'supports' => array(                     ** bunch of supports stuff                 ),             'labels' => array(                 **bunch of labels                 )             )         );     }     add_action( 'init', 'Rental_register_post_type', 0 );      This did fix the major issue of broken custom post types BUT the problem is now using a custom permalink structure breaks the custom post type 'rentals', only the default works. For example www.example.com/?custom-rental=7-bedrooms works fine, but no custom permalink structure works, I have tried each type and cleared the .htaccess and just returns a 404. Any ideas?


How do I rewrite attachment urls when permalink structure contains %category%?

I'm trying to change the permalinks to my attachments in the same way as this question, and the given solution works great except for one problem: if the permalinks settings on my site contain %category%, the solution doesn't work at all and I get a "This page isn't redirecting properly" error. The only way I can get this solution to work properly is by using the provided "Day and Name", "Month and Name", and "Numeric" permalink settings. What do I add to the solution so that still use %category% in my custom permalink settings?


Best way to achieve multiple links in a post title

Usually I would get a post title no problem, however now I need to achieve something like this: > The Example is written for this title As you can see two words are links in the title, another problem is that there could be any number of links, as it will depend on a content. How can I achieve this? will I have to use additional fields in WordPress? how to show WordPress which words in the title are links? And in addition, I will need to somehow store url for the link.


Call custom field into menu item

I have a navigation menu in Wordpress. I would like it to check if the page has a custom field of "menu_icon" and if it does, add that custom field into the menu item it corresponds to. I'm sure this would require some sort of walker function extension but I am a bit new to PHP and Wordpress. I've search around and have not found a suitable tutorial. For example: (normal menu)

link

          (custom)

link


Query posts only with featured image

I want to query 6 posts, but only those which have a featured image attached. I am using `meta_key` method for this with `WP_Query` as such:               $args = array(         'post_type'  => 'post',         'meta_key' => '_thumbnail_id',         'post_count' => 6 );     $query = new WP_Query($args);      Followed by               <?php while($query->have_posts()) : $query->the_post(); ?>
<?php the_title(); ?>
         <?php the_post_thumbnail('thumbnail'); ?>     <?php endwhile; ?>      This doesn't seem to work. The query is returning more than 6 posts and also those which don't have a featured image. Any ideas what I've got wrong here? @chip: `var_dump($query);` gives a large result so I have posted it in a pastebin


BackupBuddy WP CLI Invalid Profile Error

When I try to run a WordPress (3.8) backup of a site using wp-cli 10 alpha (site here)               wp --info     PHP binary: /usr/local/bin/php-5.3     PHP version:    5.3.5     php.ini used:   /etc/php53/php.ini     wp-cli root:    /usr/local/wp/vendor/wp-cli/wp-cli/php/     wp-cli config:       wp-cli version: 0.10.0-alpha      on my Dreamhost VPS in combination with BackupBuddy 4.2.12.1 I get this error               wp backupbuddy backup profile-name     Error: Error #85489548955. Invalid profile ID not numeric: `profile-name`.      Any ideas how I can remedy this?


Unable to select image using custom image field type

I'm using the advanced custom field plugin and having a bit of trouble when using the image field type. (I'm not sure if this relates to the plugin that much actually!). When inserting an image instead of the option to select it I only have the option to insert it into post, which tries to insert the image into a wysiwyg. I only get the option to select image if I first insert it into post then delete it from the wysiwyg, then click choose image again and find it in the media gallery. Is there any workarounds/plugins to allow me to select the image straight away?


category url structure

Is it possible to have listed all available categories on `www.example.com/category/` request. Using the following url as mentioned in my example generating 404 error.


Applying same style to all the comments on the page

I have this code below: `#comment-1, #comment-2, #comment-3 { width: 70%; margin: 1em 0 0.5em 0; }` This CSS is to format the comments for them to be 70% of the parent div's width. I see where it breaks after 3 comments, how do I get it to apply to all the comments on the page regardless of the number?


Infinite scroll jPlayer callback with PHP and post id?

How can I call the correct callback function for infinite scroll plugin on WordPress with variable `<?php the_ID() ?>` ? I'm trying to connect jPlayer like this: Code in php:
          <div id="jp_container_<?php the_ID(); ?>">

             <div id="jquery_jplayer_<?php the_ID(); ?>" class="jp-jplayer">
     <div id="jp_interface_<?php the_ID(); ?>" class="jp-interface">

play

pause

stop

     <?php if ($my_meta = get_post_custom_values( 'extra', $ID )) { ?>     <a href="<?php       global $wp_query;     $postid = $wp_query->post->ID;     $extra = get_post_meta($postid, 'extra', true);      echo $extra; ?>" class="jp-extra" tartabindex="1" title="Слушать через устройство">     <?php } else { ?>     <a href="<?php       global $wp_query;     $postid = $wp_query->post->ID;     $extra = get_post_meta($postid, 'radio', true);      echo $extra; ?>" class="jp-next jp-extra" title="Слушать через устройство">
     <?php } ?>

                         Ошибка!                         Установите Flash Player.

      What browsers give me:

play

pause

stop

                         Ошибка!                         Установите Flash Player.

      When a new post is loaded with infinite scroll, the players do not work. If I set the ID manuall without PHP (for example `$("#jquery_jplayer_1705").jPlayer())`, it works fine. The player may be more 100 pieces and to manually add each one would be very hard.


do_shortcode() doesn't do shortcodes ;)

Imagine this basic shortcode in your functions.php file:               function div_shortcode( $atts ) {        return '

';     }          add_shortcode('div', 'div_shortcode');      So every `[div]` in Wordpress editor gives `<div class="div"></div>`. Everything looks and works fine, right? Now here comes the trouble. I need to use my shortcode in PHP file (not putting it via WP Text Editor). Luckily there's a function for that:               <?php do_shortcode('[div]'); ?>       But, wait, it shows... nothing?               <?php do_shortcode('[gallery]'); ?>       Even this one doesn't work. Why is that happening? Any ideas?


Limitations when adding new users

I began adding new users to my site tonight, all as authors. Is there a limitation to the number of users or how quickly they are added, after adding the 50th user there seems to be a minute or two delay before wordpress will allow me to add the next user.


Illegal offset type in get_post_type_object()?

I'm getting the following warning in my WP admin custom posts listings page (`wp-admin/edit.php?post_type=video`)               Warning: Illegal offset type in isset or empty in wp-includes/post.php on line 817      I'm running WordPress v3.1.3 (latest). Line 817 is in the function `get_post_type_object()` . A search finds me these threads:   * http://wordpress.org/support/topic/warning-illegal-offset-type-in-isset-or-empty   * http://wordpress.org/support/topic/error-when-searching-for-posts-in-the-backend-illegel-offset These mention some different potential causes - e.g. it might be https://core.trac.wordpress.org/ticket/12704 - but that's now fixed (I'm running v3.1.3) - and the final post in one reads: > Basically, you have a plugin registering a post type incorrectly, and then > core complains. It isn't a bug in core best I can tell. I do have a plugin (my own) registering a post type, but I think it's doing it correctly. Here's the code. (Note that I was originally calling these "video" posts but later renamed the front-end description to "Training Module", but left the original post-type name).               function video_register() {         $labels = array(             'name' => _x('Modules', 'post type general name'),             'singular_name' => _x('Training Module', 'post type singular name'),             'add_new' => _x('Add New Module', 'video item'),             'add_new_item' => __('Add New Training Module'),             'edit_item' => __('Edit Training Module'),             'new_item' => __('New Training Module'),             'view_item' => __('View Training Module'),             'search_items' => __('Search Training Modules'),             'not_found' =>  __('No Training Modules found'),             'not_found_in_trash' => __('No Training Modules found in Trash'),             'parent_item_colon' => ''         );         $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'has_archive' => 'video',             'menu_icon' => 'video16x16.png',             'rewrite' => array('slug'=>'training','with_front'=>false),             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => '15',             'supports' => array('title','author','editor','custom-fields','revisions','comments','trackbacks'),             'taxonomies' => array('category', 'post_tag')           );         register_post_type( 'video' , $args );     }     add_action('init', 'video_register');      Is there a problem there? Why am I seeing the warning?


Unable to stream pdf: headers already sent problem in dompdf

I have used dompdf to display the user information in admin of my wordpress project. While generating the PDF file it works perfectly in my local server. But in live server `Unable to stream pdf: headers already sent` message is displayed. The page where pdf is generated is `http://mysite.com/wp- admin/admin.php?page=certificate&id=4`. The file for this link is `include(ABSPATH."wp- content/themes/ncc/certificate.php");` Here is the code I have used               <?php     require_once("dompdf/dompdf_config.inc.php");     ob_end_clean();     ob_start();     ?>

                 Certificate

                 Name

                 Email id

          <?php     $data = ob_get_clean();     $old_limit = ini_set("memory_limit", "64M");     $dompdf = new DOMPDF();     $size = array(0,0,800.00,700.00);     $dompdf->load_html($data);     $dompdf->set_paper($size);     $dompdf->render();     $dompdf->stream('certificate.pdf');     ?>      Can anyone help me what is the creating problem here. Thanks in advance


Retrieve latest post by multiple categories with ID

I have the categories listed below in my `product` post type.               Category Name: Test 1 ID: 82     Category Name: Test 2 ID: 83     Category Name: Test 3 ID: 84     Category Name: Test 4 ID: 85      Now I want to retrieve for each category one post -- the last one added. I have tried below code but it isn't working right.               <?php         $args = array( 'product_cat_' => 82,83,84,85, 'post_type' => 'product', 'orderby' => 'post_date', 'order' => 'DESC', 'post_status' => 'publish', 'posts_per_page' => 4 );          $postslist = get_posts( $args );             foreach ($postslist as $post) :  setup_postdata($post);      ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
           <?php endforeach; ?>


Can't Update File Permissions on SSH connection for Use in WordPress

I am working with a WordPress site and am having all sorts of problems since I'm running it on SFTP. I've updated my wp-config.php file so I can authenticate plugins and updates but WordPress is still having trouble doing a lot of different things on the site because of file permission issues. First off, the file permissions are set like every other WordPress site I've worked on (folders at 775 and files at 664. For some reason, though, it can't access certain files (I have a feeling it's why my permalinks keep breaking when I try to update them). I've gone into Cyberduck and done the standard update to the file permissions but it always immediately reverts right back to the 775 and 664. I was just trying to set them to 777 to see if it would alleviate the problem but I can't even do that. Is there a reason my WordPress site can't read files that are on an SSH server? Thanks for your help (I wasn't really sure if I should post this here or in the WordPress forum since it deals with a couple issues...).


WP 3.5 media manager - how to create a working gallery frame

i am writing a plugin and after hours and hours of searching for any documentation on WP 3.5 media manager i managed to create my custom media frame that is being called when a user clicks on a custom TinyMCE button in that i added. this is the working code that inserts a single image:                onclick: function(e) {         var dej_frame;         e.preventDefault();                   // If the frame already exists, re-open it.         if (dej_frame) {             dej_frame.open();             return;         }              //create media frame         dej_frame = wp.media.frames.dej_frame = wp.media({             className: 'media-frame mojo-media-frame',             frame: 'post',              multiple: false,              state: 'insert',             library: {                 type: 'image' //Only allow images             },         });              dej_frame.on('insert', function() {                  var media_attachment = dej_frame.state().get('selection').first().toJSON();                            ed.execCommand('mceInsertContent', false, 'this will be instered in editor');         });              dej_frame.open();               }      This is working for single image. But, when i try to add gallery nothing happens. I do not know and couldn't find in the source (it's either too confusing or i am too stupid for this) I know that i need to write my own function that will add galleries, only i don't know what's the actual name of the function, how should it be called??


custom post type search by reference id

I have a custom content type of `tab_content` with a relationship to a `page`. In my current script I have the _id_ of a `page` and I want to do a query that will list all the children of type `tab_content` that have the relationship of a `page` with the specified id. All I have so far is:               new WP_Query(array('post_type' => 'tab_content'));      How do I tell the query that the custom field `parent` needs to be something like `80`? Thanks


Remove field in comment reply form

I am trying to add in the below function a check to see if the comment depth is greater than 1, or if the comment is a reply so the 'My Rating' option does not appear when it is a comment reply. Or need the my rating field to be hidden or not displayed when on reply in CSS.               if($userRatingsEnabled) {         //get the ip address                     $ip=$_SERVER['REMOTE_ADDR'];         if(strpos($meta,$ip) === false) {         if ( $depth <= 1 ) {                   echo '
'. __('My Rating','made') . '
';                  echo '
<select id="rating" name="rating"><option value="">---------</option>';      ...more code Please help! Thanks,


Replace the slug of parent pages with #

I'm creating a Wordpress site with a Superfish CSS3 / Jquery dropdown menu, complete with hoverIntent as displayed here: http://users.tpg.com.au/j_birch/plugins/superfish/#examples As far as I can see, this menu works well on mobile devices, because the link values refer to the same page, like `#a`, so that clicking a link does not cause the page to reload. Please bear with me. I know that the right way would be to replace the dropdown menu entirely (with a select box or some other tool), but I need to have the exact same experience as on a desktop (long story). My question is: how can I replace the href value of parent pages, with an internal link like `#a`? My guess would be that doing this via jQuery would be the best solution. What are your views on this and could someone please provide a practical answer? Thanks in advance.


Listing all child-pages of a parent-page on the parent-page and each child-page?

I have a parent page called "About". This page has three child pages "Members", "Information", "Contact". I want to list all the child-pages on all four pages, also the parent-page. So right now I have this which lists all the child-pages only on the parent-page.               <?php             if ( !$post->post_parent ) {                 echo '
';                     wp_list_pages("title_li=&child_of=".$post->ID."&link_before=— ");                 echo '
';             }         ?>      But I want all the pages also listed on each individual child page. How do I do that?


authenticate user without redirecting

I am working on a form (Gravity Form) which needs some user authentication when the form is submitted. Gravity's documentation pointed out the place where i should place my code. i.e. > gform_pre_submission_filter I tried using SimpleModal Login, but problem comes when the user is authenticated and it is redirected either to the dashboard (default) or using redirect_to. This causes all fields reset to defaults. Question is how can i preserve my form's (gravity form) entries and still authenticate and login the user?


Wordpress truncate posts question (plug-in related)

I'm using a plug-in ("Wordpress plugin random post slider") for Wordpress that pulls a random post from a category, and displays it in a slider for use as a shortcode or php code in a template. I've already made some modifications to the plug-in to get it to display properly on my site (http://lillypillyps.com.au), but it has some limitations that the developer will take forever to follow up on. I was wondering if someone might be able to help with the following questions in order of importance:   1. it's using some sort of truncate on the post content which is currently set to 170 characters (through the plug-in's settings page in the admin of WP). I want it to truncate to the nearest word so it doesn't cut-off mid-word.   2. is it possible to ONLY have the "... READ MORE" button display IF the content is longer than the truncation point? ie. not display if the content is less that 170 characters.   3. there is a few options for the transitions between the slides (scrollLeft/scrollRight/scrollUp/scrollDown), but the same jquery should be capable of fade-in/fade-out shouldn't it? How can I used this transition instead of the ones the plug-in "allows" me to use?


Count total number of post in foreach loop

I used the the following script (only with get_permalink....) to display posts from a post type where the post author has an extra meta field on his user page:               <?php // get users from user page         $blogusers = get_users();         foreach ($blogusers as $user) {             if(get_field('races','user_' . $user->ID)) {             while(the_repeater_field('races','user_' . $user->ID)) {                 $signed_up = get_sub_field('race_name', $post_object->ID);                 if($original_id == $signed_up->ID) { //original ID is the race_name post we are on                       $user_info = get_userdata($user->ID);                          $arg = array(                      'post_type' => array ('members'),                     'post_status' => array( 'publish'),                     'posts_per_page' => 200,                     'author' => $user_info->ID                     );                     $arg_query = new WP_Query();                     $arg_query->query( $arg );                          echo $total = $arg_query->post_count;                      } else {                 }             }         }     } ?>      While it worked to display titles of the posts from the members post type, I can't get my head around to count these posts. It shows: 1 1 1 instead of 3 and so on. How can I change the foreach to work properly?


Warning: Illegal string offset 'width'

Recently when I try to view the jpeg or png files in the media library, I got the messages Warning: Illegal string offset 'width' in /home/strataco/public_html/wp/wp- content/themes/twentyeleven/image.php on line 34 Warning: Illegal string offset 'height' in /home/strataco/public_html/wp/wp- content/themes/twentyeleven/image.php on line 35 and I can't edit or view the photos. In addition, the header image and sidebar on my site cannot be displayed. Anybody has any idea and how to solve this.


How to store accumulate multiple option values in a single array using Options_API

I have created an option array that stores a series of options, along with their values. The problem is that I want to ACCUMULATE these options and store them in the options database. Meaning I would be able to add multiple records to the database, instead of only updating a single option. For example, I need to store testimonials that will allow the user to keep the name/testimonial for several different people (i.e. Brad's testimonial, Carrie's Testimonial, etc), so the option would need the ability to add multiple records. Hopefully this is enough description. Here's my current options code:               add_option( 'testimonials_settings', $testimonials_options );               $testimonials_options = array (     'testimonials_active' => '0',     'testimonials_name' => '',     'testimonials_website_name' => '',     'testimonials_website_url' => '',     'testimonials_quote' => ''     );          if(isset($_POST['testimonials_update_options'])) {        $options = get_option('testimonials_settings');         $options['testimonials_active'] = $_POST['testimonials_active'];        $options['testimonials_name'] = $_POST['testimonials_name'];        $options['testimonials_website_name'] = $_POST['testimonials_website_name'];        $options['testimonials_website_url'] = $_POST['testimonials_website_url'];        $options['testimonials_quote'] = $_POST['testimonials_quote'];     update_option('testimonials_settings', $options);     }


What is the right way to include a wp-admin file in your theme?

I'm trying to use `wp_delete_user()` in my theme, to allow a user to delete their account from the front-end. Turns out that the `wp_delete_user()` is not defined unless /wp- admin/includes/user.php has been included. Is there a _right_ way to do this in WordPress? Something that uses get_bloginfo() or a global constant for example?


How can this be achived? Replace the post count on wp_list_categories with "Has Posts" instead of number and "No Posts" if none.


Mysql query and odd results

I've a query here :               $sql = "SELECT ID,post_title,post_content,post_date,post_type      FROM {$wpdb->posts}      WHERE post_content LIKE {$stuff}      AND post_status = 'publish'      AND post_type = '{$post_type}'      AND ID != {$post->ID}      LIMIT {$limit}";     $results= $wpdb->get_results($sql);      `$stuff` is a `%keyword%` and `$post_type` is a post type slug, the odd thing here is that when I use e.g. `articles` as post type, results also contains posts with `revision` status and `page` or `post` type and it seems that `if statements` like `post_type = '{$post_type}'` and `post_status = 'publish'` doesn't work at all!! What should i do? _**Update_** I did a `print_r()` for `$sql` : `SELECT ID,post_title,post_content,post_date,post_type FROM wp_posts WHERE post_content LIKE '%Battery%' OR post_content LIKE '%Watcher%' OR post_content LIKE '%Widget%' OR post_content LIKE '%matches%' OR post_content LIKE '%built%' OR post_content LIKE '%HTC%' OR post_content LIKE '%widgets%' OR post_content LIKE '%Please%' OR post_content LIKE '%check%' OR post_content LIKE '%Thrutu%' OR post_content LIKE '%day%' OR post_content LIKE '%job%' OR post_content LIKE '%app%' OR post_content LIKE '%donate%' OR post_content LIKE '%buying%' AND post_status = 'publish' AND post_type = 'articles' AND ID != 1388 LIMIT 4`


I would like my page editor to be sorted by date created, or updated, instead of in Alpha order, is this possible?

When looking at my "All Pages" they are listed in Alpha order, and I have to scroll through to find what I am updating. Is there a way to have a preference setting that it be sorted by date, without having to tell it every time to do that?


Wordpress to end support for PHP 4?

Recently getting into wordpress plugin development, I started to investigate how to make my code backward compatible to php 4+. I've focused only on php 5.1+ for the past 5 years, so this was an ordeal. Anyway, when looking at some plugins, one of them had this description: > IMPORTANT: This plugin is not compatible with PHP 4. If you try to install > it on a host running PHP 4, you will get a parse error. WordPress is ending > support for PHP 4 as of version 3.2 Is it true that wordpress is going to stop supporting php prior to php 5?