title: WordPress Page Id

text: I have a client (same for my previous post about the slider) who believes that the url structure needs to include a "google page id" to be compliant with google news. Therefore, they want the url structure set up like: http://www.sitename.com/blog/article-name-goes-here?p=85532 . I think they want just a unique 3+ number id associated with every post. Does anyone know how to go about this? I am quite good with design and front-end dev, but when it comes to WordPress loops or settings sometimes I am just clueless.


title: How to make that google wont follow some of the wordpress pages?

text: How to make that google wont follow these two pages: http://mysite.com/products-page/your-account/ http://mysite.com/products- page/checkout/ Thanks! P.S. Im using worpdress with WP Ecommerce plugin.


title: Add box with custom per-page properties

text: Hey, I'm stuck trying to add a box with settings for all pages (the ones users create/edit). What I'm attempting to do is add 6, 7 check boxes and an input field for all pages that alters the rendering of it; for example: _"Display a contact form at the bottom yes/no?"_. How do you do this without, of course, editing any Wordpress core files?


title: Custom Field Query - Meta Value is Array

text: I'm using a custom field query (or trying to) :               $args =  array(         'post_type'     => 'pf_cookbook',          'meta_query'    => array(             'key'           => 'pf_cookbook_recipes',             'value'         => '5',             'compare'       => 'NOT IN',             'type'          => 'NUMERIC'         )      );      However, the meta value to be compared is an array. The idea here is I am querying the DB to get the cookbooks which don't contain a certain recipe. The Recipes & Cookbooks are Custom Post Types. The Cookbooks have a meta key 'pf_cookbook_recipes' which I am storing an array of recipe IDs. Maybe I am missing something?


title: Upload to a remote server using wp_remote_post

text: I'am developing a plugin that will push files to a remote server via http upload. Currently I got it to work with CURL doing something like this:               $post = array("post_file"=>"@/path/FILE.EXT");     curl_setopt($ch, CURLOPT_POSTFIELDS, $post);       Now my question is how I can achieve the same using wp_remote_host. How is the file included in the 'body' argument. For more info see this. http://codex.wordpress.org/Function_API/wp_remote_post


title: Unable to save custom taxonomy terms in a custom-built metabox

text: I've roughly followed the tutorial here on how to create "custom taxonomy input panels". I'm using a custom post type of `homes` and a custom taxonomy called `beds` (used to record the number of beds in a house). I've got the taxonomy terms showing up in a drop down menu, but cannot get them to save when the post is saved. I started to just post the code that is intended to save the term, but realized that I should post the code that creates and displays the metabox as well, for context. The custom post type name is 'homes' and the custom taxonomy name is 'beds'. The taxonomy is hierarchical (not that I think that matters in this case, but I could be wrong).               //adding metaboxes for the homes post type     function add_homes_metaboxes() {         add_meta_box( 'blackstone_homes_beds', 'Beds', 'blackstone_homes_beds', 'homes', 'side', 'default' );     }          function add_homes_menus() {         if ( !is_admin() )             return;         add_action( 'admin_menu', 'add_homes_metaboxes' );         /* Use the save_post action to save new post data */         add_action( 'save_post', 'save_taxonomy_data' );     }          add_homes_menus();          function blackstone_homes_beds( $post ) {              echo '<input type="hidden" name="beds_noncename" id="beds_noncename" value="' .         wp_create_nonce( 'taxonomy_beds' ) . '" />';              // Get all theme taxonomy terms         $beds = get_terms( 'beds', 'hide_empty=0' );         $stuff = array( 'this', 'that' );         //print_r($beds);     ?>     <select name='homes_beds' id='homes_beds'>         <!-- Display beds as options -->     <?php         $names = wp_get_object_terms( $post->ID, 'beds' );     ?>         <option class='beds-option' value=''                 <?php if ( !count( $names ) )                     echo "selected"; ?>>None</option>                 <?php                 foreach ( $beds as $bed ) {                     if ( !is_wp_error( $names ) && !empty( $names ) && !strcmp( $bed->slug, $names[0]->slug ) )                         echo "<option class='beds-option' value='" . $bed->slug . "' selected>" . $bed->name . "</option>\n";                     else                         echo "<option class='beds-option' value='" . $bed->slug . "'>" . $bed->name . "</option>\n";                 }                 ?>                 </select>     <?php             }                  function save_taxonomy_data( $post_id ) {     // verify this came from our screen and with proper authorization.                      if ( !wp_verify_nonce( $_POST['beds_noncename'], 'taxonomy_beds' ) ) {                     return $post_id;                 }                      // verify if this is an auto save routine. If it is our form has not been submitted, so we dont want to do anything                 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )                     return $post_id;                      // Check permissions                 if ( 'homes' == $_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;                 }                      // OK, we're authenticated: we need to find and save the data                 $post = get_post( $post_id );                 if ($post->post_type == 'homes'){                     $beds = $_POST['homes_beds'];                     wp_set_object_terms( $post_id, $beds, 'beds' );                 }                 return $beds;             }      I know there's another very similar question here already, but the solution to it uses the WPAlchemy class, and I'd rather not do so. Any suggestions on what I might have wrong? I've been staring at this all day, so I fully expect to find out I've just got a variable name off by one character or something. EDIT: Here's what I changed to get it working correctly: Instead of echoing the hidden field with the nonce, I used `wp_nonce_field( __FILE__, 'taxonomy_beds' );` and when verifying the nonce, I used `if ( !wp_verify_nonce( $_POST['taxonomy_beds'], __FILE__ ) )`


title: Own code on index.php wordpress theme file, help with the rewrite rules

text: Hey there, I am sooo frustrated, asked and asked and can't seem to get an answer. Pleaseeeee help, I'll be very very clean whith my problem. I'll give hundreds of bears to the one who can help:)   1. I have a blog installed http://www.myblog.com \- **it's part of a network, I use wordpress multisite**   2. **I created a table called cars** with 60 rows - **it's not a wordpress table** , it's my own custom table but I have created it inside the wordpress database.   3. On my blog theme, editing index.php, I display the records from the table **cars** , 10 rows per page and I write a custom pagination script with no relation what so ever with my wordpress pagination.   4. Now i have the following links:    www.myblog.com/index.php?currentpage=1   www.myblog.com/index.php?currentpage=2   and so on untill ...   www.myblog.com/index.php?currentpage=6   5. How can I rewrite them to pretty goole friendly links? **Ideea one:** since they are not actually related to the wordpress blog, should I edit htaccess? I believe wordpress .htacces rules override any custom rules i put there... if you know a solution please share... **Ideea two:** Tried to use wordpress rules and edited functions.php like so, with no luck:               add_action( 'init', 'wpa5413_init' );          function wpa5413_init() {                  add_rewrite_rule(                            '^/\?currentpage/(\d*)$',                          'index.php?currentpage=$matches[1]',                   'top' );          }              add_filter('query_vars', 'wpa3537_query_vars');          function wpa3537_query_vars($query_vars) {                  $query_vars[] = 'currentpage';                  return $query_vars;         }       **Please help me, honestly, I can even pay, I am soo frustraed... doing this work after my dayjob, it's been days of not sleeping, just need to make this happen, pleaseeeeeeeeeeeeeeeee** PS don't vote down my question, i see others are struggeling with similar issues


title: How do I display content to users who are not logged in instead of 404 on Private custom posts?

text: I want to display a message like "You must be logged in to view this", with Private custom posts. Theoretically, I want to use something like this: `if (is_user_logged_in()) {   // Page code goes here   }   else {   echo "You must be logged in to view this page.";   }` This code is in the single-custom.php page template.   The `true` case works just fine. However, if the user is not logged in, instead of seeing "You must be logged in..." I get a 404 instead? What am I doing wrong?


title: Update Custom post field by Ajax on cached site

text: My site cached by "wp-supper cache" plugin and "cloudflare.com" So my php function to count post views working incorrectly. I try to use ajax for it but I'm noob with JS code so I can not know where is wrong. In **functions.php** I create a simple function:               add_action('template_redirect', 'ajax_activation');     function ajax_activation(){        //optional         wp_enqueue_script(            'ajax_script',             get_template_directory_uri() . '/js/ajax.js', // path to your js file for ajax operations            array( 'jquery' ), false        );        //end optional        wp_localize_script(            'ajax_script', // the name of your global.js registered file           'ajax_object', // name             array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) // you can add other items for example for using a translated string in javascript/jquery context        );      }          add_action('wp_ajax_get_PostViews', 'get_PostViews');     add_action('wp_ajax_nopriv_get_PostViews', 'get_PostViews');          function get_PostViews() {     $id = isset( $_POST['id'] ) ? $_POST['id'] : false;     $count_key = 'post_views_count';      $count = get_post_meta($post_ID, $count_key, true);     if( empty($count) ){ $count = 1; } else { $count++; }     update_post_meta($post_ID, $count_key, $count);     }      Code in **ajax.js** file:               var postID = $(".view_detail").attr("id");     jQuery.ajax({         type: "POST",         url: ajax_object.ajaxurl, // this is the object you defined in function.php         data: {            action: 'get_PostViews', // the name of your function            id: postID // you can store it in html attribute for an easy access like: jQuery(element).attr('id');         },         success: function (result) {         }     });      The **page.php** in my theme:               <div id="<?php the_ID(); ?>" <?php post_class('view_detail'); ?>>      Please tell me how can I do it work? Thank you very much!


title: having trouble with my list category posts plugin

text: I'm using the list-category-posts on this page: http://www.goldcoastchamber.com/member-directory/ to pull in the links to all the posts under the member-directory category. That part is working, but for some reason it's not putting them in alphabetical ascending order, even though I used that argument, as you can see here: `[catlist name=member-directory, orderby=title, order=ASC, numberposts=-1]` please advise why this is not working. thanks!


title: I need to assign a role to visitors/guests

text: Is there a way to create a 'role' in wordpress for a guest? I am using a role visibility plugin which lets me choose the type of visibility to each rule. However a Guest hasn't got a role. I can create a role, however not sure how to link this to the "Guest"...


title: implementing a jQuery "click to expand" link in Wordpress

text: **Novice coder - apologies for any stupid comments** I've been trying to make a show more button on one of the div s on my Wordpress blog page. I've looked at a number of tutorials that all seem to agree that JavaScript / jQuery is the only way to do it. Many solutions rely on the creation of two seperate divs that you can toggle 'display:none' for however the div is filled using a `foreach` argument that cannot be split (to my knowledge) What would be really helpful is if I could simply override the max height setting (instead of having to split it into multiple divs) and simply allow the div to fill to its own desired height on the click of a link. This page talks about setting a height: http://stackoverflow.com/questions/5531306/change-div-height-onclick-with- animation Using:                $('div').click(function(){      $(this).animate({height:'300'})      })      but gives no explanation as to how to implement it... Implementing Java into wordpress is hard for a beginner level coder as a lot of the info on sites like Wordpress.Codex already assumes too much knowledge of the workings of javascript. Whilst my php isn't that shabby I know NOTHING about java and find it tough to break the surface of how to use it. Not looking for people to do it for me - simply any help would be really appreciated to get me off the ground with this. ======================================================= **The solution I ended up using through lack of understanding and topic being closed:** Although I recommend using Joey Yax's suggestion as it seems far more robust and had nice animations. I couldn't get the same effect to work from being able to click the link however and this prevented use on mobile / touch screen devices. The div in question below is called 'members-dir-list' & I also had to change the CSS from `max-height:100px;` to simply `height:100px;` for the code to work.               Show More         Show Less      The three javascript entries in the onClick commands 1. Adjust height 2. Hide the Current Link. 3. Show the other link. My span styling had been made to look like hyperlinks to avoid having to use `<a href="#"` and getting thrown to the top of the page.


title: private functions in plugins

text: I've developed two plugins in which one function is the same (same name, same functionality). When trying to activate both plugins Wordpress throws an error because it doesn't let me defining the function under the same name twice. Is there a way to make this function private for the plugin only, without using object oriented programming and without simply renaming the function? I don't want to use OOP because I first would have to learn it. Also I wouldn't like renaming the function because I might want to use it in other plugins too and renaming feels not right to do.


title: Querying Advanced Custom Fields

text:
I've been back and forth with this and not able to get my Advanced Custom Field query working. According to the documentation in the link above, this is what my array should look like:               $args = array(         'numberposts' => -1,         'post_type' => 'event',         'meta_key' => 'location',         'meta_value' => 'Melbourne'     );      Below is my array. The problem is clearly in the meta_key and meta_value I am trying to query. Without the meta_key and meta_value, all the Products are being returned as expected. I have been into the database to make sure I have the right values so this looks correct to me. Is there something that stand out to anyone I might be missing? Thanks

Search Results
                 <?php                      $args = array(                          'post_type' => 'Product',                          'posts_per_page' => -1,                          'orderby' => 'title',                          'order' => 'ASC',                          'meta_key' => 'product_type',                         'meta_value' => 'Paper'                     );                     $loop = new WP_Query( $args ); ?>
                     <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
                                 <a href="<?php echo get_permalink(); ?>"><?php the_title(); ?> - <?php the_field('product_type'); ?>
                                 <?php the_field('product_description'); ?>

                          <?php endwhile; ?>                     <?php wp_reset_query(); ?>
                 <?php } ?>
      **EDIT:** This is what my array looks like now:               $args = array(         'post_type' => 'Product',          'posts_per_page' => -1,          'orderby' => 'title',          'order' => 'ASC',         'meta_query' => array(                array(                    'key' => 'product_type'                )             )          );      Just the "key" alone does the trick right, but as soon as I add the "value" the search does not return any results. And I know that the value should be "Paper" in this case. **EDIT** I've looked again at the DB, the product from wp_posts through to wp_postmeta and filtered meta_value by "Paper" and they all return the following a:1:{i:0;s:9:"Paper";} where I supposedly should have just "Paper"


title: Dynamic dependent Dropdown lists for Categories, Sub-Categories and Posts!

text: I'm using WordPress 3.5 as CMS to develop my personal website. The reason I'm writting, is that I need a way to implement a code or plugin to allow users to navigate through posts using dependent(chained) dropdown lists. In other words I would like 3 dropdown menus to be dynamically populated based on the selection chosen in the previous dropdown lists. This would consist of: Dropdown 1: Category *   Dropdown 2: Sub- Category *   Dropdown 3: List of posts in Sub-Category * *Dropdown 1 would be pre populated with categories.    *Dropdown 2 would list the sub categories of menu 1 based on the user selection.    *Dropdown 3 would list the posts in the sub category chosen in menu 2. To help you understand further, in my website I have the Category "TV Series" which has as sub-categories(child) other series, like "Dexter", "CSI:Miami" etc. Series also have other sub-categories(child) the number of seasons, like "Season 1" "Season 2" "Season N". Each season contains the appropriate posts. The Hierarchy is like this: Tv Series (main category)   -Dexter   \--Season 1   \--Season 2   \--Season n -CSI:Miami    \--Season 1   \--Season 2   \--Season n So for example the dynamic dropdowns I would like to use are the following: Dropdown 1: Select TV Show (Category)   Dropdown 2: Select Season (sub-category)   Dropdown 3: Select Episode (posts) I would really appreciate if you could help me with the matter as I was searching the web for the past few days without any results. **P.S.** I already tried a plugin named Category Ajax Chain Selects but it's outdated and not working properly! Thanks in advance.


title: Show Home Link In wp_nav_menu but only on primary menu

text: This function adds a home link into my nav menu, but it is added to 3 other menus I am using as well. I don't quite understand where to add code to only display in my primary nav.               function my_page_menu_args( $args ) {         $args['show_home'] = true;         return $args;     }     add_filter( 'wp_page_menu_args', 'my_page_menu_args' );


title: How to get a current post's blog id

text: I'm resubmitting a question I previously asked, but crystalising it down to its 'simplest' form. In a multisite network, how can one get the blog_id for where a post was originally published from? It's a simple question that should have a simple answer. We're trying to determine the post's blog_id from outside its originating blog (i.e. from another network blog or the main parent blog), so need some way of supplying an argument such as post_id.


title: Categories of custom taxonomy don't show any posts

text:
I want to display posts from categories of my custom taxonomy but realy don't know how to achieve this. I am using isotope filtering which works as expected with default post categories. I can click on a particular category and it shows all posts related to that category but it doesn't work with my custom taxonomy. I can see all sub-taxonomies (thanks to Rajeev Vyas) but when I am clicking on one of them - no posts are displayed. Can you please tell me what I am doing wrong? This is the code from my functions.php:               add_action('init', 'portfolio_register');     function portfolio_register() {          $labels = array(             'name' => _x('My Portfolio', 'post type general name'),             'singular_name' => _x('Portfolio Item', 'post type singular name'),             'add_new' => _x('Add New', 'portfolio item'),             'add_new_item' => __('Add New Portfolio Item'),             'edit_item' => __('Edit Portfolio Item'),             'new_item' => __('New Portfolio Item'),             'view_item' => __('View Portfolio Item'),             'search_items' => __('Search Portfolio'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );         $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'menu_icon' => get_stylesheet_directory_uri() . '/images/portfolio-icon.png',             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','author','thumbnail','comments')           );          register_post_type( 'portfolio' , $args );         flush_rewrite_rules();     }     // Custom taxonomy for Portfolio Categories (Galleries)     register_taxonomy('galleries', array('portfolio'), array('hierarchical' => true, 'label' => 'Galleries', 'singular_label' => 'Gallery', 'rewrite' => true, 'public' => true ));         And this code is from my loop.php which is my custom post type template:                <?php /* Display filter options if homepage  */ ?>     <?php if(is_home()) { ?>
             Filter

All
                 <?php                 $args=array( 'orderby' => 'name', 'taxonomy'=>'galleries' );                 $categories=get_categories($args);                 foreach($categories as $category) {  ?>
<a href="#<?php echo $category->category_nicename; ?>" class="<?php echo $category->category_nicename; ?>"><?php echo $category->name; ?>
                 <?php } ?>

     <?php } ?>          <?php /* If this is the homepage, display all posts on one page  */      if(is_home() && get_option('show_all') && !is_search()) { query_posts('post_type=portfolio', 'posts_per_page=-1'); } ?>          <?php if (have_posts()) : ?>         Hope that my english doesn't hurt your eyes....


title: Create a formatted table-like menu

text:
I've just put the site up a couple weeks ago and adding some more things to it for my friend however there's got to be an easier way to lay content out over wordpress. I've having a hard time with it even and I'm codding half of it (or at least adding styles, looking at the CSS, ect) I'm specifically looking at the services (pretty much the only thing on this test page) and how to lay them out. They are in ugly tables of which I think I even forgot how to use but how else am I supposed to lay out content like this? Is there a plugin that makes my life easier (Premium? - I've heard of Types or Views, is that a good plugin?). However as I've done the work on this so far, what is the best way to get padding inside those cells? I've tried almost everything but it either doesn't work or it affects ALL tables on the page (the original page where it will be which is here). I've added the garble table code here is you want to look at it..

 CLIMATE

Our smart technology will help you keep you climate suited to your needs.

READ MORE

SECURITY

With our 100% quality Home Automation techniques your home is secure 24/7.

READ MORE

 AUDIO

Along with your smart lights you can have our flexible music system that works.

READ MORE

 LIGHTING

Now you can have smart lights. Enjoy our advanced lighting system in your home.

READ MORE


title: Recreating the hierarchy of taxonomies for a dropdown form menu?

text: I have a form that contains a dropdown menu. This form is on a page `form.php` and is not part of my theme. It exists outside of my site. This dropdown menu contains my list of values for a custom taxonomy called _Formats_. My _Formats_ are as follows:               Entry Form     Facebook       - Entry Form       - Page     Twitter      This is my code so far:               <?php include("wp-blog-header.php"); ?>     <?php      global $wpdb;     $getFormats = $wpdb->get_results($wpdb->prepare("                  SELECT * FROM wp_terms p                   LEFT OUTER JOIN wp_term_taxonomy t ON p.term_id = t.term_id                  WHERE t.taxonomy = 'format'                  ")); ?> // This gets all the values for the format taxonomy          <form> //start form     <select name="format"> //start dropdown          <?php     foreach ($getFormats as $format) { //spit out the formats         echo "<option value='".$format->name."'>".$format->name."</option>";     } ?>          </select> //end dropdown     </form> // end form     ?>      So far, my dropdown looks like this:               Entry Form     Facebook     Entry Form     Page     Twitter      First question: How can I get the hierarchy to stick (i.e. keep the indents)? My HTML output is as follows:               <option value="Entry Form">Entry Form</option>     <option value="Facebook">Facebook</option>     <option value="Entry Form">Entry Form</option>  // <---- this is gonna be a problem     <option value="Page">Page</option>     <option value="Twitter">Twitter</option>      Second Question: You'll notice the output for the second instance of Entry Form is identical to the first instance. Obviously, this is going to be a problem for submitting the form. How can I make this unique?


title: No authors in change author dropdown

text: I have added a custom post type "Review", and a custom role "Reviewer". The issue is when logged as admin I take review which current author is admin and I want to change author to a Reviewer I have no options in dropdown besides admin. When I change a post whose author is a Reviewer, I have 2 options in dropdown: the current author and admin. Other Reviewers are not visible. here is a part with capabilities               'capabilities' => array(         'edit_post' => 'edit_review',         'edit_others_posts' => 'edit_others_reviews',         'publish_posts' => 'publish_reviews',         'read_post' => 'read_swpd_review',         'read_private_posts' => 'read_private_reviews',         'delete_post' => 'delete_swpd_review'     ),      and setting new role               /* Add guest author role to the blog */     add_role('reviewer', 'Reviewer', array('edit_review','read_review','delete_review'));          //add capabilities for admin     $role_object = get_role( 'administrator' );     $role_object->add_cap( 'read_review' );     $role_object->add_cap( 'edit_review' );     $role_object->add_cap( 'delete_review' );     $role_object->add_cap( 'publish_reviews' );     $role_object->add_cap( 'edit_others_reviews' );     //set level for reviewer (should fix a dropdown bug)     $role_object = get_role( 'reviewer' );     $role_object->add_cap('level_1');      Is it a matter of capabilities? What could be wrong?


How can I change the author of the comment from the admin control panel? A more detailed explanation, how can I change the value of the `user_id` column (which is located in the `wp_comment` table) from the admin control panel?


title: Custom Post Type Rewrite Throws Headers Sent Errors

text: I used Mixing custom post type and taxonomy rewrite structures? and http://wordpress.org/support/topic/set-category-to-a-custom-post-type- automatically?replies=10 to create my custom post type. But I am getting some headers already sent errors on my site. Specifically when I go to save a page or try to log in. Can somebody check the code to make sure it is correct.               // PROJECTS     add_action('init', 'create_work_projects');     function create_work_projects() {              register_taxonomy( 'project_category', array(), array(             'hierarchical' => true,             'labels' => array(                 'name' => 'Categories',                 'singular_name' => 'Category'             ),             'show_ui' => true,             'query_var' => true,             'rewrite' => array( 'slug' => 'work' )         ));              register_post_type( 'projects', array(             'labels' => array(                 'name' => 'Projects',                 'singular_name' => 'Project'             ),             'supports' => array('title', 'editor', 'thumbnail'),             'public' => true,             'hierarchical' => false,             'show_ui' => true,             'show_in_menu' => true,             'capability_type' => 'post',             'rewrite' => array(                 'slug' => 'work/%project_category%',                 //'slug' => 'work',                 'with_front' => false             ),             'query_var' => true,             'has_archive' => 'work',             'taxonomies' => array( 'project_category' )         ));     }          add_filter('post_type_link', 'work_project_permalink', 10, 4);     function work_project_permalink($post_link, $post, $leavename, $sample) {         if ( false !== strpos( $post_link, '%project_category%' ) ) {             $glossary_letter = get_the_terms( $post->ID, 'project_category' );             $post_link = str_replace( '%project_category%', array_pop( $glossary_letter )->slug, $post_link );         }         return $post_link;     }          add_action('publish_projects', 'projects_default_category');     function projects_default_category($post_ID) {         global $wpdb;         if(!has_term('', 'project_category', $post_ID)) {             wp_set_object_terms($post_ID, 'Uncategorized', 'project_category');         }     }      Wordpress 3.2.1


title: Update Wordpress with SFTP instead of FTP

text: Is there a way to update Wordpress without the use of FTP, but with SFTP (which uses SSH)? I've only got my server set up for SSH access (and therefore SCP/SFTP).


title: How to get post body look same as my visual editor?

text: When I apply the format and styles such as bold and `<br/>` on visual editor it looks bit nicer. But when I see that on blog post it looks totally different. I do not use any styles for p tag in my style sheet. How can I just get the same look of post with styles I applied in visual editor when I see the post on the site?


title: WordPress/BuddyPress plugin to allow users to create members-only posts

text: I'm setting up a site using BuddyPress and I'd like to be able to give members the option to create new blog posts that are viewable only to members of the blog itself. I've found a couple of plugins (s2member, for example http://buddypress.org/community/groups/s2member/home/ ) that seem to do a great job of allowing the admin to restrict posts and content behind a paywall, but nothing that really seems to add anything into the Post Edit screen that's simple for an end user to interact with. Basically, I'm looking for something that adds a "Members only" radio button option to the Visibility selector in the Publish meta box. I've checked the BuddyPress plugin repo and the WordPress one as well, but haven't really found anything. I'm almost ready to roll my own, but didn't want to re-invent the wheel. Anyone know of anything, or should I get coding? Oh, one other option: is this built into WP or BP and I'm just being really, really stupid?


title: Simple Wordpress function / plugin to redirect a site

text: Is there a way to create a simple function that redirects every page of a site to another site? I've Googled around but all the plugins / functions that I've found are only really meant for redirecting individual pages and not entire sites. Any ideas?


title: Get Tag Slugs that start with a word

text: Is there a way to get all tags whose slug starts with a specific word? I tried to use the below code but doesn't output anything. What am i missing here? I am new to php so excuse if i am doing something totally wrong.                   $auth = get_term_by('slug', 'author-', 'tag');     print "values".$auth;


title: Gathering all Custom Post Type posts in to array/object the proper way

text: It's Friday, it's late, I've probably done this before in the work I've done before, but I'm drawing a blank. What is the best way to stay within the Wordpress framework and collect a list of your custom post types? This is being used in the admin side and the code exists inside a plugin. I've got a custom post type, though this should be the same question for regular posts. Essentially, I want a pulldown which has all of the posts (under a custom post type) sorted by a person's name. The tough part, the name is stored as a custom post meta (custom field). I could simplify things and make the post title (currently ignored and unused) be the person's name. There is no relevant code to supply, this is just a general question aimed at fellow plugin developers. Is there a function that collects posts in to an array or object?


title: Functions.php Problem

text: When I add lines 3 - 19 to the top of functions.php, then try to update image.php **I get the error "Warning: Cannot modify header information - headers already sent" when I try to update my image.php.** The code on lines 3 - 19 creates custom next/previous links for my image gallery and redirets the last one to a "more galleries" page. My code can be seen here: http://pastebin.com/Yen04t2z


title: Function that outputs second theme url

text: I have a multisite and need a function (added to functions.php) that will get the template url of the second theme (probably by name or other identifier)? Example: theme-1 (used by main site) contains function to get url of theme-2 (theme-2 is used by sub-sites) Thanks


title: Problem with $post_id object's property

text: Dealing with retrieving CPT metadata I find out two methods `get_post_meta()` and `get_post_custom()` to return the value(s) of the custom fields with the specified key from the specified post. Both methods are passing the `$post_id` as first parameter to access global `$post` object's ID property. Now my question is, how does WordPress figure out which CPT or POST we are asking for? For example at following example how does WordPress understand which post we are talking about               function save_options(){       global $post;       if (!isset($_POST['price']) || $post->post_type != 'product')       {         return $post;       }       update_post_meta($post->ID, "price", $_POST['price']);


title: Custom post types and permalink

text: I’m looking for a way to solve my problem with permalinks in wordpress. I have 3 post types: news (default), posttype1, posttype2 all 3 uses the standard category. I added 3 categories in it: cat1, cat2, cat3 What I want is this: www.mywebsite.com/posttype1 : show all posts of « posttype1 » www.mywebsite.com/posttype1/cat1 : show all posts of « posttype1 » that are in category « cat1 » www.mywebsite.com/posttype1/cat1/post-name : show the post named « post-name » in « posttype1 » that is in category « cat1 » and apply that rule to all 3 post types… I’ve tried almost everything about rewriting rules in function.php, but can’t find any solution. And if I put /%category%/%postname%/ in permalink settings, it actually works well for the default post type, but don’t work for both custom post types: the category is not taken into account. I’ve tried to install the Custom Post Type Permalinks plugin, but here again the category is not taken into account. This is actually what I have in my functions.php (for posttype1)               register_post_type(‘posttype1’, array(       'label' => __(‘Posttype1’),       'singular_label' => __(‘Posttype1’),       'public' => true,       'show_ui' => true,       'capability_type' => 'post',       'hierarchical' => true,       'menu_position' => 4,       'supports' => array('title', 'editor'),       'rewrite' => array('slug' => 'posttype1', 'with_front' => false),       'has_archive' => true,       'taxonomies' => array('category')     ));


title: Front-End Interfaces Without Shortcodes

text: So, I consider myself a "advanced novice" at WordPress development but I still do not have the concept of pages and templates fully understood. I'm having an issue with a feature I'm attempting to include in my plugin and discovered that it's possibly due to the way I am displaying my interfaces on the pages (via shortcodes). Without customizing a theme, how would one display interfaces (grid with interactive functionality) on the font-end? The way my plugin works currently is that it uses shortcodes to house all of my php code that performs the work to display my interfaces and those shortcodes are added as content to pages that my plugin creates upon activation. Is there another way to do this?


title: How to structure a plugin into multiple files using classes?

text: I am writing my first simple plugin from scratch so I'm looking for a bit of advice on structuring the classes within the plugin. I encapsulated some basic functions in a class in the main plugin file but I guess it will become quite ungainly with a lot of functions in a single file. The structure of my plugin directory so far looks like this: **inc**     -core.php     -plugin-settings.php   **css**     -style.css   **lang**   plugin-file.php One thing that I have struggled with is structuring plugin into multiple files using classes. The code of main plugin file is:               <?php     /**     * Plugin Name: Plugin name     * Plugin URI: http://someurl.com     * Description: Some description     * Version: 1.0     * Author: Me     * Author URI: http://someurl.com     */     define( 'SBP_DIR', plugin_dir_path( __FILE__ ) );   // Defining plugin dir path.     /*----------------------------------------------         Including Files     ----------------------------------------------*/     include(SBP_DIR_DIR . 'inc/core.php');              // main plugin functions     include(SBP_DIR_DIR . 'inc/plugin-settings.php');   // the plugin options page HTML     /*----------------------------------------------         Class Dummy_Class     ----------------------------------------------*/     global $sbp_class;     if ( !class_exists("Dummy_Class") ) {         class Dumy_Class {     /*----------------------------------------------         Function Construct     ----------------------------------------------*/             function __construct() {                 $this->path = plugin_basename(__FILE__);                 add_action( 'init', array( $this, 'init' ) );                 add_action('admin_enqueue_scripts',  array( $this, 'enqueue' ) );                 add_filter("plugin_action_links_$this->path", array( $this, 'sbp_settings_link' ) );             }     /*----------------------------------------------         Function init     ----------------------------------------------*/             function init() {                 load_plugin_textdomain( 'sb-pack', false, basename( dirname( __FILE__ ) ) . '/lang' );  // load plugin textdomain             }     /*----------------------------------------------         CSS style of the plugin options page     ----------------------------------------------*/             function enqueue($hook) {                 global $sbp_settings_page;                 if ( $hook != $sbp_settings_page )  // load stylesheet only on plugin option page                     return;                 wp_enqueue_style('styles', plugin_dir_url( __FILE__ ) . 'css/styles.css');             }     /*----------------------------------------------         Add settings link on plugins page     ----------------------------------------------*/             function sbp_settings_link($links) {                 $settings_link = 'Settings';                 array_unshift($links, $settings_link);                 return $links;             }              }   //End class Dummy_Class         $sb_pack = new Dummy_Class; // instantiate the plugin class     }   //End if (!class_exists("Dummy_Class"))      I want to mention that core.php file contains what the plugin does, ie some several functions. My questions are:   1. How should be included the _core.php_ and _plugin-settings.php_ files within the main plugin file?   2. Those files should have unique classes too? How YOU would structure them and why? I do not have in-depth knowledge of OOP so I need a little bit of step by step instruction. Any thoughts would be appreciated.


title: Add the post type to the title of the page

text: How can I add the custom post type to the title of the page, I mean the title in the tag in the header. It should look something like this: Webpage name | Products > Sony Playstation 4 Thanks ahead!


title: Can't access dashboard, connection times out (other pages work fine)

text: I have a multisite Wordpress installation with 2 blogs, on different domains. One of them works fine, but I just realized that for the other, I can't access the admin area. I can log in, but when accessing /wp-admin the request never returns and eventually times out. It was working fine the last time I tried (a few weeks ago), and I didn't make any changes since then... What could be causing this? How can I get more info to help diagnose the problem? I can't find any logs on the server... EDIT: I was using Firefox when I saw this problem; I just tried again in Chrome, which seems to have a longer timeout, and the dashboard finally appeared. The other admin pages seem to work fine, but the dashboard takes a very, _very_ long time to load. BTW, I'm running Wordpress 3.3.2 on IIS.


title: Email verification feature in wordpress social login plugin

text: I'm using wordpress social login plugin.. It uses HybridAuth library. Here is a demo of HybridAuth library. The wordpress plugin looks nice. But it generates a random email for most of the social sites. This plugin doesn't offer email verification for the sites which doesn't offer verified email address. I mean the plugin says > Currently only Facebook, Google, Yahoo and Foursquare do provide the > verified user email So for other sites it generates a random email address. This is the code which generates random email               // generate an email if none             if ( ! isset ( $user_email ) OR ! is_email( $user_email ) ){                 $user_email = strtolower( $provider . "_user_" . $user_login ) . "@example.com";             }                  // email should be unique             if ( email_exists ( $user_email ) ){                 do                 {                     $user_email = md5(uniqid(wp_rand(10000,99000)))."@example.com";                 } while( email_exists( $user_email ) );             }       I want all my accounts in my sites to be verified. So instead of generating random email I need a function that popup a form by asking the user to fill his/her email address. And then when a user click submit it should send a confirmation link or randomly generated password to their email. Can anyone help me to implement this.? Here is the full code which process the signup/login


title: Cloning add_settings_field() with jQuery

text: Is it possible to setup one add_settings_field() in an options backend and then use jQuery clone function on the front end and be able to create multiples of whatever and save that in an array? I've been doing countless research with no luck, wondering if it is even possible.


title: WooCommerce Grid / List view

text: Is there any experience with Woocommerce Grid / List view plugin, I set to automatically start the list view but the problem is that while the page is loading initially opens a grid view and instantly change to list view, it takes 1 second but it seems confusing.Is there any idea how it could be resolved? I took the code from the following link               jQuery(document).ready(function(){         jQuery('ul.products').addClass('list');     });


title: List latest posts in WP-Admin

text:
I run a multiple author site and I have created a plugin in wp-admin where authors can connect and collaborate with each other. To enhance it, I want to display a list of latest posts, this list should look like this: ![Latest posts](http://i.stack.imgur.com/daKPe.png) As the picture shows, the list should contain the latest 10 posts with the Username, the post title linked and when it was posted (either how long ago or the exact time of post). The HTML for this should be:

User	Post	Time

User	Post	Time

                         Username	                         Post title	                         8 hours ago

      How can I create a list like this? Note that this list will be used in wp- admin only.


title: Bulk move (or copy) from a custom field to the post content?

text: I need to move (or copy) the contents of a custom field into the main post body, replacing any existing content. I need to do this for a few hundred posts...Is there a quick way of doing this? I can manage moving values from one meta field to another in SQL, but i'm not sure how to do this with post content... If anyone could give me some pointers that would be much appreciated.


title: Hide Front-End Admin Bar Including 32 px Spacing

text: I have a custom template and I inserted the following snippet to get rid of the admin bar for the page:               function hide_admin_bar(){ return false; }     add_filter( 'show_admin_bar', 'hide_admin_bar' );      The problem is this still leaves a blank white empty bar at the top of the page with a height of 32px. Looking at core, I see this function but there is no way to disable it. I also tried overriding `html { margin-top: 0 !important; }` in my theme stylesheet to no avail since this is output on the page directly.               function _admin_bar_bump_cb() { ?>     <style type="text/css" media="screen">         html { margin-top: 32px !important; }         * html body { margin-top: 32px !important; }         @media screen and ( max-width: 782px ) {             html { margin-top: 46px !important; }             * html body { margin-top: 46px !important; }         }     </style>      Does anyone have a clean way to completely remove the admin bar from the top of a specific template page (plus the white space)?


title: Role Scoper, don't allow other users to see pending posts

text: I have noticed in Role Scoper recently (sure it wasn't always like this) that contributors can see all the pending posts of all users. Basically I have it set up so users have to submit their posts for review. But I don't really want any posts to be public in any way other then to admins and the user them self until it's been approved. Can't figure out how I'd set that in role scoper, any ideas?


title: How to operate two wordpress databases simulataneously?

text: I am having a situation, where i have two wordpress sites. One is for saving the data and content and other is for showing the data/content. Now the situation is, i want a user to register on one site, it will be automatically registered on other. I know we can do it with custom mysql query for insert into wp_users and wp_usermeta, but i want to use the wordpress function like update_user_meta and wp_create_user. But if i am on first site and user update_user_meta etc. it will take the current site's database. So i want to know if there is any way so that we can user same function but works on different site ? I guess may be we can have two $wpdb object with different database access. So that we can use functions like:               $wpdb->update_usermeta();  //for source site     $wpdb1->update_usermeta(); //for destination site.      Any suggestions please ?


title: Why Transients may not work correctly?

text: I have a plugin that needs to check for update. Function below - get_version_to_update is fired when someone enters plugin admin page. In theory after request is done, data should be cached via transients for 24h. And this works for most sites, but for some specific sites I get data that wp_remote_request fires over and over, which (as I think) means that transient isn't saving. Why this might happen? Is there more reliable way to check this?               public function get_version_to_update(){              // I get the transient         $data = get_transient("my_plugin_remote_version");              // I check if it exists         if($data === false){             // here I get data from server using wp_remote_request, server return just version number, e.g. "2.0"                $data = wp_remote_request(...);                  // I cache it for 24h             set_transient("my_plugin_remote_version", $data, 60 * 60 * 24);         }               // I check if returned data from server is correct          if ( !$data || is_wp_error( $data ) || 200 != $data['response']['code']) {             return false;          } else {             if( version_compare(MY_PLUGIN_VERSION, $new_version, '<') ) {                         // return new version, if it's newer then current                  return $data['body'];             } else {                 return false;             }          }     }      This issue is killing me, thank you for any help!


title: importing wp_users table as a way to import users into new site?

text: I have a completely new build of a site and am trying to import existing users into the new site. I have a plugin that allows extra fields at registration so was thinking the best way to keep things intact would be to export the wp_users and wp_usersmeta table from the old site and import into the new. However am not sure if this will cause complications with comments or other issues with the database in general - doesn't seem wise inb principle as other tables may be linked to wp_users etc and cause corruption?


title: how to use thickbox in admin?

text:
I would like to show my retrieved content form my classes method in thickbox. How could I do this? I have been adding the proper id to my desired hyperlink but all of the admin body is getting parsed inside of the thickbox.               Click               calss myAdmin{          public function__construct(){          }          public function myfunction(){          echo '
The content of my thickbox
';          }          }


title: How can I make a wp site in a mobile application?

text: Which are the ways and how is possible a wp site become an iphone, ipad, android and a blackberry application(not a wp mobile theme)?


title: Create plugin/function to catch XML-data via Shortcode

text: I need to display data from an XML-file inside Wordpress posts, and I want to use shortcodes to do it. I have this XML-file witch I need to get the data from; > >     http://xml.prisguide.no/productExport.php?productId=151690 >   I would like to have a shortcode e.g. `[prisguide id="151690"]`, and then the product information (limited to name, price, basic information etc) from the XML-file will display in the post. How can I achieve this?


title: User Meta not Updated?

text: I've gone in and give custom meta fields for the users in the database, and have assigned all the appropriate values to them. I also have a page set up with all of the users being displayed with the custom meta values. However, upon refreshing the page that the users are displayed on, the custom meta doesn't seem to be displaying. Going back to each individual users profile, I can see that the meta is preserved, and upon clicking save changes, the custom meta data is _then_ applied. Is there some sort of cache that needs to be cleared in order for WordPress to get the metadata without updating each user individually? Or is there some way for all meta data to be saved all at once?


title: Using do_shortcode with variables?

text: Struggling to get the format right for the PHP in this do_shortcode embed using variables from Advanced Custom Fields plugin. I think I've tried every variation on ., ', and ". After reading every resource I could find I'm still no closer.               <?php          $address = get_field('cong_streetaddress');         $city = get_field('cong_city');         $province = get_field('cong_province');         $postalcode = get_field('cong_postalcode');              echo do_shortcode('[pw_map address="'" . $address . " . " . $city . " . " . $province . " . " . $postalcode . "'" width="100%" height="200px"]');      ?>      Doing it with just one variable, like so `echo do_shortcode('[pw_map address="'. $postalcode . '" width="100%" height="200px"]');` works fine.


title: How do I make a wordpress plugin with menu item etc

text: I've been reading documents, viewing videos, etc. on how to create a Wordpress plugin. I've learned how to filter a post, add txt to a post, use conditionals to see if the page is a single post as not to display text throughout the entire site, etc. The part that I'm not understanding is how to create a plugin, with it's own menu item that will bring the user to this plugin that im creating. Lets say for example my plugin should be a blank page (with Wordpress header, footer, etc.) that simply displays 'Hello World!' - How do I create this very simple plugin, on its own page (not seen all over the site) with its own menu button that brings the user to this plugin? Do I create a template and a menu item that links to the template? I'm so confused... I found how to 'Create page' in the admin section, but that seems to only create a menu item that corresponds to a blank page where I can add html. I can't seem to even find any plugin examples where this is done, but I would think it would be relatively easy to create a plugin that has a menu item so visitors know how to get to the plugin. If I wanted to create a simple plugin so visitors to my Wordpress can click a menu item called 'Bicycle races' and be brought to my plugin page where they can view the output of my plugin, a list of bicycle races in this case, how would I accomplish this? Do I create a simple plugin, or do I create a template as well? Please help me locate any possible plugin examples where this is accomplished. Thanks


title: Filtering wp_title() in WordPress

text: I am using this in header file of my site.               <title><?php wp_title( '|', true, 'right' ); ?></title>      But it is displays '|' at the end of title on all the pages of site like this               <title>Our Company - SEO Company 1SEOIN |</title>      I want to remove this '|'. How can I do this?


title: How do I begin debugging where the description meta tag is set for my categories?

text:
I have the code base for my Wordpress theme, but where do I start debugging where the meta description tag is set for my theme. What I need to do is make it not be set because I set my descriptions in the Yoast plugin. I did a grep for this:               "<meta name=\"description\""      But the files it returned didn't seem to be the ones I needed. Would anyone know what is the right way to locate where the description tag for categories is set in the theme? I am using a Suffusion theme. EDIT: This is my header.php               <?php     /**      * Core header file, invoked by the get_header() function      *      * @package Suffusion      * @subpackage Templates      */          global $suffusion_unified_options, $suffusion_interactive_text_fields, $suffusion_translatable_fields, $suffusion_skin_dependence, $suf_color_scheme;     if (function_exists('icl_t')) {         foreach ($suffusion_unified_options as $id => $value) {             /**              * Some strings are set interactively in the admin screens of Suffusion. If you have WPML installed, then there may be translations of such strings.              * This code ensures that such translations are picked up, then the unified options array is rewritten so that subsequent calls can pick it up.              */             if (function_exists('icl_t') && in_array($id, $suffusion_translatable_fields) && isset($suffusion_interactive_text_fields[$id])) {                 $value = wpml_t('suffusion-interactive', $suffusion_interactive_text_fields[$id]."|".$id, $value);             }             global $$id;             $$id = $value;             $suffusion_unified_options[$id] = $value;         }     }          $queried_id = get_queried_object_id();     $hidden_elements = array();     if ($queried_id != 0) {         $hide_top_navigation = suffusion_get_post_meta($queried_id, 'suf_hide_top_navigation', true);         if ($hide_top_navigation) {             add_filter('suffusion_can_display_top_navigation', 'suffusion_disable_component_for_view');             $hidden_elements[] = 'no-top-nav';         }         $hide_main_navigation = suffusion_get_post_meta($queried_id, 'suf_hide_main_navigation', true);         if ($hide_main_navigation) {             add_filter('suffusion_can_display_main_navigation', 'suffusion_disable_component_for_view');             $hidden_elements[] = 'no-main-nav';         }         $hide_header = suffusion_get_post_meta($queried_id, 'suf_hide_header', true);         if ($hide_header) {             add_filter('suffusion_can_display_header', 'suffusion_disable_component_for_view');             $hidden_elements[] = 'no-header';         }         $hide_footer = suffusion_get_post_meta($queried_id, 'suf_hide_footer', true);         if ($hide_footer) {             add_filter('suffusion_can_display_site_footer', 'suffusion_disable_component_for_view');             $hidden_elements[] = 'no-site-footer';         }     }     ?>     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">     <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>                   <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />         <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />          <?php         suffusion_document_header();         $suffusion_pseudo_template = suffusion_get_pseudo_template_class();         if (is_singular()) {             wp_enqueue_script('comment-reply');         }         $skin = isset($suf_color_scheme) ? $suf_color_scheme : 'light-theme-gray-1';         $extra_classes = $suffusion_pseudo_template;         if (isset($suffusion_skin_dependence[$skin])) {             $extra_classes = array_merge($extra_classes, $suffusion_skin_dependence[$skin]);         }         $extra_classes[] = $skin;         $extra_classes = array_merge($extra_classes, $hidden_elements);         wp_head();       ?>               <body <?php body_class($extra_classes); ?>>         <?php suffusion_before_page(); ?>             <?php                 suffusion_before_begin_wrapper();             ?>
             <?php                 suffusion_after_begin_wrapper();             ?>
                     <?php                         suffusion_after_begin_container();                     ?>      EDIT 2: When I did a grep for `suffusion_document_header`, I got these results:               /Users/owner12/Desktop/G33kTalk/wp-content/themes/suffusion/functions (1:11:13 6:44 PM).php:    add_action('suffusion_document_header', 'suffusion_include_ie7_compatibility_mode');     /Users/owner12/Desktop/G33kTalk/wp-content/themes/suffusion/functions (1:11:13 6:44 PM).php:    add_action('suffusion_document_header', 'suffusion_set_title');     /Users/owner12/Desktop/G33kTalk/wp-content/themes/suffusion/functions (1:11:13 6:44 PM).php:    add_action('suffusion_document_header', 'suffusion_include_meta');     /Users/owner12/Desktop/G33kTalk/wp-content/themes/suffusion/functions (1:11:13 6:44 PM).php:    add_action('suffusion_document_header', 'suffusion_include_favicon');     /Users/owner12/Desktop/G33kTalk/wp-content/themes/suffusion/functions (1:11:13 6:44 PM).php:    add_action('suffusion_document_header', 'suffusion_include_default_feed');     /Users/owner12/Desktop/G33kTalk/wp-content/themes/suffusion/functions.php:  add_action('suffusion_document_header', 'suffusion_include_ie7_compatibility_mode');      EDIT 3: This is the seo.php               <?php     /**      * This file handles SEO in Suffusion. It is not to be loaded directly, but is instead loaded from different templates.      * Users can override this in a child theme by creating a file in an "inserts" directory called seo.php.      *      * @package Suffusion      * @subpackage Templates      */          global $suf_seo_enabled, $suf_seo_all_settings;     if ($suf_seo_enabled == 'enabled') {         $seo_settings = explode(',', $suf_seo_all_settings);         if (is_array($seo_settings)) {             if (in_array('generator', $seo_settings)) {                 wp_generator();             }                  if (in_array('theme', $seo_settings)) {                 $theme_data = get_theme_data(get_template_directory().'/style.css');                 echo "\t".'<meta name="template" content="'.esc_attr("{$theme_data['Title']} {$theme_data['Version']}").'" />'."\n";             }                  if (in_array('robots', $seo_settings) && get_option('blog_public')) {                 echo "\t".'<meta name="robots" content="noindex,nofollow" />' . "\n";             }                  if (in_array('author', $seo_settings)) {                 global $wp_query;                 if (is_singular()) {                     $author = get_the_author_meta('display_name', $wp_query->post->post_author);                 }                 else {                     $posts_on_page = $wp_query->posts;                     $author_array = array();                     foreach ($posts_on_page as $single_post) {                         $single_author = get_the_author_meta('display_name', $single_post->post_author);                         if (!in_array($single_author, $author_array)) {                             $author_array[] = get_the_author_meta('display_name', $single_post->post_author);                         }                     }                     $author = implode(',',$author_array);                 }                      if ($author) {                     echo "\t".'<meta name="author" content="'.esc_attr($author).'" />' . "\n";                 }             }                  if (in_array('copyright', $seo_settings)) {                 if (is_singular()) {                     $copy_date = sprintf(get_the_time(get_option('date_format')));                 }                 else {                     $copy_date = date('Y');                 }                 echo "\t".'<meta name="copyright" content="'.sprintf(esc_attr__('Copyright (c) %1$s', 'suffusion'), $copy_date).'" />'."\n";             }                  if (in_array('revised', $seo_settings)) {                 if (is_singular()) {                     $mod_time = sprintf(get_the_modified_time(get_option('date_format')." ".get_option('time_format')));                     echo "\t".'<meta name="revised" content="'.$mod_time.'" />'."\n";                 }             }              }              global $suf_seo_meta_description, $wp_query;         if (is_home()) {             $description = $suf_seo_meta_description;         }         else if (is_singular()) {             $description = suffusion_get_post_meta($wp_query->post->ID, "meta_description", true);             if (empty($description) && is_front_page()) {                 $description = $suf_seo_meta_description;             }         }         else if (is_category() || is_tag() || is_tax()) {             $description = term_description('', get_query_var('taxonomy'));         }         else if (is_author()) {             $description = get_the_author_meta('description', get_query_var('author'));         }         if (!empty($description)) {             $description = stripslashes($description);             $description = strip_tags($description);             $description = str_replace(array("\r", "\n", "\t"), '', $description);             $description = "\t".'<meta name="description" content="' . $description . '" />' . "\n";             echo $description;         }              global $suf_seo_meta_keywords;         if (is_home() || is_category() || is_tag() || is_tax() || is_author()) {             $keywords = $suf_seo_meta_keywords;         }         else if (is_singular()) {             $keywords = suffusion_get_post_meta($wp_query->post->ID, "meta_keywords", true);             if (empty($keywords)) {                 $keywords = $suf_seo_meta_keywords;             }         }              if (isset($keywords) && !empty($keywords)) {             $keywords = stripslashes($keywords);             $keywords = strip_tags($keywords);             $keywords = str_replace(array("\r", "\n", "\t"), '', $keywords);             $keywords = str_replace(array(", ", " ,"), ',', $keywords);             $keywords = "\t".'<meta name="keywords" content="' . $keywords . '" />' . "\n";             echo $keywords;         }     }     ?>


title: Do I use cookies?

text: I have made website in wordpress, and now client wants to know do this website use cookies? I dont know too much about it becouse i never use it, but i need to be sure. If I make websites i use session, and I quess the same is in wordpress, but as I said, dont know too much about it and client need this information. I also use PIWIK stats. Is there a way to check it? I can give you list of plugins I used.


title: Theme Advanced Styles in Visual Editor and Paragraphs

text: After i add these codes to functions.php:               add_editor_style();          function childtheme_mce_btns2($orig) {     return array('formatselect','styleselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'media', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' );     }     add_filter( 'mce_buttons_2', 'childtheme_mce_btns2', 999 );          function childtheme_tiny_mce_before_init( $init_array ) {     $init_array['theme_advanced_styles'] = "box note=box_note;box info=box_info;box warning=box_warning;box download=box_download";     return $init_array;     }     add_filter( 'tiny_mce_before_init', 'childtheme_tiny_mce_before_init' );      I had a style drop down menu in Wordpress Visual Editor with "box note,box info,box warning,box download" options. I created editor-style.css so i got css support for those classes in visual editor. If i select "box note" style example, wordpress putting it as `<p class="box_note"></p>` Problem is when i push enter button for line breaking, wordpress putting `<p></p>` automatically. Basically how can i change those styles using `<div> <span>` or anything except `<p>`? **Update:** I create some screenshots for you. This is when i select style from style list: http://www.unsalkorkmaz.com/sorun/sorun1.jpg This is when i push enter button for line breaking: http://www.unsalkorkmaz.com/sorun/sorun2.jpg Wordpress basically creating different `<p>` I tried;               remove_filter('the_content', 'wpautop');     remove_filter('the_content', 'wptexturize');     remove_filter('the_content', 'convert_smilies');     remove_filter('the_content', 'convert_chars');      before i create this question but its not the solution seems. **Update 2:** Well.. I tried shift+enter to line-break and it works! So i dont know what is difference with enter vs shift+enter in TinyMCE but i want shift+enter function as default of enter button.


title: add_action for publish_post doesn't work

text: I'm working on a personal voting plugin, I don't intend to release it publicly because I'm still learning WP. In general, you can vote posts "up" or "down". I have 2 tables, one collects IPs (to disallow voting multiple times) and another table named "post_votes" collects the number of votes for each post. When I publish a new post its ID is stored in "post_votes" and I can update the "up", "down" for each post when people vote. This worked a few days ago. I did some modifications and I can't figure out why it's not working anymore.. This is the entire code so far.. I still need to implement some security precautions.               <?php     /*     Plugin Name: Vote Posts     */          global $vote_posts_version;     $vote_posts_version = "1.0";          function vote_posts_install () {             global $wpdb;        global $vote_posts_version;             $table_1 = $wpdb->prefix . "voter_ips";        $table_2 = $wpdb->prefix . "vote_posts";              if($wpdb->get_var("SHOW TABLES LIKE '$table_1 AND $table_2'") != $table_1 && $table_2) {                $sql = "CREATE TABLE " . $table_1 . " (           id bigint(20) NOT NULL AUTO_INCREMENT,           vote_post_id bigint(20) NOT NULL,           voter_ip varchar(100) NOT NULL,           UNIQUE KEY id (id)           );";                 $sql2 = "CREATE TABLE " . $table_2 . " (           id bigint(20) NOT NULL AUTO_INCREMENT,           vote_post_id bigint(20) NOT NULL,           up int(11) NOT NULL,           down int(11) NOT NULL,           UNIQUE KEY id (id)           );";                require_once(ABSPATH . 'wp-admin/includes/upgrade.php');           dbDelta($sql);           dbDelta($sql2);                add_option("vote_posts_version", $vote_posts_version);        }             }          register_activation_hook(__FILE__,'vote_posts_install');               //add and delete votes          function add_votes($post_ID)  {     global $wpdb;        if (!($wpdb->get_row("SELECT vote_post_id FROM wp_vote_posts WHERE vote_post_id = $post_ID" ) ) ) { //if not exists add post ID to table           $wpdb->insert( $wpdb->prefix . 'vote_posts', array( 'post_id' => $post_ID ) );           return $post_ID;        }     }     add_action ( 'publish_post', 'add_votes' ); //should trigger function on publish post          function delete_votes($post_ID)  {         global $wpdb;         $wpdb->query("DELETE FROM wp_vote_posts WHERE vote_post_id = $post_ID");         return $post_ID;     }     add_action ( 'delete_post', 'delete_votes' ); //deletes row from post_votes table when a post is deleted from the WP panel          ?>      It successfully creates the 2 tables but doesn't insert the post ID on action


title: Custom post type - get_day_link()

text: How can I get the archive links for a custom post type? get_day_link() doesn't seem to work


title: How to show only images with a certain tag with NextGEN gallery plugin?

text: As described, how can I show only the images with a certain tag on a Wordpress blog that use `NextGEN Gallery` as gallery plugin? NextGEN Gallery version is 1.5.5 but I can upgrade to 1.6.2 (last) if necessary. I would like to display images with a specified tag on a new Wordpress Page.


title: On click hide group of metabox, similar to screen options checkbox?

text: I have several metaboxes in the edit screen. I would also create another metabox where the user can click on a checkbox then it hides a set of metaboxes, similar to the Screen Options functionality, only when the checkbox is clicked, it hides/toggles a group of metaboxes. Does anybody know how to approach this? If not, what's the code used by the Screen Options menu that dictates on click,hide metabox. ? Thanks.


title: How to use Canonical URL meta tag to avoid duplicate content issues with WP home pages

text: By default, Wordrpess sites have at least 2 URLs that can be used to reach the home page:               www.site.com/     www.site.com/hello-world      Both these URLs point to the same page, the default "hello world" post that WordPress creates. How can theme developer's specify a canoninical url meta tag to suggest to search agents which URL it should index in the above example? In your answer, please include an example for each choice: one in which site.com is preferred and one in which site.com/hello-world is preferred.


title: How to customise the output of the WP image gallery shortcode from a plugin?

text: We're building a plugin that displays posts, and we also want to display the image gallery when it is used in a post. However, we need to limit the number of photos displayed? Is that possible?


title: Use of IF statement in Header file

text: I have a custom page template created. When I load my page, it shows the header logo of the mainpage but what I want to achieve is for each custom template created, I want it to only show its own logo. This is the bit of the header code that calls the logo.php file:               <?php get_template_part('parts/logo', 'top') ?>      This is what I have tried but not working               <?php if ( is_page('custom-page')) {         get_template_part ('parts/custom-logo', 'top');     } else {         get_template_part('parts/logo', 'top');     } ?>      Any help will be much appreciated. Thanks


title: wordpress: only admin can access wp-content folder

text: as wp-content/ upload folder has public access and is accessible through url. for example: http://site.com/wp-content/uploads/2014/02/test.pdf i want to make it accessible by admin only.. it can not be accessible through url. for that i put .htaccess code:                 Order deny,allow     Deny from all     <Files ~ ".(xml|css|jpe?g|png|gif|js)$">     Allow from all     </Files>      above code not allow access to pdf and docx file of wp-content folder. if admin try to access it through admin it gives 403 forbidden error. **how can i make it accessible by admin only. ?**


title: WP Plugin for Terms of Use

text: Looking for a plugin to ensure that casual (NOT logged in) users of my site will agree to the Terms of use. That is, first time they try to access ANY page on site, display terms and prompt for agreement. If suer agrees, store that in DB (preferable) or cookie. I cam across "Terms of Use" plugin, but it has not been updated in over a year and I am not sure it supports my scenario. TIA for any help. Jackie


title: Upgrading a custom theme through the Dashboard

text: I can't seem to upgrade my custom theme. Whenever I try to uploaded a new package, all I get is: > Unpacking the package…   >  Installing the theme…   >  Destination folder already exists. /wp-content/themes/THEMENAME/   >  Theme install failed. I've searched and all I can find is people recommending upgrading over FTP. Sadly, I don't have FTP access right now, but also using FTP appears to be a dirty solution. I can obviously delete and re-install the theme, but that seems very dirty, too. How can I update a theme through the Dashboard?


title: Get a list of categories ids

text:
I'm working on a portfolio with filters based on custom post type. That filters must display only categories for the posts that are displayed in the portfolio, since user can specify them by id in the shortcode - [portfolio ids="1,2,3"] And I can't get a list of that categories ids. Here is a simple example of what I'm trying to do: A list of custom post ids from the shortcode:               $ids      An array of the same ids:               $id_array = explode(',', $ids)      A var of interest that must return a list of categories ids:               $cat_ids = ???        Next we get only categories with needed id:               $categories = get_categories(             array(                 'include' => $cat_ids,                 'taxonomy' => 'portfolio_category'             )         );      And finally have our categories displayed:               echo '
';             echo '
all
';             foreach ($categories as $category) {                 if( isset( $category->term_id ) ){                     echo '
category_nicename.'">'.$category->cat_name.'
';                 }             }         echo '
';      The cloasest what i get was:               $cat_ids = wp_get_object_terms( $ids, 'portfolio_category', array('orderby' => 'name', 'fields' => 'ids') );      But it returns only one id


title: Get variable value based on string constant

text: In my plugin I define a constant as follows: `define('DEFAULT_NUM', 5);` I also define a constant representing the name by which I want to refer to this number: `define('DEFAULT_NUM_NAME', 'numitems');` My plugin has a shortcode that uses these values as follows:               function do_something($atts) {       extract( shortcode_atts( array(           DEFAULT_NUM_NAME => DEFAULT_NUM           ), $atts ) );      I do this so I can change variable values in one place, instead of hardcoding them:               function do_something($atts) {       extract( shortcode_atts( array(           'numitems' => 5           ), $atts ) );      The `extract` function will convert the string 'numitems' into a variable called `$numitems`. So the rest of my code has to look like this:               if ($numitems == 5) {      return 'blah blah';     }      In effect, I am hardcoding the variable's name because I have to use whatever name I defined. I would like to retrieve the value of the variable without having to use it. In other words, I want to leverage the constant name to determine the value passed to the plugin, without having to use the variable. Is this possible? Or is my approach wrong? (FYI This is a test case based on an actual plugin. These are not the actual variable names.)


title: WooCommerce custom query and paging: Not Found error

text: I'm experiencing a problem with the following piece code:               global $wp_query;          $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $filter_args['paged'] = $paged;     $filter_args['posts_per_page'] = 2;          $args = array_merge( $wp_query->query_vars, $filter_args );     query_posts( $args );      This code is located at **archive-prodcut.php** file, inside of my theme/woocommerce folder. It works correctly in order to show first 2 products and also to show WooCommerce pagination on the bottom.               do_action( 'woocommerce_after_shop_loop' );      However, when I click on each of the pages I'm getting a "Not found" error. When I tried putting an echo on the top of the archive-prodcut.php file I realized that it doesn't load. The url looks like www.site.com/product- category/cat-name/page/2 Thanks in advance!


title: Multiple If else statements on Search Result Page

text: Ok, I have a few CPT's setup with a metabox that only requires some values for some categories. When searching a specific category, I want to display a link to the value (which is a url) if it exists and not show it if it doesn't. What I have right now show's all three buttons whether the value exists or not. Anyone know how I can display just one read more button depending on whether or not the meta value exists?                   <?php if( get_post_meta($post->ID, 'recent_action', true) ) { ?>                      <a class="button" href="<?php echo get_post_meta($post->ID, "recent_action", true); ?>">Recent Action Link                      <?php } ?>                      <?php if( get_post_meta($post->ID, 'related_link', true) ) { ?>                      <a class="button" href="<?php echo get_post_meta($post->ID, "related_link", true); ?>">Related Link                      <?php } ?>                      <?php if( get_post_meta($post->ID, 'imp_docs_link', true) ) { ?>                      <a class="button" href="<?php echo get_post_meta($post->ID, "imp_docs_link", true); ?>">Important Documents Link                      <?php } ?>


title: Responsive Embeds using default embed shortcode

text: Can someone explain how to make embed shortcode responsive? http://codex.wordpress.org/Embeds


title: Display all posts for taxonomy term across multiple custom post types

text: I'm currently creating a website that uses several content types, (e.g. books, movies, shows) as well as a key taxonomy term (e.g. status, with values of owned and wishlist). My question is, in a custom template how do I create a loop that queries only one taxonomy value across multiple custom post types (i.e. a single list of all of the books, movies and shows on my wishlist.) The closest I could find was this post Using Query Posts With Multiple Post Types And A Taxonomy But unfortunately, I am having a hard time making it work as is in my template. And, ideally I'd prefer to use a wp_query instead of get_posts.


title: Cannot Modify Header Information - While trying logging in

text: I am having the same issue as cited on: Cannot modify header information - headers already sent (Theme Specific : functions.php) Can you give me a help on that. I am using Optimize Press Theme This is the error: > Warning: Cannot modify header information - headers already sent by (output > started at /home/talent31/public_html/domain.com/wp-includes/general- > template.php:2102) in /home/talent31/public_html/domain.com/wp- > includes/option.php on line 568 > > Warning: Cannot modify header information - headers already sent by (output > started at /home/talent31/public_html/domain.com/wp-includes/general- > template.php:2102) in /home/talent31/public_html/domain.com/wp- > includes/option.php on line 569


title: WordPress 3.6 native player is not responsive?

text: Using wordpress 3.6 and can embed video in pages/posts. But These videos are not responsive. Is there a way to make them responsive? I found a style="width:100%; height:100%" method for media element player but don't know how to use it with video tag.


title: Noindex,Nofollow in theme's header.php?

text: My theme's header.php file contains this :               <?php if (is_search()) { ?><meta name="robots" content="noindex, nofollow" /><?php } ?>      What does that mean ? And does it affect my search rankings?


title: is user member of a group, show them categories

text: I want to only display categories e.g. the 'group-1' category to users that are members of a certain buddypress group e.g. 'group-1'. I think I can do this by manipulating this code, and replacing the category number with variables defined by the group membership.               <?php if (is_front_page() && !is_paged()) $posts = query_posts($query_string . '&cat=-12,-13'); ?>      I can't for the life of me find out how to get the variable group membership by name. How could this be done? Thanks!


title: Category page only displaying the posts from a custom type

text:
# Situation I have two cpt:   1. Projects   2. Works In these two CPT I share the same taxonomy 'Category', and the same terms:   1. Architecture   2. Landscape   3. Interior Design I have URLs like               projects/architecture     works/architecture     so on...      # Problem Now the problem is that the two URL above are returning the same content, all the archives of the term architecture, whatever the cpt. Is there a way that `projects/architecture` would only return all the post under **projects** with for term **architecture**? # Note I'm using Custom Post Type Permalinks to use permalink formatted like `/cpt/term/post_title` # Edit Here is my **category template** (category.php)               <?php get_header(); ?>          <?php       /* Queue the first post, that way we know        * what date we're dealing with (if that is the case).        *        * We reset this later so we can run the loop        * properly with a call to rewind_posts().        */       if ( have_posts() )         the_post();     ?>
<?php                   _e( ucwords($post->post_type), 'boilerplate' );               ?>
     <?php       /* Since we called the_post() above, we need to        * rewind the loop back to the beginning that way        * we can run the loop properly, in full.        */       rewind_posts();       /* Run the loop for the archives page to output the posts.        * If you want to overload this in a child theme then include a file        * called loop-archives.php and that will be used instead.        */       ?>
         <?php        get_template_part( 'loop', 'category' );        ?>
        <?php     ?>          <?php get_footer(); ?>      Here is my **category loop** (loop-category.php)               <?php while ( have_posts() ) : the_post(); ?>       <?php       $attachments = get_posts( array(         'post_type' => 'attachment',         'post_parent' => $post->ID,         'orderby' => 'menu_order',         'order' => 'ASC',         'numberposts'     => 1         ) );         ?>         <?php $img = wp_get_attachment_image_src($attachments[0]->ID, 'full');?>
           <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class='th'>             <img src='<?php echo $img[0]; ?>'>             <?php $categories = get_the_terms($post->ID, 'category'); ?>
                                <?php foreach($categories as $category): ?>                 <?php echo $category->name; ?>               <?php endforeach; ?>

<?php the_title(); ?>

     <?php endwhile; ?>


title: WP Installer Redirects to /wp-admin/core/install.php

text: I am trying to install WP for the first time on Ubuntu 12.04 in a clean /var/www directory. I downloaded the latest version. I untarred it in my home directory and then moved it to /var/www. I created the DB and edited the wp- config.php file. When I visit the base URL (an IP address for now), the URL gets rewritten as xxx.xxx.xxx.xxx/wp-admin/core/install.php. But, there is no core directory. What is happening here? Thanks.


title: Read only capability for custom post in admin area

text: I'm actually building custom type to WP and need to be able to restrict post access to some user role, ie. in admin area, collaborators can see posts but can't edit them, just only open them as read-only. I used some plugins (Adminimize and User Role Editor) but, as far as I know, they don't apply to my needs. Does any one give me directions in order to solve this?


title: How to add correct Last update in Postings (the_modified_time)

text: Having little issue with following: We want to add "Last update" after making important corrections or additional text/images to existing Postings.   Using following code (hardcoded) does in a way almost what I want:               Last update <time datetime="<?php the_modified_time('d-m-y'); ?>"> <?php the_modified_time('l  j  F, Y'); ?></time>      But doing in that way it results in showing -always- the so named "Last update", even when it is just published and not been updated at all.   We would love to make it so that it only will be shown when really some updates are done, and the optimum would be as a plugin.   So I must be doing some wrong, is it possible at all and if so, how to do this? _Note:   it is meant for the front-end in Postings and not as a widget in the sidebar, neither for the back-end._


title: Archive templates based on taxonomies

text: I have a custom post type, service-provider, with two taxonomies, area and service. I wanted to make a template based on the taxonomies.               function template_taxonomy($template) {         if (is_archive()) {             if ((is_tax('service') and is_tax('area')) or is_tax('service')) {                 $template = locate_template( array( 'taxonomy_service.php' ) );             } else if (is_tax('area') and !(is_tax('service'))) {                 $template = locate_template( array( 'taxonomy_area.php' ) );             }         }         return $template;     }      The code is pretty simple but my problem is, when I try to visit this URL > http://www.site.com/?service-provider&service=electricians&area=north-shore- > lower the service taxonomy doesn't seem to exist, so it uses the taxonomy_area.php template. Also tried just using the taxonomy_service.php template and it seems like the area taxonomy doesn't exist on that template either. Any ideas?


title: Upgrade a plugin manually using the option "add new"

text: I need to test a upgrade implementation before I upload the code on the repository and be public to everyone, but I can't find how. Replacing the old code for the new code via FTP isn't working because the additional files will be there. I am trying to upload the new plugin through "add new", but wp isn't allowing to upgrade the plugin. Anyone know how to test an upgrade method :               add_filter( 'upgrader_pre_install', 'xxx_plugin_backup', 10, 2 );     add_filter( 'upgrader_post_install', 'xxx_plugin_restore', 10, 2);


title: Custom image sizes without add_image_size()

text: I need a lot of various image sizes in my theme. I know how to add them with the `add_image_size()` function in functions.php. But those defined sizes will create a lot of files for every uploaded image. Even if the images don't need all of the sizes but only certain ones, depending on where in the theme they get used. Isn't this a huge waste? So I thought I do this in my theme:               the_post_thumbnail(array(258, 190));       But this doesn't work reliably. Often the numbers seem to be completely ignored. How does the arbitrary size array work in WordPress? I am confused. :)


title: How To Create A Secure Login Logout Menu Properly?

text:
I'm not a developer and I don't know about PHP. I'm trying to create my own blog using a theme called `WP Knowledge Base`\- Link. It uses the wp- bootstrap-navwalker Other more details:   * Wordpress Version - 3.9.1   * Plugins - bbPress, bbPress Pencil Unread, Buddy-bbPress Support Topic, Captcha, Category Order and Taxonomy Terms Order, GD bbPress Attachments, GD bbPress Tools I've installed `bbpress` plugin with this theme and went smoothly. Now I'm trying to put a login/logout/register menu to the top menu, because the theme does not have this, but it's in the sidebar widget. I need a `Login` and `Registered` link in the top nav of the theme and visible to not logged in users. For logged in users, the `Login` menu should change to `Logout` and `Register` menu should not appear. I've been searching for a solution but I'm having some difficulties, since I don't know PHP yet and Wordpress Codex. The task should only be a one time fix, since it shall only be used with my blog theme. So I don't have to learn all these things. Prior to posting this question, I've tried several codes and been doing various trial-and-error, it's a tedious task really because I don't know about PHP yet. So trial-and-error is only the thing I can do. What I've tried so far; bbPress Official Documentation \- It gives a white screen error after implementing it. I don't know if it conflicts the the plugins I've mentioned above. Code 2 \- This one works, but Register menu still shows for logged in users. I've modified the code a bit (trial and error). It's like this.               if( ! function_exists( 'add_loginout_to_menu' ) ) {         function add_loginout_to_menu( $items, $args ){             //Nav location in your theme. In this case, primary nav. Adjust accordingly.             if( is_admin() ||  $args->theme_location != 'secondary' )                 return $items;              if( is_user_logged_in( ) ) {                 $link = '' . __( 'Logout' ) . '';             }         else  $link = '' . __( 'Login' ) . '';             return $items.= '
'. $link . '

Register
';         }     }     add_filter( 'wp_nav_menu_items', 'add_loginout_to_menu', 10, 2 );      Plugin \- I've also tried this plugin, but it does not achieve the goal. Coz I need to redirect the Login and Register link to a custom login/register page. I've tried other more codes, some worked partially some gave errors. Overall, I think I can use the `Code 2`, but it requires some tweakin. Just don't know how to. That being said, I like to make this an opportunity to ask if trying these fixes by trial-and-error poses security threat against my website? what would be the effect of it in terms of security? ### Update With some trial-and-error I got a working code, need some tweaking though.               add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );     function add_loginout_link( $items, $args ) {         if (is_user_logged_in() && $args->theme_location == 'secondary') {           $items .= '
Log Out
';         }         elseif (!is_user_logged_in() && $args->theme_location == 'secondary') {           $items .= '
Log In

Register
';         }         return $items;     }


title: Why won't my metabox data save?

text:
I have a custom post with a lot of meta boxes. I recently tried to add some dynamic metaboxes, using this question: Create more Meta Boxes as needed I managed to get the metaboxes to add nicely, the jquery works, everything works except the save_post action - the "Reviews" save nicely, but the "Screenings" don't. What have I done wrong in my code? I'm sure it must be something very simple that I'm overlooking, perhaps with the nonces? **Edit** : I know I can do all of this with one `save_post`, and that works if I only have 1 of these dynamic metaboxes, but if I add a second (or more) dynamic metabox section, that data doesn't save. **Edit** : If necessary, I can post my entire custom-posts.php function file to pastebin or something, but I have just included what I think is the relevant snippet here for brevity **Edit** : Updated code...               <?php     add_action('save_post', 'save_postdata'); // saves post data from another function earlier on          add_action('save_post', 'save_postdata_dynamic_reviews_metabox' );       add_meta_box("film-reviews", "Reviews", "print_dynamic_reviews_metabox", "film", "normal", "low");          add_action('save_post', 'save_postdata_dynamic_screenings_metabox' );     add_meta_box("film-screenings", "Screenings", "print_dynamic_screenings_metabox", "film", "normal", "low");          /* Prints the box content */     function print_dynamic_reviews_metabox() {         global $post;         // Use nonce for verification                  echo '<input type="hidden" name="reviews_noncename" id="reviews_noncename" value="' . wp_create_nonce( 'reviews-nonce' ) . '" />';             echo '
';             echo '
';         $reviews = get_post_meta($post->ID,'reviews',true); //get any previously saved meta as an array so we can display it         // print_r($reviews);         $c = 0;         if( is_array($reviews) ) {           foreach($reviews as $review ) {                     if (isset($review['review-name']) || isset($review['review-link']) ) {               echo '
Remove                            Review Name/Title: <input type="text" class="meta-review-name saveddata" name="reviews['.$c.'][review-name]" value="'.$review['review-name'].'" />                              Review URL: (don\'t forget the http://) <input type="text" class="meta-review-url saveddata" name="reviews['.$c.'][review-url]" value="'.$review['review-url'].'" />';                         echo 'Remove
';               $c = $c +1;               } // ends if isset $award[album]             } // ends foreach                 } // ends if (is_array)             echo '
';         echo 'Add New Review';             ?>                                <?php          echo '
'; // ends div#meta_inner     } // ends function print_dynamic_reviews_metabox()               function save_postdata_dynamic_reviews_metabox( $post_id ) {       // verify if this is an auto save routine.       // If it is our form has not been submitted, so we dont want to do anything         if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) {             return;             }         // Check permissions         if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can( 'edit_page', $post_id )) { return $post_id; }}         elseif ( !current_user_can( 'edit_post', $post_id )) { return $post_id;}            // verify this came from the our screen and with proper authorization,       // because save_post can be triggered at other times         if (isset($_POST['reviews_noncename'])){             if ( !wp_verify_nonce( $_POST['reviews_noncename'], 'reviews-nonce' ) )                 return;         }else{return;}              // OK, we're authenticated: we need to find and save the data         $reviews = $_POST['reviews'];         update_post_meta($post_id,'reviews',$reviews);         } // ends function save_postdata_dynamic_reviews_metabox                        /* Prints the box content */     function print_dynamic_screenings_metabox() {     global $post;     // Use nonce for verification              echo '<input type="hidden" name="screenings_noncename" id="screenings_noncename" value="' . wp_create_nonce( 'screenings-nonce' ) . '" />';         echo '
';         echo '
';     $screenings= get_post_meta($post->ID,'screenings',true); //get any previously saved meta as an array so we can display it     // print_r($screenings);     $c = 0;     if( is_array($screenings) ) {       foreach($screenings as $screening ) {                 if (isset($screening['screening-festival-name']) || isset($screening['screening-festival-date']) ) {           echo '
Remove                        Festival Name: <input type="text" class="meta-screening-festival-name saveddata" name="screenings['.$c.'][screening-festival-name]" value="'.$screening['screening-festival-name'].'" />                          Festival Date: <input type="text" class="meta-screening-festival-date saveddata" name="screenings['.$c.'][screening-festival-date]" value="'.$screening['screening-festival-date'].'" />';                     echo 'Remove
';           $c = $c +1;           } // ends if isset $award[album]         } // ends foreach             } // ends if (is_array)         echo '
';     echo 'Add New Screening';         ?>                        <?php      echo '
'; // ends div#meta_inner     } // ends function print_dynamic_screenings_metabox()                    function save_postdata_dynamic_screenings_metabox( $post_id ) {       // verify if this is an auto save routine.       // If it is our form has not been submitted, so we dont want to do anything         if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) {             return;             }         // Check permissions         if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can( 'edit_page', $post_id )) { return $post_id; }}         elseif ( !current_user_can( 'edit_post', $post_id )) { return $post_id;}            // verify this came from the our screen and with proper authorization,       // because save_post can be triggered at other times         if (isset($_POST['screenings_noncename'])){             if ( !wp_verify_nonce( $_POST['screenings_noncename'], 'screenings-nonce' ) )                 return;         }else{return;}              // OK, we're authenticated: we need to find and save the data         $screenings= $_POST['screenings'];         update_post_meta($post_id,'screenings',$screenings);         } // ends function save_postdata_dynamic_screenings_metabox               ?>