When editing a post with a custom meta box the values aren't displaying correctly

I followed this tutorial to create a custom meta box with a simple two option drop down. My code is below. The custom fields are saved when creating a post, and edit when I change the value and Update. But when I go to the edit post page the values aren't dynamic and displaying the correct drop down value based on the set meta value. So if I create a post and set the option to Yes, then I go edit to post it shows No but in the custom meta field it does show Yes so it's saving correctly. I know that the `No` and `Yes` values should be dynamic and check if any custom meta has been set to display it but not sure what the code is. Any help with the code is appreciated. Thanks               <?       add_action('admin_menu', 'my_post_options_box');          function my_post_options_box() {     add_meta_box('post_info', 'Trade', 'custom_post_info', 'post', 'side', 'high');     }          //Adds the actual option box     function custom_post_info() {     global $post;     ?>     <fieldset id="mycustom-div">

     Accept Trade?
     <select name="cpi_dropdown_options" id="cpi_dropdown_options">     <option<?php selected( get_post_meta($post->ID, 'cpi_dropdown_options', true), 'Option 1' ); ?>>No</option>     <option<?php selected( get_post_meta($post->ID, 'cpi_dropdown_options', true), 'Option 2' ); ?>>Yes</option>     </select>

     </fieldset>     <?php     }          add_action('save_post', 'custom_add_save');     function custom_add_save($postID){     // called after a post or page is saved     if($parent_id = wp_is_post_revision($postID))     {     $postID = $parent_id;     }          if ($_POST['cpi_dropdown_options']) {     update_custom_meta($postID, $_POST['cpi_dropdown_options'], 'cpi_dropdown_options');     }     if ($_POST['cpi_text_option']) {     update_custom_meta($postID, $_POST['cpi_text_option'], 'cpi_text_option');     }     }          function update_custom_meta($postID, $newvalue, $field_name) {     // To create new meta     if(!get_post_meta($postID, $field_name)){     add_post_meta($postID, $field_name, $newvalue);     }else{     // or to update existing meta     update_post_meta($postID, $field_name, $newvalue);     }     }     ?>


WordPress not updating post or disable plugin instead a white page appear

I was working in a local WordPress website, and it works without any problem. Then i uploaded it to a live server as follow:   * Uploaded all my local files and folder to the live server.   * Imported the local DB to Live server.   * Changed the links in the DB from the (localhost) to my (live domain).   * changed the config.php file to connect to the DB. after doing these steps my web site **( Front-end ) is working great without any problem**. But when i logged-in to my dashboard and tried to do any of the following **i got instead a white page appear without any error** :   * When trying to **disable/activate** any plugin.   * When trying to **Update** any post.   * When trying to **publish new** page/post.   * When **Deleting** page/post. I tried **this solutions but didn't solve the problem** :   * I disabled all the plugin to see if any cause a conflict.   * I tried to use the default theme instead of my custom theme. **Update:** After enabling `define('WP_DEBUG', true);` as @s_ha_dum say, I got this :   * **Warning:** Cannot modify header information - headers already sent by (output started at /......./wp-content/themes/sbr/functions.php:670) in /......../wp-admin/post.php on line 233.   * **Warning:** Cannot modify header information - headers already sent by (output started at ............/wp-content/themes/sbr/functions.php:670) in /............./wp-includes/pluggable.php on line 896.


Display posts from an array of ID's

The result of the query so far is the print of the array, Array ( [0] => 309 [1] => 10 ), 309 & 10 are the correct id's of the posts I want to display, and "No posts were found" the result of hitting "else". I have a pastebin with the most up to date copy of my code here, http://pastebin.com/pZkQCf9y Here is the query:               <?php          $ongoing_args = array(       'post_type' => 'promotions',       'meta_key' => 'sp_ongoingPromotion',       'meta_value' => 1     );          $current_args = array(       'post_type' => 'promotions',       'meta_key' => 'sp_endDate',       'meta_value' => date("Y/m/d"),       'meta_compare' => '>=',       'orderby' => 'meta_value',       'order' => 'ASC'     );          // Get promotions using the arguments outlined above.     $ongoing_promotions = get_posts( $ongoing_args );     $current_promotions = get_posts( $current_args );          // Merge arrays     $all_promotions = array_merge( $ongoing_promotions, $current_promotions );          // Get just the ID of promotions     $promotion_ids = wp_list_pluck( $all_promotions, 'ID' );     print_r($promotion_ids);          // Do a new query with these IDs to get a properly-sorted list of promotions     $args = array(       'post__in' => $promotion_ids,       'numberposts' => 5,       'post_status' => 'publish'     );     $wp_query= null;     $wp_query = new WP_Query();     $wp_query->query( $args );              $wp_query = new WP_Query($args);         if($wp_query->have_posts()){             while($wp_query->have_posts()){                 $wp_query->the_post();     ?>      Any help greatly appreciated.


TV Show database - Best way for structuring it?

I want to make a TV Show database in Wordpress that has this URL format:               /tvshows/friends/01/12/        * `/tvshows/` would list all series   * `/tvshows/friends/` would list all the seasons available for Friends TV Show   * `/tvshows/friends/01/` would list all episodes of Friends from season 1   * `/tvshows/friends/01/12/` would show information on the 12th episode of the first season And here are the different methods I've thought about: 1) The first idea that came to my mind is to create **Pages and nest them** accordingly. Then create 3 different page templates (TVShow.php, Season.php and Episode.php) and style each page accordingly. The main drawback is that once there are 200 series with 4 seasons and 25 episodes each (total of 20,000 pages) it can be a complete mess to update and find everything. (Another drawback is the RSS feed although this can be solved through plugins) ![TV SHows - Page-based](http://i.stack.imgur.com/r2QtU.png) 2) Some colleagues suggest me to use **Custom Posts** but these do not have a hierarchical structure and although I could then use mod_rewrite to make the URLs nice I guess it would be even more hassle than using Pages. (There's this plugin that manages custom posts through a UI although I cannot figure out how to create a hierarchical organization) 3) The last idea is to have them as **normal Posts** and then Categorize them by Serie name, season and episode hence avoiding all the custom post hassle and using simple Wordpress API functions to list and display everything. Those are the best/possible ways I can think of, the Page-based option may be the most suitable although scalable in a painful way once there are +500 pages. Any ideas, suggestions on how to organize this? Thanks in advance! :)


Change the format in the paginage_links

I have created a FAQs section on my site that it has been paginated with the paginated_links WP routine. I'm not sure what is the reason, but as soon as I want to change the format parameter from page to something different, at the time a page greater than 1 is hit, WP redirects the browser to the home page. This is the code I use                      if( get_query_var('p') ) {                 $current = get_query_var( 'p' );             } else {                 $current = 1;             }              $paginate_links = paginate_links( array(             'base'      => '%_%',             'mid_size'  => 5,             'format'    => '?p=%#%',             'current'   => $current,             'total'     => $total         ));


List all sidebars in metabox

I'm trying to add a metabox to select a sidebar per page. In order to create the metaboxes I use this class The construction is fairly easy:               $meta_boxes[] = array(         'id' => 'sidebars_side',         'title' => 'Page Sidebar',         'pages' => array('page', 'post'),         'context' => 'side',         'priority' => 'low',              'fields' => array(             array(                 'name' => 'Sidebars',                 'id' => 'tst_sidebars',                 'type' => 'select',                 'options' => array(                                           ARRAY OF SIDEBARS GOES HERE                      ),                 'multiple' => false,                  )         )     );      But I can't for the love of God to construct the array properly. I checked this post which is great, but I'm stuck somehow. Any help would be highly appreciated.


Which KSES should be used and when?

The WP source shows that `wp_filter_kses` and `wp_filter_post_kses` are passed data that's "expected to be escaped with slashes." On the other hand, `wp_kses_data` is passed data that's "expected to not be escaped" and `wp_kses_post` has code that looks like wp_kses_data. How safe is it to pass unknown (in terms of escaped with slashes) data to these functions? Can the first set be preferred over the second or is preferring the second set safer? Or is this a case where you absolutely need to know the condition of your data in terms of slashed? --update-- I'm now figuring that if you don't know whether the data is escaped you could use `wp_kses_data( stripslashes_deep( $data ) );` and run the return though addslashes() if you need escaped in the end.


Can WordPress email the admin about PHP errors, while hiding them from the site?

Is it possible to have WordPress email the site administrator whenever a PHP error message is displayed? Ideally the message would also be filtered out of the HTML output, so as to avoid information disclosure. I ask because, while `@ini_set('display_errors', 0);` is at the top of my `wp- config.php` and working nicely, I want to receive notifications about errors. I will happily write a custom plugin to do this, if someone who knows more about WP can point me in the direction of where I might hook in to get the job done. Final bit: Am I crazy for wanting something this out-of-the-ordinary?


Wordpress jQuery is not defined error

Hi I have just learned how to add jQuery to wordpress themes and it works but an error keeps appearing in the wordpress development tool.Here is the code that I posted:                   function register_js(){         if(!is_admin()){             wp_deregister_script('jquery');             wp_register_script('jquery' , 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js');             wp_register_script('quicksand', get_template_directory_uri() . '/js/quicksand.js', 'jquery');             wp_register_script('easing', get_template_directory_uri() . '/js/easing.js', 'jquery');             wp_register_script('custom', get_template_directory_uri() . '/js/main.js', 'jquery', '1.0', TRUE);             wp_register_script('prettyPhoto', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', 'jquery');                       wp_enqueue_script('jquery');             wp_enqueue_script('quicksand');             wp_enqueue_script('prettyPhoto');             wp_enqueue_script('easing');             wp_enqueue_script('custom');         }          }     add_action('wp_enqueue_scripts', 'register_js');      Not the this is that I used to get the error $ and jQuery is not defined.To solve the $ problem in my main js file I used this:               jQuery(document).ready(function($) {})      Now I am only getting this errors:               Error: ReferenceError: jQuery is not defined     Source File: http://localhost/wordpress/wp-content/themes/01MyWork/js/quicksand.js     Line: 307               Error: ReferenceError: jQuery is not defined     Source File: http://localhost/wordpress/wp-content/themes/01MyWork/js/easing.js     Line: 39          Error: ReferenceError: jQuery is not defined     Source File: http://localhost/wordpress/wp-content/themes/01MyWork/js/main.js     Line: 2      The scripts seem to work the only problem is that this error is being thrown for every script that I load.How can I solve this?


Adding Form Fields with Settings API

I'm making a plugin with an administration page witch uses the Settings API. I could make one section and one option. But how can I add other form fields to it? If I add an input tag to the callback function, it adds it to the same field. Does that mean that if I want to add another field, do I have to create another function? I think that's too much for saving one option value. So that must not be it. So could you modify this sample plugin, which is very simple, to add another form option? Also I'd like to add another section as well.               <?php     /*     Plugin Name: Settings API Demo     Description: Learning Setting Field and Settings Section     Author: Teno     */          add_action('admin_init', 'settingsapi_init');     function settingsapi_init(){         register_setting( 'settingsapi_optiongroupname', 'settingsapi_optionname');         add_settings_section('plugin_main', 'Section 1', 'settingsapi_sectiondescription', 'settingsapi_pageslug');         add_settings_field('plugin_text_string', 'Option A', 'settingsapi_setting_string', 'settingsapi_pageslug', 'plugin_main');         add_settings_field('plugin_text_string', 'Option B', 'settingsapi_setting_string', 'settingsapi_pageslug', 'plugin_main');     }          function settingsapi_sectiondescription() {         echo '
This is a section description.
';     }     function settingsapi_setting_string() {         $options = get_option('settingsapi_optionname');         echo "<input id='plugin_text_string' name='settingsapi_optionname[option_a]' size='40' type='text' value='{$options['option_a']}' />";         // echo "<input id='plugin_text_string' name='settingsapi_optionname[option_b]' size='40' type='text' value='{$options['option_b']}' />"; // <-- this is not what I want.      }           // admin menu     add_action('admin_menu', 'plugin_admin_add_page');     function plugin_admin_add_page() {         add_options_page('Custom Plugin Page', 'Demo Settings API Menu', 'manage_options', 'settingsapi_pageslug', 'settingsapi_adminpage');     }          function settingsapi_adminpage() {         ?>

Demo Plugin for Settings API
             <form action="options.php" method="post">                 <?php settings_fields('settingsapi_optiongroupname'); ?>                 <?php do_settings_sections('settingsapi_pageslug'); ?>                 <?php submit_button(); ?>             </form>
         <?php     }     ?>


custom single.php post showing up twice

EDIT: I am still having this issue which is driving me mad - can any help me please? Thanks! I have a custom single-blog.php that has a custom yet basic feed. Here is the code:

Blog

Home / Blog

             <?php if (have_posts()) : while (have_posts()) : the_post(); ?>              <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<?php the_title(); ?>
                  <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
                      <?php the_content(); ?>                      <?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>                      <?php the_tags( 'Tags: ', ', ', ''); ?>
                  <?php edit_post_link('Edit this entry','','.'); ?>
          <?php endwhile; endif; ?>

          <?php get_sidebar(); ?>

          <?php get_footer(); ?>      For some odd reason it shows the same single post twice? Anyone run into this issue before? Thanks, Ben. This is the meta code:
             Posted on: <?php the_time('F jS, Y') ?>         by <?php the_author() ?>          <?php comments_popup_link('No Comments', '1 Comment', '% Comments', 'comments-link', ''); ?>


What is this format called (nested shortcodes)?

When using plugins and commercial themes in WordPress, it's not uncommon to meet code like this:               [one_half]         [service_box]
Title:

blah...

blah...

blah...

         [/service_box]     [/one_half]     [one_half_last]          Something more irrelevant here     [/one_half_last]      Does this thing have a name in the WordPress jargon?


pre_get_post filter returns results when there should not be

I am trying to filter a CPT by an array of post ids using pre_get_post filter within my plugin. Everything works fine when there are post that match the ids, but when there are no post that match the ids I am getting all the post within the CPT that I am trying to filter in return. What I need id there are not post ids found (or post from the post ids) is the archive page to display the normal 'no results found'. This is a run down of my script...               add_action('pre_get_posts', array(__CLASS__, 'get_posts')); //run inside a class     function get_posts($wp_query) {                  if ($wp_query->is_main_query() && !is_admin() && is_post_type_archive(MbeEnrollments::MBE_POST_TYPE_NAME) && $wp_query->query_vars['list-view'] == 'list-view') {                //For the purpose of this sample I removed the script in the section that produces the CPT post ids that I am trying to return. This portion works fine and as expected.                      //if post ids are found                  if ($post_ids) {                          $wp_query->set('post__in', $post_ids);                      }                 return;                       }                   }      I assume the issue is that the CPT archive page will run as normal if my `if($post_ids)` clause return false. However, I am trying to find a way to make it return with no results. Thanks in advance for any help. UPDATE: If I include a post id that I know does not exist within the CPT I get the desired 'No Results Found'. Even though this works it seems a little bit like a hack and there has to be a cleaner way. Any ideas? Here is the if that works....                           if ($post_ids) {                           $wp_query->set('post__in', $post_ids);                      }else{//if no post ids then pass in a fake post id to get the 'no results found'                          $wp_query->set('post__in', array(0));                      }                 return;


User registration on subsite in multisite configuration

As a network admin in multisite configuration, I have the option to enable or disable the user registration \ site registration. is there any way i can enable the user registration on s single sub site , not on all sites. In my WP setup, I have a main blog which is managed by me and I dont want user to register here. i have a another blog installed on sub directory dedicated for forum. I would like to enable user registration here, so that user can use the forum


Add a popup message on frontend?

I want to show a box or a widget with HTML content at the bottom of a page to show the reader a message s/he can dismiss. Here is an example: ![enter image description here](http://i.stack.imgur.com/6Flmt.jpg) Can one of the built-in JavaScript libraries be used for that? Should I use a widget or something else? What is the WordPress way to implement that?


Modify this loop to fit my jQuery slider (slides)

I´m trying to make a slider which takes thumbnails from a certain custom post type and displays for of them for each "slide". I get the slider and thumbnails to work like they should, but I´m unsure of how I should modify the loop to get it to display 4 posts in a container, then repeat with the next 4 posts and so on. My loop looks like this:

                  <?php $loop = new WP_Query(array('post_type' => 'fastighet', 'posts_per_page' => -1, 'orderby'=> 'ASC')); ?>             <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
                     <?php $url = get_post_meta($post->ID, "url", true);                     if($url!='') {                         echo '';                         echo the_post_thumbnail('admin-list-thumb');                         echo '';                     } else {                         echo the_post_thumbnail('admin-list-thumb');                     } ?>

<?php the_title(); ?>

                  <?php endwhile; ?>             <?php wp_reset_query(); ?>
               prev         next
       Every div with the class of slide becomes a slide as you can see. But how can I make it put 4 posts into each such slide, then 4 post more into another slide etc. Any help or tips would be really appreciated!


Running a loop with a custom query string on a custom page template

I made a custom page with a template that is just a loop with custom query string for a list of posts from a specific category but when I view the page it only shows one post with the title being the title of the page. I don't understand why it doesn't return the loop of posts. What am I doing wrong? Heres the page template.               <?php       /*       Template Name: music videos       */     ?>

         <?php          global $query_string;          query_posts($query_string .'&posts_per_page=10&cat=3&orderby=asc'); ?>          <?php $i=0; while (have_posts()) : the_post(); $i++; ?>
           <a style="display:block;height:100%" href="<?php the_permalink() ?>"  rel="bookmark" title="<?php _e( 'Permanent Link to', 'buddypress' ) ?> <?php the_title_attribute(); ?>">                <?php                   foreach((get_the_category()) as $category) {                   echo "
slug' style='margin-right:4px;position:absolute;right:0;display:block' title='$category->cat_name'>
";                  }                ?>                                                                 <?php $video_code = tube_getcustomfield('video_code',get_the_ID()); if($video_code) { ?>                     <img src="<?php $thumb = get_youtube_screen_link( $video_code, 'default' ) ?>" width="120" height="90" />                    <?php } else { ?>                     <?php echo_first_image ($post->ID); ?>                    <?php } ?>

<?php the_title(); ?>

<?php echo time_ago(); ?><?php _e( ' in', 'buddypress' ) ?> <?php $category = get_the_category(); echo $category[0]->cat_name; ?>
                     <?php if(function_exists('the_views')) {  ?>
<?php the_views(); ?>
<?php } ?>

                                                  <?php if($i%1==0) : ?>

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


Remove custom metaboxes from custom post type

Is there a away to create a custom post type in wordpress that will only include the default metaboxes and not any other metabox that was added by other plugins. The idea is to use the custom post to develop a plugin, this plugin will need to have all the functions custom post type but with all the metaboxes that plugin add like all-in-seo. I want to create a clean interface for the user and those extra metaboxes are in the way :-)


Retrieving custom field array value through db query

I'm trying to query the database for posts based on multiple custom fields. This is easy enough with the code below if values are simple:                $querydetails = "            SELECT wposts.*            FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta            WHERE wposts.ID = wpostmeta.post_id            AND wpostmeta.meta_key = 'field'            AND wpostmeta.meta_value = 'value'            AND wposts.post_status = 'publish'          ";      But how do I query a value that is stored in array form, like a:1:{i:0;s:8:"value";} ?


How to place the captcha just below the comments text area

Hi I am new to word press. I have downloaded bot detect captcha. It is working finely. The only problem is that the captcha appears above the comments text area. I need it to appaear just below the comments text area and just above the post comment button.How can I do it?? Please help me..


Showing Subcategory Name/Link Instead of Parent Category

right now this code is showing an article's subcategories if it has one. But it's also showing the parent category too (so both the parent category and child categories show up simultaneously). Is there a way to modify this code so that if an article is in a subcategory, it only shows those subcategories and hides the parent category? And if it's only in a parent category, it shows the parent category? Thank you!                   <?php $category_separator = "";     foreach((get_the_category()) as $childcat) {          $parentcat = $childcat->term_id;          if( $parentcat != 0 ) echo '' .get_cat_name($parentcat) .'';          else echo '' . $category_separator . 'cat_name .'">' . $childcat->cat_name . '';         $category_separator = " / ";     }     ?>


How to get specific post meta by title or id

I have register bellow custom post type in function.php and I am using `Advanced Custom Fields`. Using advance custom field type I have added one `image` field and assigned to my `Release` custom post type. Now I have added one post inside Release post type. I have fill this details in this post. **Title:** Speak Now (Deluxe Edition)   **Image:** Added some Image Now I want to retrieve meta data with specific post by title/id. I have tried this code but not working:               $my_post_meta = get_post_meta(556, 'album_image', true);         if ( ! empty ( $my_post_meta ) ) {             get_field('album_image');         }      **My custom post type:**               /**      * Music/Releases      *      */     function codex_custom_init5() {       $labels = array(         'name'               => 'Releases',         'singular_name'      => 'Release',         'add_new'            => 'Add New',         'add_new_item'       => 'Add New Release',         'edit_item'          => 'Edit Release',         'new_item'           => 'New Release',         'all_items'          => 'All Releases',         'view_item'          => 'View Release',         'search_items'       => 'Search Releases',         'not_found'          => 'No release found',         'not_found_in_trash' => 'No release found in Trash',         'parent_item_colon'  => '',         'menu_name'          => 'Release'       );            $args = array(         'labels'             => $labels,         'public'             => true,         'publicly_queryable' => true,         'show_ui'            => true,         'show_in_menu'       => true,         'query_var'          => true,         'rewrite'            => array( 'slug' => 'release' ),         'capability_type'    => 'post',         'has_archive'        => true,         'hierarchical'       => false,         'menu_position'      => null,         'supports'           => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )       );            register_post_type( 'release', $args );     }     add_action( 'init', 'codex_custom_init5' );      ![My Post Type](http://i.stack.imgur.com/t093l.jpg)


How to make theme elements customizable in wordpress?

In Wordpress there's a menu option called 'Appeareances'. I want to add (e.g.) a submenu 'header' there and then be able to customize the header from within wordpress (administration page). From what I understood I have to have a 'functions.php' file in my theme folder. In the 'functions.php' file I write something like this:               <?php add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function); ?>      Of course with adapted arguments (which I'm not entirely sure what those should be since I feel quite lost in all this).


Wordpress Multisite allow site admin to add user without email confirmation

In Wordpress Multisite,a site admin (not a super admin) doesn't have the option “Add the user without sending them a confirmation email” when adding a new user. Is there a way to bypass the confirmation email or to add this option also for site admin ? Many thanks


Copy and Paste Password for Comments

One of my newer clients has an extensive WordPress blog (on SE I am a Joomla man) and I am sure there must be some reason behind this. **For comments it asks you to copy a password - and then paste it!** I can't not figure out if this is a feature of WordPress which is being misused (obviously not meant to be) or a rouge web designer who has simple created something very odd indeed. Although the client is fairly well clued up there is no explanation for this from his end other than "don't know". ![enter image description here](http://i.stack.imgur.com/HiMQC.jpg) Edit: Is this a incredibly poorly thought out Capatcha alternative?


Is this hook really deprecated? ( manage_{$taxonomy}_custom_column )

I've been adding some data to the columns of two taxonomies in a theme I'm working on. I've hit something that's got me confused though.   I'm using this hook `manage_{$taxonomy}_custom_column` but the Adam Brown page on the hook says it's no longer in use. When using the hook I get no errors, so can this be true? I can't seem to find a replacement either. How can I tell if my hook, or any other hook, is deprecated?


How can I modify the loop from a plugin without wiping out other filters?

I am trying to modify `the_loop` output from a plugin. I've looked into `pre_get_posts`, which definitely works, but I need to filter the loop by a custom taxonomy. I can do this with `$query->set('tax_query',$my_tax_new_query)`, but the problem is this overrides any previous taxonomy queries that may have been set. It applies my query **INSTEAD** of the former query instead of **IN ADDITION TO IT**. How can I apply an additional taxonomy filter to the loop without wiping out the previous query? EDIT: For example:               function myplugin_filter_the_loop($query) {              $taxonomy = 'hobbies';         $exclude_terms = array('biking','swimming','horsebackriding');              $query->set('tax_query',$exclude_terms)          }     add_filter('pre_get_posts','myplugin_filter_the_loop');      This works, but it will REPLACE any previously defined `tax_query` on the loop. EDIT2: Alternative using `posts_where`:               function myplugin_filter_the_loop($where) {              $relationship_ids = array(97,98,99);              foreach ( $relationship_ids as $id ) :                  $where .= " AND ( wp_posts.ID NOT IN ( SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id IN ($id)"              endforeach;          }     add_filter('posts_where','myplugin_filter_the_loop');      For this to work, I'd just need to get the corresponding relationship id by term_id or slug, etc.


Wp-login appears White Screen, Error: Cannot modify header information

Possibly duplicate of many Question, the reason I am posting here none of them helps, here is the log which appear on Wp-login.php page.               Notice: automatic_feed_links is deprecated since version 3.0! Use add_theme_support( 'automatic-feed-links' ) instead. in /home/truckgua/public_html/test2/wp-includes/functions.php on line 2871          Notice: wp_deregister_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /home/truckgua/public_html/test2/wp-includes/functions.php on line 3012          Warning: Cannot modify header information - headers already sent by (output started at /home/truckgua/public_html/test2/wp-includes/functions.php:2871) in /home/truckgua/public_html/test2/wp-login.php on line 384          Warning: Cannot modify header information - headers already sent by (output started at /home/truckgua/public_html/test2/wp-includes/functions.php:2871) in /home/truckgua/public_html/test2/wp-login.php on line 396          Warning: Cannot modify header information - headers already sent by (output started at /home/truckgua/public_html/test2/wp-includes/functions.php:2871) in /home/truckgua/public_html/test2/wp-includes/pluggable.php on line 678          Warning: Cannot modify header information - headers already sent by (output started at /home/truckgua/public_html/test2/wp-includes/functions.php:2871) in /home/truckgua/public_html/test2/wp-includes/pluggable.php on line 679          Warning: Cannot modify header information - headers already sent by (output started at /home/truckgua/public_html/test2/wp-includes/functions.php:2871) in /home/truckgua/public_html/test2/wp-includes/pluggable.php on line 680          Warning: Cannot modify header information - headers already sent by (output started at /home/truckgua/public_html/test2/wp-includes/functions.php:2871) in /home/truckgua/public_html/test2/wp-includes/pluggable.php on line 875      **I am getting same thing on WP version 3.6 and WP version 3.7.1** Now Here is what I have already did to make it work:   1. Disabling plugin from FTP   2. Switching theme by renaming the selected theme folder   3. Checking for Space after and before,    4. Replacing WP files with fresh download **One more thing is this website developed on Windows Server and now Moving on Linux Server.**


Disabled plugins are the security holes - rumor or reality?

I've read many WordPress Security blog articles, where the Security Experts're recommending some special matters to take care when somebody is concern about his/her WordPress site's security. Among them one is: WordPress Security Tips:   **Remove unnecessary plugins, that are not in use** A plugin that has security holes, whether by code or structures or db connections, can be fatal for a site even it's activated into a site - on the other hand, a well structured, well coded, securely db-connected plugin may not have a security hole even it's deactivated. So where the issue exactly is? I've a site, where there are some plugins, I use them occasionally. I actually don't want to delete them, but when they are not needed, I just deactivate them from the site. Do I need to delete them to secure my site? **...WHY?**


Get all custom post types excepted some...

I stack since a few hours now and I'm sure that this is not so complicated. I would like to get all custom post types into this               $posts = query_posts( $query_string.'post_type=POST-TYPE1,POST-TYPE2,POST-TYPE3&post_status=publish&posts_per_page=-1&' );      I know that there is this function: `$post_types=get_post_types('','names');` And I have some Post Types which I want to exclude. E.g. "Portfolio". So how is it possible to get the `$posts` looking for all important Types?! Thanks a lot !! Philipp


Custom template redirect based on url vars

I am using a custom URL on my menu to show the most viewed posts by passing the variables to the url as http://website.com/?v_sortby=views&v_orderby=desc However I want to use a custom template to display the results. I tried the following but it doest work. I am having trouble finding a fix, can anyone help.               function custom_template($template) {       global $wp;       if ($wp->query_vars['template']=='basic') {         return dirname( __FILE__ ) . '/basic.php';       }       else {         return $template;       }     }     add_filter('template_redirect', 'custom_template');


How to check current URL for endpoint in a template file?

What's the best way to check current url for endpoint in a template file? I have a plugin that creates endpoints in **author.php**... so now i'm trying to check in **author.php** so that only certain code is executed if the URL ends in a specific endpoint? `example.com/author/username/endpointA` `example.com/author/username/endpointB` The idea is that each endpoint has different content. Thank you!


Weird Symbols in Chrome (wordpress)

I was changing a few lines of php and jquery code and this happened in my wordpress website: Image The weirdest part is that i changed everything back and this still happens and also if you view the website in firefox it will be perfecly fine. I have no idea what is wrong. I did not install any new plugins.


Get link for feed of specific post type AND taxonomy

I am able to get a specific post type with `http://www.mywebsite.com/feed/?post_type=post-slug&topic=accountable-care- organizations`, but when I try `http://www.mywebsite.com/feed/?post_type=post- slug&topic=term-slug` (topic being slug of taxonomy), the results do not change. Is it possible to generate a feed with multiple parameters like this?


how to separate array with commas?

Let's say that i have this array: Array ( [0] => 13 [1] => 7 ) And this array is for example "print by `<?php print_r($_categories); ?>` but now, how to make a array implode to this format: 13,7 (without comma after the last value) Thanks, nelson


URL rewrite function and pagination with year in the url

**UPDATE** No more 404 errors. Part of the problem was I using a reserved variable (year, doh!) so i changed a couple of things around and i have this almost fully working. I've made very good progress since my last comment. I changed how I was sending the year to the page. Now my URLs in the menu are using a query string and they look like this: > domain.com/our-company/newsroom/?articleyear=2014 And if I use the pagination at the bottom of the news page the URLs look like this: > domain.com/our-company/newsroom/page/2/?articleyear=2013 I would love to change the url structure to something more like this: > domain.com/our-company/newsroom/2013/page/2/ OR > domain.com/our-company/newsroom/articleyear/2013/page/2/ Whichever makes the most sense based on my url structure. Is there a rewrite rule I can use to make Wordpress understand the order I want the numbers to occur and have the article year right after /newsroom/ and the pagination occur at the very end? I haven't written too many rewrite_rules, so a little assist with that would mucho helpful. Am i thinking of this the right way?


Wordpress check if user is logged in from non wordpress page

I am using wordpress and I normally use:               if (!is_user_logged_in()){        //something here     }      to detect if the wordpress user is logged in or now. My problem is that I need to detect if the user is logged in to wordpress from a non-wordpress page. My page is in the same directory as the other wordpress pages but is not page of wordpress. How can I detect this from my page?


Show author archive pages for authors with no posts

I have one page for each author, but if the author doesn't have any posts I can't get its variables, because the loop is empty. The page returns empty, no avatar, no info and stuff, the whole site is empty. How do I get WordPress to pull out the author variable if there are no posts (what makes no author, but i am on the authors page)..? I'm using twentyeleven as parent theme.


Run function at specific time

I have a WordPress function that I want to run once daily at a specific time. How should I go about doing this, since WP cron cannot be set to a particular time?


How to move core js files into the footer

while testing for page speed, i found 2 js files that causes the speed delay, according to PageSpeed Insight. files names are   1. /wp-includes/js/swfobject.js   2. /wp-includes/js/comment-reply.min.js how can i moved these files into the footer, currently both files are loading in header.


Get sub categories and posts with the same parent category

I want to fetch all posts in category 1, then fetch all sub-categories in category 1, then merge the results into one array. Is that possible?


bp_has_members with custom fields

I want to loop members where profile custom fields has a condition, let me explain, I have latitude and longitude as custom fields on members buddypress site, and I need to loop just members who has set latitude and longitude, using bp_has_member               if ( bp_has_members( 'per_page=0' ) ) : ?>     endif;      I have tried with ( "Dirección" is my custom xprofile that I am using in order to filter member with no address ) however that doesn't work, or something is wrong.               bp_has_members( 'per_page=0&meta_key=Dirección&meta_value!=\'\'' )      I have been trying on many ways without any result


Error 404 - Wordpress adds my domain name to the end of URL

I really hope someone can help me with these 404 errors. The URLs with 404 errors show the domain name of my website at the end like this: `http://www.msfullhair.com/hair-growth-products/msfullhair.com` `http://www.msfullhair.com/category/msfullhair.com` Does anyone know how I can fix this issue?


How to deal with multiple select options using register_setting() theme options

I'm using Ian Stewart's Sample Theme Options for a lightweight Theme Options panel. ### INSERTION FAILED I need to insert Multiple categories into db, where I used the following code:               <select multiple="multiple" name="site_options[categorychoice]">        <?php        $args = array(             'orderby' => 'name',             'parent' => 0,             'exclude' => 1          );        $categories = get_categories( $args );        foreach ($categories as $category) { ?>             <option value="<?php echo $category->term_id; ?>" style="padding-right: 10px;" <?php selected( $site_options['categorychoice'], $category->term_id ); ?> ><?php echo $category->cat_name . ' (' . $category->category_count .')'; ?></option>        <?php }  ?>     </select>      On the validation portion of the code:               function theme_options_validate( $input ) {        $got_categories = array( $input['categorychoice'] );     }      It is inserting data into Options table, but not multiple, it's inserting the last selection only. So what I got is: `'categorychoice' => string '5' (length=1)` -- only a single value among all, and the that's the last cat_id among the selected. ### SELECTED=SELECTED FAILED I'm also failing to make the value selected, when that matches the data with the db. I tried my code with This WPSE solution, but failed:               foreach ($categories as $category) { ?>          <?php $selected = in_array( $category->cat_ID, $selected ) ? ' selected="selected" ' : '' ?>          <option value="<?php echo $category->term_id; ?>" style="padding-right: 10px;" <?php echo $selected; ?> ><?php echo $category->cat_name . ' (' . $category->category_count .')'; ?></option>     <?php } ?>


Gravity Custom Merge Tags

I created some custom profile fields following the advice of Thomas Griffin and Stephanie Leary. Like so:               function change_contactmethod( $contactmethods ) {       // Add some fields       $contactmethods['twitter'] = 'Twitter Name (no @)';       $contactmethods['phone'] = 'Phone Number';       $contactmethods['title'] = 'Title';       // Remove AIM, Yahoo IM, Google Talk/Jabber       unset($contactmethods['aim']);       unset($contactmethods['yim']);       unset($contactmethods['jabber']);       // make it go!       return $contactmethods;     }     add_filter('user_contactmethods','change_contactmethod',10,1);      I want to create a custom merge tag for Gravity Forms to output by user's phone number (`$contactmethods['phone']`). I can retrieve this info two different ways: Way 1:               function phone() {         $userid = get_current_user_id();         $user_info = get_userdata($userid);         return get_user_meta($userid, 'phone', true);     }      or Way 2:               function phone() {         echo the_author_meta('phone', $current_author->ID);     }      I can even create a `[phone]` shortcode by adding:               add_shortcode('phone', 'phone');      When I try to add my `[phone]` shortcode as a default input value in Gravity Forms, it does not process the shortcode. Gravity has these things called short tags, which I thought from the documentation on Gravity that `{user:[meta_key]}` could work as `{user:phone}`, but I have not set this up as a merge tag yet. I'm not too familiar with JavaScript and what I am doing to set up this merge tag is not working:               add_action("gform_admin_pre_render", "add_merge_tags");     function add_merge_tags($form){         $mergeTags["phone"] = the_author_meta('phone', $current_author->ID);     ?>     <script type="text/javascript">         gform.addFilter("gform_merge_tags", "add_merge_tags");         function add_merge_tags(mergeTags, elementId, hideAllFields, excludeFieldTypes, isPrepop, option){             mergeTags["phone"].tags.push({ tag: '{phone}', label: 'Phone' });                  return mergeTags;         }     </script>     <?php         //return the form object from the php hook           return $form;     }      How to create a custom merge tag for an added custom meta field? Or how to allow my field inputs to read my `[phone]` shortcode?


Including php file in directory above WordPress installation

I'm having trouble including an external .php file into my WordPress theme. **WordPress installation URL:** mydomainname.com/blog **PHP File URL:** mydomainname.com/testing/assets/inc/analytics.php I'm trying to include this PHP file from within header.php of my WordPress theme. My line of code looks like this:               <?php include ( site_url() . '/testing/assets/inc/analytics.php' );  ?>      I've also tried variations of `PATH` and `ABSPATH` but I can't get it to work. Interestingly, when I change the `include` to `require_once` it breaks the site. Please help me figure out what exactly I'm doing wrong. Thank you!


Problem with add_rewrite_rule and pagination (paged and page query_vars)

I have a custom taxonomy named `location` and I want to add sections like 'news' and 'marketplace' for each term, so my url looks like `/location/montreal/news/` It works perfectly until I try to add pagination. Here is my code :               add_action( 'init', 'region_rewrite' );     function region_rewrite()     {         global $wp;         $wp->add_query_var( 'section' );              add_rewrite_rule(           '^location/([^/]*)/([^/]*)/page/([0-9]+)/?',           'index.php?location=$matches[1]&section=$matches[2]&paged=$matches[3]',           'top'         );         add_rewrite_rule(           '^location/([^/]*)/([^/]*)/?',           'index.php?location=$matches[1]&section=$matches[2]',           'top'         );     }      I'm using the Rewrite analyser plugin and it seems that the query_vars location, section and paged are assigned with the right value. However, I get a 404 error when trying to access a page url like `/location/montreal/news/page/2`. I also noticed that the the `page` variable has the value `/2`. Is it possible that this is why I'm getting a 404 not found ? Any help would be greatly appreciated!


Gravity Forms Update post meta from template

I created a form called 'Books' which has the fields:   * Title (Post Title)   * Author   * Genre (Dropdown - fantasy, horror, drama... etc)   * ISBN Number   * Status (Dropdown - Default Option - Published, additional option - Promoted) This form creates and populates a custom post type called books, which has the custom meta fields:   * Author   * Genre   * ISBN Number   * Status   * Promoter I have a second form called 'Promoter' which show up in my single-books.php template file in my wordpress theme. The form shows up on the bottom of the page if the status is "Published" with the single text field for a person to enter their name for support and change the status from published to promoted. I spent a lot of time on the gravity forums site looking for an answer, and I came up with:               add_action("gform_post_submission_5", "books_promoter", 10, 4);     function books_promoter($entry, $form) {             global $post;             global $wp_query;                  $post_id = get_the_ID(); // $entry['post_id'];                  $post_data['status'] = get_post_meta($postID,'status', true);             $post_data['promoter'] = get_post_meta($postID,'promoter', true);                  $status = $entry['5'];             $promoter = $entry['6'];                  update_post_meta($post_id, 'books_status', $status );             update_post_meta($post_id, 'books_promoter', $promoter );     }      This function gets the post ID and blank post meta field and then updates the post meta. For some reason though it does not work. I think it might be with the $post_id inside the template file loop, but I was wondering if anyone had any opinions on a better way to do this.


Pitfalls when Distributing Plugins that Access SOAP Web Services?

I'm wondering **what pitfalls** _(if any?)_ developers here have run into **when distributing WordPress plugins** via the WordPress plugin repository **that embed a SOAP client** for accessing SOAP web services for critical plugin features _(or any plugin distributed widely via any other repository, for that matter.)_ _(It is my assumption that a company publishing plugins would be much better off to developRESTful web services but I am wanting to validate this opinion by surveying the opinions of others here. Note that I asked our very own @EAMann a related question on Namesake.com.)_ I'm making this a community wiki so we can capture all thoughts on the subject.


Apply a tag to every images 'Link Rel'

Building my first site. Running v3.1.1 with the Boldy theme from Site5. Boldy makes use of prettyPhoto Lightbox. If you refer to the instructions for setting up Boldy (bottom of page) > For adding Lightbox behaviour to a link just add rel="prettyPhoto" to the > image Link Rel ![enter image description > here](http://i.stack.imgur.com/QP3fJ.png) I have just imported about 100 blog posts from Wordpress.com. 2 questions (although very related:   1. How do I batch update all previous pictures to load by default with the prettyPhoto i.e. Apply a 'prettyphoto' tag to each pictures rel.   2. I have about 15 authors for the blog. I know they will forget to manually set this prettyPhoto tag = Is there a way to make it default to this?


What is the most efficient method for loading widgets in functions.php

I have seen WordPress developers use two different methods for loading custom widgets from the functions.php file. The first:               include("functions/my-custom-widget.php");      The second:               require_once(dirname(__FILE__) . "/functions/my-custom-widget.php");      Which one of these methods is more efficient. I'm particularly interested in performance if there is a difference at all. Does the require_once follow better 'best practices' ? I'm sure there are plenty of other ways of doing this. If anyone has a better recommendation I would love to hear it. Thanks.


Embedding a SOAP Client into a WordPress Plugin?

What is the **best way to embed a SOAP client into a WordPress plugin** that one would distribute via the WordPress plugin repository? Is it best to use?   * The **PHP 5.x Soap Client**,    * The **Zend Soap Client**,    * The **NuSoap Toolkit for PHP**,    * The **PEAR SOAP Client/Server for PHP**, or   * Some **other SOAP client for PHP**? What's more, why recommend the one you do? And what are the pros and cons of each. _"Bonus (karma) points"_ if you have actual experiences with using a SOAP client in widely a distributed plugin. And are there any differences between calling a .NET SOAP server, a Java SOAP server, or some other SOAP server stack? Note this is a related question to the question _"Pitfalls when Distributing Plugins that Access SOAP Web Services?"_ and I'm also making this a a community wiki. ### Update Here are some potentially helpful links for others researching this same question:   * Make a SOAP client using PHP and NuSoap.   * Soap Client calling .NET Web service   * Using SOAP with PHP _(on Apple.com)_   * PHP & Web Services   * Programming with NuSOAP Using WSDL   * Using Amazon Web Services With PHP And SOAP   * The simplest PHP Web Service Client   * Developing SOAP Web Services with PHP/C#   * A PHP Web Services Client


Now can I group custom post types together?

Now that wordpress 3.1 is out, where is the documentation for grouping custom post types together in the wp backend?


My plugin creates custom widgets, How can I programatically add them to existing sidebar widget areas?

OK, I can create the code to add custom widgets to the widgets manager. Check. My next challenge is to, in the same plugin, during activation, check for the existence of my theme, and if active, pre-populate the widget areas with the custom widgets I've just created. I hope this makes sense. If I can do this, it will save a ton of time from configuring (and explaining how to configure) my default theme setup, which relies heavily on custom widgets. Things like an optin email form, custom slider widget, etc... Thanks in advance if anyone can help me here. Here are my theme's default sidebars...               if ( function_exists('register_sidebar') )         register_sidebar(array(             'name' => 'Home Sidebar',             'id' => 'home-sidebar-widget',         ));          if ( function_exists('register_sidebar') )         register_sidebar(array(             'name' => 'Home Header Area',             'id' => 'home-header-widget',         ));          if ( function_exists('register_sidebar') )         register_sidebar(array(             'name' => 'Inside Header Area',             'id' => 'inside-header-widget',         ));          if ( function_exists('register_sidebar') )         register_sidebar(array(             'name' => 'Home Footer Area',             'id' => 'home-footer-widget',         ));          if ( function_exists('register_sidebar') )         register_sidebar(array(             'name' => 'Inside Footer Area',             'id' => 'inside-footer-widget',         ));          if ( function_exists('register_sidebar') )         register_sidebar(array(             'name' => 'Inside Sidebar',             'id' => 'inside-sidebar-widget',         ));


Using the Importer on an IIS Server

I'm running into an issue for a client whereby I keep getting the same error over and over again whilst trying to import an exported file (into an IIS environment):               Sorry, there has been an error. The uploaded file could not be moved to D:\www\www514\obtecfoundcom/wp-content/uploads/2011/04.      Anybody know what might be going on here (besides the weird slashes)? Thank you! Noel **Technical Info** http://wl17www502.webland.ch/php5/info.php **Attempts so far** Googled the hell out of the error, nothing with a real solution. Permissions changed to 777 all the way up to /wp-content/ (recursive) Manually adding the file to ../2011/04


How to query children by post name/slug

It appears that I can only use an ID for the param `post_parent` whether in `WP_Query` or `get_children` Is there a way to query for children via postnames which are more readable.


Problem with the position of SyntaxHighlighter Evolved javascript

Hello i use SyntaxHighlighter Evolved (http://wordpress.org/plugins/syntaxhighlighter/description) and it's load their script after `</html>` tag. i want to put the script of this plugin before the ` </html> ` tag in pages. you can see this issue online here. http://rokesh.ir/tutorial-adding-sharing- buttons-on-social-networks-to-wordpress-contents


Calendar for irregular recurring events

I have a custom post type Event with multiple start and end dates for each Event. What I need then is a calendar similar to the calendar widget with links to these events. I need multiple multi day timespans that are not recurring regularly. The problem is that all plugins I could find only offer parts of the solution for me:   * Events that only recur in regular intervals   * Events that only offer one timespan for each event, forcing me to duplicate it for other dates of the same event. Is this such a weird problem that no plugin exists for this?


Change Permalink to Value of Custom Field

I modified this code to use for a basic useful link library, I found the code at http://stackoverflow.com/questions/8643508/how-to-group-articles-by- tags/8645453#8645453.               <?php     $args = array(         'orderby'       => 'name',         'order'         => 'ASC',         'hide_empty'    => 1,         'taxonomy'      => 'useful_link_categories',      );     foreach (get_categories($args) as $tax) :         $args = array(             'post_type'         => 'useful-links',             'posts_per_page'    => -1,             'orderby'           => 'title',             'orderby'           => 'ASC',             'tax_query' => array(                 array(                     'taxonomy'  => 'useful_link_categories',                      'field'     => 'slug',                     'terms'     => $tax->slug                 )             )         );            if (get_posts($args)) :     ?>
<?php echo $tax->name; ?>

            <?php foreach(get_posts($args) as $useful_link_post ): ?>
<a href="<?php get_field('url'); ?>" target="_blank" title="Click here to read more"><?php echo $useful_link_post->post_title; ?>
             <?php endforeach; ?>
      <?php              endif;      endforeach; ?>       Instead of having this line:
<a href="<?php echo get_permalink($p); ?>"><?php echo $p->post_title; ?>
      to link the title to the post's permalink, I want to query the advanced custom field('url') that I added to the custom post type called 'useful-links.' I tried this:
<a href="<?php get_field('url'); ?>" target="_blank" title="Click here to read more"><?php echo $useful_link_post->post_title; ?>
      Of course, it doesn't work, I have missed a lot of important snippets there. It links the post's permalink instead. I am kind of new to the backend development of WordPress, any helps would be appreciated. Thank you. -Boolie


Loop to fetch 3 post_thumbnail instances from 3 most recent custom post types named "portfolio"

I am trying to display 3 post_thumbnails from a custom post type "portfolio" on my homepage template. So one from post 'A' , one from post 'B' and one from post 'C' The image from post A will be set as post_thumbnail('large') while B & C need to be set to post_thumbnail('thumbnail'). I've set a custom WP_Query loop and as expected it is looping through and fetching three instances of the post thumbnail for each of the most recent three "portfolio" posts. I'm just not sure how to modify the loop to only display three images not three sets of three images. Any help much appreciated. Here's my code:                   <?php get_header(); ?>
          <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?>       role="article">

Recent Work

Intro Lorem ipsum

               <?php $first_query = new WP_Query('post_type=portfolio');   while($first_query->have_posts()) : $first_query->the_post(); ?>
                                  <?php the_post_thumbnail('medium'); ?>

                                   <?php the_post_thumbnail('thumbnail'); ?>                                                     <?php the_post_thumbnail('thumbnail'); ?>


Querying Custom Post Type, ordering by Custom Taxonomy Pagination Not Working

Maybe there's a better way to do this. Let me explain what I have right now: I have a custom post type (Products), and a custom taxonomy (Manufacturers). What I have outputting so far:               Manufacturer Name 1     Product 1     Product 2     Product 3          Manufacturer Name 2     Product 1     Product 2     Product 3      This is great, except pagination is being ignored. All 20+ products are being listed, BUT the page links are working. My code:
         <?php              $categories = get_terms('manufacturer');              foreach($categories as $category) : ?>

<?php echo $category->name; ?>

              <?php         $posts = get_posts(array(             'post_type' => 'product',             'taxonomy' => $category->taxonomy,             'term' => $category->slug,             'posts_per_page' => 10,         ));             foreach($posts as $post):             setup_postdata($post); ?>

<a href="<?php the_permalink(); ?>">                         <?php echo $category->name.' - '.get_the_title(); ?>

<?php echo wp_trim_words( get_the_content(), 35 ); ?> <a href="<?php the_permalink(); ?>">Read More

         <?php endforeach; ?>     <?php endforeach; ?>
      I've been staring at this code for too long, and trying different solutions. Any tips?


problem with WP-Post Ratings meta content

i use WP-Post Ratings for my site and all thing are good but i have only one major problem with this plugin. i use easy digital downloads plugin too. and I'm disable the default post type of this plugin because i want to use single.php for sell products.and also i use the blew code in the single.php file to show Ratings. `<?php if(function_exists('the_ratings')) { the_ratings(); } ?>` but in the HTML source of the Ratings in the post there is a problem. see blew meta content: `<meta content="http://rokesh.ir/downloads/pinblack/" itemprop="url">` in this meta content you see the URL of the easy digital downloads plugin but i want to see the URL of the post plugin like this: `<meta content="http://rokesh.ir/wordpress-portfolio-theme-pinblack/" itemprop="url">` you can see check it online here http://wordpress.org/plugins/wp-postratings/


When I Use function wp_insert_term() function it gives me Invalid taxonomy object

if(isset($_REQUEST['review_add'])){               $rw_es_name = $_REQUEST['rw_es_name'];     $rw_cl_name = $_REQUEST['rw_cl_name'];     $rw_cl_email = $_REQUEST['rw_cl_email'];     $rw_cl_review = $_REQUEST['rw_cl_review'];      $postthumbnailid = $_REQUEST['postthumbnailid'];           $rw_term = term_exists($rw_es_name,'review_texanomies',0);          // Create state if it doesn't exist     if ( !$rw_term ) {         $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');         $rw_term = wp_insert_term($rw_es_name,'review_texanomies',$defaults );          }     echo '<pre>';     print_r($rw_term);     echo '</pre>';     die();          $tex = $rw_term['term_taxonomy_id'];          $defaults = array(         'post_status' => 'pending',         'post_type' => 'review',         'post_author' => $user_ID,         'ping_status' => 'open',         'post_parent' => 0,         'menu_order' => 0,         'to_ping' => '',         'pinged' => '',         'post_password' => '',         'guid' => '',         'post_content_filtered' => '',         'post_excerpt' => '',         'import_id' => 0,         'post_title' => $rw_es_name,         'post_content' => $rw_cl_review,         //'tax_input'=> array('review_texanomies' => $tex)         'post_category' => array('review_texanomies' => $tex)     );     $post_id = wp_insert_post($defaults, $wp_error);     //wp_set_post_terms( $post_id, $terms, $taxonomy, $append );          if ($post_id) {         update_post_meta($post_id, 'rw_es_name', $rw_es_name);         update_post_meta($post_id, 'rw_cl_name', $rw_cl_name);         update_post_meta($post_id, 'rw_cl_email', $rw_cl_email);          set_post_thumbnail($post_id, $postthumbnailid );         //wp_set_object_terms($post_id , $rw_es_name, 'review_texanomies', true);     }      } It gives me output like WP_Error Object ( [errors] => Array ( [invalid_taxonomy] => Array ( [0] => Invalid taxonomy )                   )          [error_data] => Array         (         )      ) Or when i m using term_exists() it gives me id of terms.. So how wp_insert_term() function gives this type of error? when terms already gives out put?... please help mefor resolve this problem.


Problem installing plugin: unexpected T_STRING, expecting T_FUNCTION

i am trying to install plugin tumblrize and got the error > Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in > D:\Projects\Websites\jiewmeng\wp-content\plugins\tumblrize\tumblrize.php on > line 636 Call Stack: 0.0005 332520 1. {main}() > D:\Projects\Websites\jiewmeng\wp-admin\plugins.php:0 0.2249 3035904 2. > plugin_sandbox_scrape() D:\Projects\Websites\jiewmeng\wp- > admin\plugins.php:160 on line 636 is               register_activation_hook(__FILE__, 'tumblrize_activate');      i dont see anything wrong with that, just learnt to develop plugins and that line looks ok? there is the function on line 611               function tumblrize_activate () { ...      i am using wordpress 3.0.1 + PHP 5.3.2 btw


What Is The Use Of map_meta_cap Filter?

What is the use of map_meta_cap filter? This filter is not documented anywhere. I have an unclear idea of what it could be: Used to map the permissions of the user to operations on posts. What exactly is it meant for? If possible please give some sample code example of its right usage.


hook for loading page

I wanted to load my custom plugin when the "Jobs" page is loaded. How am I able to do it? This is my code so far.               <?php          /**      * Plugin Name: wp-retrieve-database      * Description: retrieves data from the database.      * Version: 0.5      * Author: Chan */          global $wpdb;     $table_name = $wpdb->prefix . "Careers";     $retrieve_data = $wpdb->get_results( "SELECT * FROM $table_name" );         function get_scrapy_scraped(){

         Job Name	         Location/Dept	         Complete Info	         Application Link
             foreach ($retrieve_data as $retrieved_data){
             echo $retrieved_data->Job_Name;	             echo $retrieved_data->Job_Department;	             echo $retrieved_data->Job_Link_Info;	             echo $retrieved_data->Job_Link_Apply;
             }
         }     add_action('dont know what to be used', 'get_scrapy_scraped');       ?>


How can I get the first 50% of all posts (within a custom post type)?

I'm trying to make a multi column layout. Seen as CSS3 adoption of column layouts is still thin on the ground, I was thinking maybe I could grab the first half of all my posts (and then the second), and add them in their own UL elements. I'm not sure how / if this is possible with a Wp_Query? I want to end up with my posts in alphabetical order, but split into two lists (using two queries, I guess), thus:

a
     .     .     .
m

n
     .     .     .
z

      I could then style each list with CSS and get a layout kind of like a multi column layout in CSS3. Does anyone have any ideas about how to structure my queries here? _**edit to explain how this isn't a duplicate_** It's about forming a two column layout _sure_ , but the question is very different: 'how to get half of all posts', not how to solve a very specific layout use case as is the linked 'duplicate'. (which I didn't find on account of it not being the same question). Further, I was looking for posts sorted alphabetically, vertically descending, not A|B, C|D as in the example.


Displaying products from categories in woocommerce

I want to display thumbnails of multiple categories on a page, i am having hard time accessing the categories as it shows empty. is something wrong with my code?                                 $args = array(                             'per_page' => '12',                              'category_name' => 'travel',                              'orderby' => 'title',                              );               print_r($args); //nothing gets output, like categories     $query = new WP_Query( $args );     if( $query->have_posts()) : while( $query->have_posts() ) : $query->the_post();              print_r($args); //nothing gets output, like categ              //want to display the thumbnail          endwhile;;         endif;


Plugin admin page stylesheet doesn't work

I am trying to style my plugin's admin page. Below is the code is use, but neither the stylesheet nor the script shows up on my page.               add_action( 'admin_init', 'myplugin_admin_init' );     add_action( 'admin_menu', 'myplugin_custom_menu_page' );          function myplugin_custom_menu_page(){         $page = add_menu_page( 'My Plugin', 'My Plugin', 'manage_options', 'myplugin/myplugin-admin.php', '', plugins_url( 'myplugin/images/icon.png' ), 33 );          add_action( 'admin_enqueue_scripts' . $page, 'myplugin_admin_styles' );          add_action( 'admin_enqueue_scripts' . $page, 'myplugin_admin_scripts' );     }          function myplugin_admin_init() {       wp_register_script( 'myplugin-script', plugins_url( 'myplugin/script.js') );       wp_register_style( 'myplugin-style', plugins_url('myplugin/stylesheet.css') );     }          function myplugin_admin_styles() {         wp_enqueue_style( 'myplugin-style' );     }          function myplugin_admin_scripts() {         wp_enqueue_script( 'myplugin-script' );     }      Any hints would be much appreciated!


Get post/page title from ID

I'm trying to get the post title of a post_type (post/page/portfolio) in the admin panel outside of the loop. I nearly tried all possible solutions, but without success:               //method 1     $content_post = get_post(3208);     $_menu_item_title = $content_post->post_title; //(Trying to get property of non-object error)          //method 2     $obj = get_post_type_object($_menu_item_type);     $content_post = get_post(3208);  //(Trying to get property of non-object error)     $_menu_item_title = $obj->$content_post->post_title;          //method 3     $_menu_item_title = the_title(3208); //(no error but nothing is store)          //method 4     $_menu_item_title = get_the_title(3208); //(no error but nothing is store)


Is there a better way to define options for custom fields in an admin panel?

I've currently got this:               $num = 1;          while($num < 6) {            register_setting( 'front_page_options', 'slide_title_'.$num );       register_setting( 'front_page_options', 'slide_description_'.$num );       register_setting( 'front_page_options', 'slide_button_1_text_'.$num );       register_setting( 'front_page_options', 'slide_button_1_url_'.$num );       register_setting( 'front_page_options', 'slide_button_2_text_'.$num );       register_setting( 'front_page_options', 'slide_button_2_url_'.$num );       register_setting( 'front_page_options', 'slide_bg_'.$num );       register_setting( 'front_page_options', 'slide_in_img_'.$num );            ++$num;     }      But is there a better way to write this?


do_shortcode close

I am using the jscrollpane plugin on WordPress along with the advanced custom fields plugin. The jscrollpane plugin uses the following shortcodes:               [vr_jsp]     [/vr_jsp]      I have two different custom fields that I need to put between their own set of the above shortcodes which are:               <?php the_field('first_content_block'); ?>     <?php the_field('second_content_block'); ?>      I understand you can use the below code to do this but I am a bit stuck on what to use to output the custom field between the two shortcodes.               <?php echo do_shortcode('[vr_jsp]CONTENT HERE[/vr_jsp]'); ?>      Just to clarify I need the custom field (first_content_block) displayed where 'CONTENT HERE' is.


conditional search

I am looking for help with a conditional search based on four categories/taxonomies; countries/regions/type/no of bedrooms. What I am after is a dropdown search function that when I select a specific country, only regions in that country would appear in the region dropdown and in the type drop down, only types available in that particular region would be listed. I am obviously prepared to pay a fee for customisation. JOHN


open all .docs in word online

Hey I'm trying to make all .doc/docx .xls/xlsx files open in office online. This would mean that every link to a .doc               http://mywebsite.com/wp-content/uploads.link.doc      would have to instead point to the office online preview link               https://view.officeapps.live.com/op/view.aspx?src=http://mywebsite.com/wp-content/uploads/link.doc      I'm not even sure how to go about doing this? Any help would be greatly appreciated! Thanks!


How to display comments and comment form on custom post type?

Is it possible in wordpress to display comments and comment form on custom post type, and how to do that? Thanks in advance.


Pagination for multiple queries for different authors on author.php

I have peculiar requirement. The author.php template is used as a profile page for the author where he can view his own posts and posts by other authors. This template has two custom loops to achieve this. The first loop is for displaying post by the author himself, whose profile is being viewed. So if the URL reads "http://example.com/author/john". The first loop is showing John's posts. Pagination for the first loop works absolutely fine. Arguments for the first loop:               $args = array(         'post_type'         => 'portfolio_post',         'posts_per_page'    => 9,         'paged'             => $paged,         'orderby'           => 'date',         'post_status'       => 'publish',         'author'            => $author_id     );          $custom_query = $wp_query;     $wp_query = new WP_Query( $args );     ?>      Arguments for the second loop:               $authors = '2,3,5';          $args = array(         'post_type'         => 'portfolio_post',         'posts_per_page'    => 9,         'paged'             => $paged,         'orderby'           => 'date',         'post_status'       => 'publish',         'author'            => $authors     );          $custom_query = $wp_query;     $wp_query = new WP_Query( $args );     ?>      The second loop is designed to show posts by other authors. The problem is with the pagination for the second loop. Since, I am viewing John's author page WP_Query is by default set by Wordpress to return posts only from the author John, whereas my second loop is actually looking for posts by other authors. Now, if John does not have any posts then pagination for the loop that fetches other authors post breaks, as $WP_Query->found_posts results "0". I am using Ajax to display results from both loops and it's working absolutely fine. I hoping this behaviour could be modified by using something like the "pre_get_posts" hook or may be something else. I could also be wrong in using the template "author.php" for this. Maybe I should use a different template? Please advise. Desperately need this working.


wp_handle_upload() does not list uploaded file in the media library?

Is it supposed to? My code:               if ($_POST && $_FILES) {         $tmp_name = $_FILES['file']['tmp_name'];         $item = $_FILES['file'];         $uploads = wp_upload_dir();         if (is_writable($uploads['path'])) {             if (!empty($tmp_name))  {                 if ($tmp_name) {                     $overrides = array('test_form' => false);                     $file = wp_handle_upload($item, $overrides);                 }             }         }     }


Cookies in template

I need to show some part of the page only once, based on cookies. The main problem that I can set cookies only in plugin, hooking init action. I've read 20 pages of google, this site, asked 2 forums, but I still have this problem. Any help would be appreciated!


How to implement a slideshow on WP similar to these examples?

I'm a big fan of slideshows like these: _BEST PLACES TO LIVE_ http://money.cnn.com/magazines/moneymag/bplive/2011/snapshots/PL0846355.html _Best places for the rich and single_ http://money.cnn.com/galleries/2011/moneymag/1108/gallery.best_places_rich_single.moneymag/index.html Does anyone have a suggestion how to implement something similar on Wordpress? My intention is to have whole pages load for each slide to increase the pageview count, but this apparently requires a pagination scheme in the URL for each slide. Is there a plugin or for this? _**Using WP 3.1.3, Thesis Theme_**


get_the_ID() gives notice in 404 page

I'm using get_the_ID() in my wp_enqueue_scripts action due to some needs, But as result I'm getting the following notice (wp-debug is on): > Notice: Trying to get property of non-object in C:\wamp\www\WordPress\wp- > includes\post-template.php on line 29 I know why this happens, My question is why should this happen? Isn't WordPress supposed to know that there is no $post assigned to 404 and return an empty result? Do I have to use:               if( !is_object($post) ) return;      Everywhere I use get_the_ID() in order to get rid of that Notice?


User friendly news section in Wordpress without using posts

I have a website that has a news section which simply shows the most recent 6 posts with a category of news. The problem is that whenever you create a post, Wordpress automatically creates a page for that post. The client claims Google does not like it when you have content showing up on a news section as well as on useless post pages which are not even being linked to. My question is this: is it possible to duplicate this news section usability (keeping it user-friendly) without having Wordpress create a new post page for every single news item that is published? And I don't mean just simply excluding the posts from a general post page, because that is already being accomplished. I mean not even generating a page for that post.. That would require a different method (rather than publishing a news item through a post), and I was wondering if said method exists **EDIT:** Thanks to @Rarst, I think I may be getting closer. I performed a test with `custom_post_types` with the following code:               add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'acme_product',             array(                 'labels' => array(                     'name' => __( 'Products' ),                     'singular_name' => __( 'Product' )                 ),             'public' => true,             'has_archive' => false,             'rewrite' => array(                 'pages' => false                 )             )         );     }      The problem is, I create a new "product" (it should really be "news", but this is just the example provided in the Wordpress documentation), and while it is not archived, a page is still created with the url: http://mydomain.com/?acme_product=test , where 'test' changes based on the name I gave the "product". Is there a way to prevent the site from publishing this page? Thanks!


get_post_custom_values problem, please help

i want get the "issue-cover" from archive page list, i done it. but it will cant get the meta value when i update/add new a post to the archice page.
         <?php $values = get_post_custom_values("issue-cover");                if (isset($values[0])) {            ?>         <a target="_blank" href="<?php $values = get_post_custom_values("issue-cover"); echo $values[0]; ?>" class="top-box-images"><img src="<?php $values = get_post_custom_values("issue-cover"); echo $values[0]; ?>" title="<?php echo get_post_meta($post->ID, 'issue', true); ?>"/>         <?php }             // if there's no img do replace it with no-img          else { ?>         <img src="<?php bloginfo('stylesheet_directory'); ?>/images/no-img.gif" title="<?php echo get_post_meta($post->ID, 'issue', true); ?>"/>          <?php } ?>              <?php echo get_post_meta($post->ID, 'issue', true); ?>         <?php echo get_post_meta($post->ID, 'cover-by', true); ?>


Disable comments feed, but not the others

I'd like to customize my WordPress blog in such a way that it is no more possible to access the comments feed. Other feeds should still be available, and it should still be possible to add comments to any article. I tried to find a plugin to do this, but what I found is a all or nothing feature, without the possibility to finely adjust which feeds are allowed and which are not.


How to remove/replace current page template?

I am writing a plug-in that creates new front/home page from scratch. Below code works nice and it outputs the text before the themes outputs anything. So the question is how can I remove the theme creating any html code? Basically I want the plug-i to start with blank home page regardless of any theme that is currently active.                 add_action('wp_head', 'new_front_page');         function new_front_page(){          if (is_front_page()){            echo 'is_front_page():'.is_front_page();          }         }       }      I am testing this on wp 3.6 and twenty thirteen. Of course anyone is welcomed to suggest better what how to do that.


My meta boxes update wp_postmeta of posts but not of pages. What is wrong with the code?

I have a simple checkbox on posts to display posts in a slider, and everything works fine. But I want to switch and add only pages in the slider, but code below is not updating wp_postmeta table of the pages, only posts. Could you please direct me what am I doing wrong               function damad_add_post_metabox() {          $screens = array( 'post', 'page');          foreach ( $screens as $screen ) {              add_meta_box(             'damad_post_meta_id',             __( 'Options', 'damad' ),             'damad_inner_custom_box',             $screen         );     }     }     add_action( 'add_meta_boxes', 'damad_add_post_metabox' );          function damad_inner_custom_box( $post ) {          wp_nonce_field( 'damad_inner_custom_box', 'damad_inner_custom_box_nonce' );            $homepage = get_post_meta( $post->ID, '_post_featured', true);       echo '<label for="post-featured">';            _e("Include in homepage slider", 'damad');       echo "</label>";       echo '<input type="checkbox" id="post-featured" name="post-featured" value="post-featured"';       if ( 'post-featured' == $homepage ) {         echo 'checked="checked"';       }        echo '/>';     }           function damad_save_postdata( $post_id ) {            if ( ! isset( $_POST['damad_inner_custom_box_nonce'] ) )        return $post_id;            $nonce = $_POST['damad_inner_custom_box_nonce'];            if ( ! wp_verify_nonce( $nonce, 'damad_inner_custom_box' ) )          return $post_id;            if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )        return $post_id;            if ( 'page' == $_POST['post_type'] ) {            if ( ! current_user_can( 'edit_page', $post_id ) )         return $post_id;           } else {             if ( ! current_user_can( 'edit_post', $post_id ) )         return $post_id;      }          $featureddata = $_POST['post-featured'];            update_post_meta( $post_id, '_post_featured', $featureddata );     }     add_action( 'save_post', 'damad_save_postdata' );


is action hook not working on quick edit?

This code is not working on quick edit?               function cpt ($term_id) {       print_r($_POST);     }     add_action('create_post_tag', 'cpt');


register_activation_hook for multiple functions

I have created a plugin where I want to call two different functions on activation. Is there a best way to do this? Should I use `register_activation_hook` twice? As in:               register_activation_hook( __FILE__, 'function_1' );     register_activation_hook( __FILE__, 'function_1' );      Or call the two functions from within an activation function, as in:               register_activation_hook( __FILE__, 'my_activation_function' );     function my_activation_function () {              function_1();         function_2();          }      Any ideas? Thanks.


Custom Taxonomy Relationship (ex: plant classification)

I'm trying to implement plant classification as a custom taxonomy for a custom post type. For now, plant classification should be on three levels: `Family`, `Genus`, `Species`. As I see it, there are two possible ways:   1. **Using taxonomy level as an indicator of taxonomy type, ex:**              plant_class                (custom taxonomy)       '-- Rhamnaceae           (level 1 = family)         '-- Ziziphus           (level 2 = genus)           '-- Ziziphus Jujuba  (level 3 = species)      _Advantages:_     * Correct structure; I'd be able to find the family name of a given genus.     * Administrator just selects a species to classify a plant. _Disadvantages:_     * Cannot be extended later on (eg; to introduce sub-species)     * The per-level aspect looks too "magical" to me (unintuitive / confusing to beginners)   2. **Putting each name under the classification type itself, ex:**              plant_class              (custom taxonomy)      |-- Family               (group of families)      | '-- Rhamnaceae      |-- Genus                (group of geni)      | '-- Ziziphus      '-- Species              (group of species)        '-- Ziziphus Jujuba      _Advantages:_     * Easily extensible (to add sub-species or even order at a higher level) _Disadvantages_     * Admin needs to select all applicable classification parts when associating to a plant (eg; a family, genus and species)     * Programatically, I lose the ability to find family from genus (broken hierarchy) Another (and even wilder) idea I've had is to create several taxonomies (`plant_family`, `plant_genus`, `plant_species`) and somehow form a relation between each taxonomy type so that a family can be associated to several geni. I've no idea how this would work. Wondering why there's no code? Well, it's relatively easy to create custom taxonomies, and what I'm missing is purely a system design issue. **Ref:** Biological Classification | Wordpress Taxonomy Reference | Ziziphus :)


Set Session Time Limit for Password Protected Posts

I have made a series of posts and pages password protected on my website using the built-in Visibility setting. They all use the same password, so the user can view all of them after entering the password once. **The problem:** I need the session to time out after an hour. I have tried using this code in my functions.php file.               add_action( 'wp', 'post_pw_sess_expire' );         function post_pw_sess_expire() {         if ( isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) )         // Setting a time of 0 in setcookie() forces the cookie to expire with the session         setcookie('wp-postpass_' . COOKIEHASH, '', 0, COOKIEPATH);     }      It successfully clears the cache, but I would like to extend the time rather than expiring the session immediately. Any help would be greatly appreciated!


Changing the meta_query of the main query based on custom query_vars and using pre_get_posts

I've registered custom rewrite rules and `query_vars` to use for displaying a list of events based on ISO date format. For example when a user requests the URL, `http://site.com/by-date/2013-04-04/`, my `query_var` is the date portion and I'd like to display a list of events who's `meta_key` of `_event_scheduled_date` equals the ISO date value in the `query_var`. Whenever I try the following code to modify the `$query` in `pre_get_posts` WordPress initiates a 404 and no posts are queried. I've been able to use `pre_get_posts` to manipulate other taxonomy listings and archive pages, but have yet been able to get it to work correctly with the custom `query_var` I've created.               function rewrite_rule_by_date() {         add_rewrite_rule('(by\-date)/([0-9]{4}\-[0-9]{2}\-[0-9]{2})$', 'index.php?pagename=$matches[1]&event_date=$matches[2]', 'top');     }     add_action( 'init', 'rewrite_rule_by_date' );          function query_var_by_date() {         add_rewrite_tag( '%event_date%', '([0-9]{4}-[0-9]{2}-[0-9]{2})');     }     add_action( 'init', 'query_var_by_date' );          function custom_event_query( $query ) {         if (  is_page( 'by-date' ) && get_query_var( 'event_date' ) && is_main_query() ) {             $query->set( 'post_type', 'event' );             $query->set( 'post_status', 'publish' );             $query->set( 'meta_key', '_event_scheduled_date' );             $query->set( 'orderby', 'meta_value' );             $query->set( 'order', 'ASC' );             $query->set( 'post_per_page', -1 );                  $meta_query = array(                 array(                     'key' => '_event_scheduled_date',                     'value' => get_query_var( 'event_date' ),                     'type' => 'DATE',                     'compare' => '='                 )             );                  $query->set( 'meta_query', $meta_query );         }              return $query;     }     add_filter( 'pre_get_posts', 'custom_event_query' );


Pagination Custom post type

I have a custom post type called 'doel'. I have made a page template to display all the doel items In this page template I loop the 'doel' post type and after 6 of them, I want to have a pagination. Only, the pagination does not appear. I started browsing on the internet and it seemed to be a common problem after version wp version 3.4 I tried some solutions from this site and the wp forums but none of them helped. For Example, what I tried was adjusting the loop, so the pagination would be IN the loop, OUT of the loop or between endwhile and endif. Also I tried the wp pagenavi plugin and the original wp previous and next post links but none of them are working, so I think there is something wrong in my loop. My code atm is:               <?php     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $loop = new WP_Query( array(     'post_type' => 'doel',     'posts_per_page' => 6,     'orderby'=> 'menu_order',     'paged'=>$paged     ) ); ?>     <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
             <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array('class' => 'featuredimg')); ?>             <img class="logodoel" src="<?php the_field('logo_doelen'); ?>" />
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

<a href="<?php the_permalink(); ?>"><?php the_excerpt(); ?>
             Doneer nu
          <?php endwhile; ?>
      <?php wp_pagenavi(); ?>


Problem with wordpress version 3.8

![enter image description here](http://i.stack.imgur.com/z9TG8.png) Hi I have just updated wp version 3.8 and whenever I install plugins , in most of the cases the plugins shows an error or warning that certain variable in the plugin is not defined. In some of the cases I have gone to the code and fixed by declaring the variable myself This is just one case but if I use the same plugin with version 3.7 everything seems to run fine and not just with one plugin but many other plugins as well I want to know what has changed that is causing the problem. I just used php function 'empty($variable)' to remove this error


Wordpress changing single quotes to double quotes in title and content

My wordpress site has this annoying problem: it converts the single quotes (e.g. it's) into double quotes (it"s) and it looks bad. For example, look at the title of this post: http://www.pcsteps.gr/1408-lost- gigabytes/ I have searched long and hard about this. I have read about php.ini and the magic quotes parameter, but it is already off on my server (and everything other that has to do with magic quotes) I have commented the wp_magic_quotes(); line on wp-settings.php but it changed nothing. I have found some 6+ years old posts on wordpress forums that reference plugins that don't exist anymore and changes on wordpress files that also don't exist. Any help will be greatly appreciated. Thanks Angelos


Remove 'product' & 'product-cateogory' from url - woocommerce

I'm using WooCommerce for a shopping site and it is adding slug or base to the urls. For instance: http://dev.unwaveringmedia.com/8dim/product-category/all- party-supplies/ http://dev.unwaveringmedia.com/8dim/product/14-snowman- serving-tray/ I don't want slug/base (product & product-category) in urls. Is there any way or plugins to remove them from urls?


Edit User Profile From Front End

I have taken reference from this link. I have used Plugin cimy user extra fields for extra users' field. I have taken few extra fields such as picture upload and file upload. Now I want to edit user profile from front end. I am able to edit user text fields(both extra and normal fields), but I am not able to change their picture or file. I have also tried to use few plugins such as profile builder, wp user frontend but have not been successful in doing so. Below is my code which i have used for editing user profile from front Form                <form method="post" id="your-profile" action="<?php the_permalink(); ?>"  enctype="multipart/form-data">

                                             <?php _e('First Name', 'profile'); ?>	                                             <input class="text-input" name="first-name" type="text" id="first-name" value="<?php the_author_meta('first_name', $current_user->ID); ?>" />

                                             <?php _e('Last Name', 'profile'); ?>	                                             <input class="text-input" name="last-name" type="text" id="last-name" value="<?php the_author_meta('last_name', $current_user->ID); ?>" />

                                             <?php _e('Email', 'profile'); ?>	                                             <input class="text-input" name="email" type="text" id="email" value="<?php the_author_meta('user_email', $current_user->ID); ?>" />

                                             <?php _e('Website', 'profile'); ?>	                                             <input class="text-input" name="url" type="text" id="url" value="<?php the_author_meta('user_url', $current_user->ID); ?>" />

                                             <?php _e('Password *', 'profile'); ?> 	                                             <input class="text-input" name="pass1" type="password" id="pass1" />

                                             <?php _e('Repeat Password *', 'profile'); ?>	                                             <input class="text-input" name="pass2" type="password" id="pass2" />

                                             <?php _e('Biographical Information', 'profile') ?>	                                             <textarea name="description" id="description" rows="3" cols="50"><?php the_author_meta('description', $current_user->ID); ?></textarea>

                                     <?php wp_nonce_field('update_user','update_user_nonce'); ?>                                          <?php                                     //action hook for plugin and extra fields                                     do_action('edit_user_profile', $current_user);                                     ?>
                                         <input type="submit" id="updateuser" class="submit button" value="<?php _e('Update', 'profile'); ?>" />
                                 </form>      Code to update profile                       global $current_user;                 get_currentuserinfo();                 /* Load the registration file. */            if (!(function_exists('get_user_to_edit'))) {                require_once(ABSPATH . '/wp-includes/user.php');                require_once(ABSPATH . '/wp-admin/includes/user.php');            }                 $allFields = get_cimyFields();            $error = array();                 /* If profile was saved, update profile. */            if ('POST' == $_SERVER['REQUEST_METHOD'] &&                       !empty($_REQUEST['update_user_nonce']) && wp_verify_nonce($_REQUEST['update_user_nonce'],'update_user') ) {          /* Update user password. */     if (!empty($_POST['pass1']) && !empty($_POST['pass2'])) {         if ($_POST['pass1'] == $_POST['pass2'])             wp_update_user(array('ID' => $current_user->ID, 'user_pass' => esc_attr($_POST['pass1'])));         else             $error[] = __('The passwords you entered do not match.  Your password was not updated.', 'profile');     }               /* Update user information. */     if (!empty($_POST['url'])) {         wp_update_user(array('ID' => $current_user->ID, 'user_url' => esc_url($_POST['url'])));     }          if (!empty($_POST['email'])) {         if (!is_email(esc_attr($_POST['email'])))             $error[] = __('The Email you entered is not valid.  please try again.', 'profile');         elseif (email_exists(esc_attr($_POST['email'])) != $current_user->ID)             $error[] = __('This email is already used by another user.  try a different one.', 'profile');         else {             wp_update_user(array('ID' => $current_user->ID, 'user_email' => esc_attr($_POST['email'])));         }     }          if (!empty($_POST['first-name'])) {         update_user_meta($current_user->ID, 'first_name', esc_attr($_POST['first-name']));     }          if (!empty($_POST['last-name'])) {         update_user_meta($current_user->ID, 'last_name', esc_attr($_POST['last-name']));     }          if (!empty($_POST['description'])) {         update_user_meta($current_user->ID, 'description', esc_attr($_POST['description']));     }               /* Redirect so the page will show updated info. */     /* I am not Author of this Code- i dont know why but it worked for me after changing below line to if ( count($error) == 0 ){ */     if (count($error) == 0) {              //action hook for plugins and extra fields saving         do_action('personal_options_update', $current_user->ID);         do_action('profile_update', $current_user->ID);         foreach ($allFields as $field) {             set_cimyFieldValue($current_user->ID, $field["NAME"], $_POST['cimy_uef_' . $field['NAME']]);         }         do_action('edit_user_profile_update', $current_user->ID);         wp_redirect(get_permalink());            //        exit;     }            }            add_action('wp_enqueue_scripts', 'abc');                 function abc() {                wp_enqueue_script('image-edit');                wp_enqueue_style('imgareaselect');            }


Create page when plugin is activated

I've made so that everytime my plugin is activated it's supposed to create a page. Although i want it to only create the page if it doesn't exist from before. But what it's doing is that it's creating another page with kns- products-1 instead of not doing it at all. My code so far:               function kns_install() {         global $wp_version;              if( version_compare( $wp_version, '3.5', '<' ) ) {             wp_die( 'Detta tilläget kräver att du har WordPress version 3.5 eller högre.' );         } else {             if(!is_page('kns-products')) {                 $product_page = array(                 'post_type' => 'page',                 'post_name' => 'kns-products',                 'post_title' => 'Produkter',                 'post_status' => 'publish',                 );                      wp_insert_post($product_page);             }         }        }      I thought that the !is_page condition would solve this but there seems to be a built in code to just add numbers after the slug name. Is there any way to solve this or does anyone know of any better approach?