title: Wordpress Options Page not working

text:
So, I need to add a custom options page, and based on as many tutorials I could find, I came up with the following code to create an officers & chairs options page for my group, mainly, so I can write more advanced stuff for my site. The code is here:               add_action('admin_menu', 'composit_settings_page');          function composit_settings_page()     {         add_options_page('Officers & Chairs', 'Officers & Chairs', 'manage_options', 'officers_chairs', 'composit_settings');     }          function composit_settings()     {         $actives = get_users('role=contributor');         $actives = array_merge($actives, get_users('role=editor'));         $actives = array_merge($actives, get_users('role=administrator'));               $positions = array(         "prytanis",         "epiprytanis",         "hypophetes",         "hegemon",         "grammateus",         "histor",         "pylortes",         "crysopholos"     );          ?>

Officers & Chairs
                  <form method="post" action="options.php">                 <?php settings_fields('officers-chairs'); ?>                 <?php foreach($positions as $position):                         register_setting('officers-chairs', $position, 'intval');                       endforeach; ?>

                         <?php foreach($positions as $position): ?>
                                                                      <label for="<?= $position ?>"><?= ucwords($position) ?>                                 	                                              <select name="<?= $position ?>" id="<?= $position ?>" class="regular-text">                                         <?php foreach($actives as $active): ?>                                             <option value="<?= $active->ID ?>" <?php if(get_option($position) == $active->ID) { ?> selected <? } ?>><?=$active->first_name . " " . $active->last_name ?></option>                                         <?php endforeach; ?>                                     </select>
                         <?php endforeach; ?>

<input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes">
             </form>
     <?     }      However, when I go to save that, I get the following error:               ERROR: options page not found.      I feel completely dumb for not being able to figure this out, but the official documentation hasn't really helped me at all.


How can I remove the "updates" menu in the Wordpress Admin panel? ![Picture 1.png](http://img546.imageshack.us/img546/5135/picture1pv.png)


title: moving an admin submenu item to a top-level position

text: I'm trying to rearrange my admin menu so I can remove the submenus. Basically I'm starting by removing all submenus that I don't want (for instance the ones under the "home" button, or the ones under the "posts" buttons), then I add new entries to the $menu array. my code looks like this (example is for the update entry but I've done so for the categories and link categories too):               function setAdminMenu (){     /* unsetting the home subemnus */     unset($submenu['index.php'];          /* adding the update link at a top-level position */     $menu[3] = array( __('Updates'), 'read', 'update-core.php', '', 'menu-top menu-top-first', 'menu-maj', 'div' );          }      It seems to work well, except that submenus are still acting as ones: when one clicks on the "updates" menu button, the button doesn't stay active but another one (the "tools" button as well as its submenus which I have kept), or when one clicks on the "categories" menu it's the "posts" entry that is shown clicked. It's odd because I think I gave the appropriate classes to the menu item but when I have a look at the source code, I see that it's the "parent" button of the buttons that gets the .current class (which manages the "clicked" appearance). How do I fix the problem? Is it possible? I think that maybe it's the way some of the admin pages work? **EDIT** Hi Wyck and thank you for your answer but actually my problem is not to add or remove some items from the menu and submenu but the way thing goes once it's done. More precisely, i've deleted all submenus, took some elements which were on those submenus and put them in the main menu. for instance I removed the "updates" link from the "dashboard" (index.php) submenu and put it as a top- level menu. And done the same with Links Categories and posts categories. Thing is it's working, I have the menu I want to have (no submenus) but when I click on the elements which were on submenus, instead of having their button act as the ones which have always been on top-level, they act as they were in submenus. To be more clear, I've defined the "clicked" (and hover etc) state of the buttons: they change color. When I click on the "updates" button in my new configuration (or on the "categories" or "link categories"), instead of taking the clicked state, the buttons take no state at all, and instead it's the button they used to be related to when they were in submenus that takes the clicked state, though it goes to the apropriate page. I saw that when you click on a button in the menu, wordpress adds a .current class to it, it works for all elements which are in the original top-level menu, but not for the ones which are normally on submenus and I don't know how to bipass that (maybe with a js?)


title: loading javascript after jquery is loaded

text: I want to load some javascript for the front page of my theme after jquery and jquery ui is loaded. what would be the hook to use? I am aware of the functions.php and I have used is_front_page(). By inserting wp_register_script in functions.php, I can queue the script after the libraries I want loaded but I also want to load it only on the frontpage. Using is_front_page() on header.php, the script gets loaded ahead of jquery. How could I load my javascript after loading the jquery and only on the front page?


title: display post according to the term

text: I want display all my taxonomy terms on the left side of my website, so that when a user clicks on one of the terms he can see the posts according to it. How can I do this?


title: How do I add a text field under the activity texarea?

text: I am working with BuddyPress 1.7. I need to add a text field under under the activity/update text area and capture that data when an update is posted. Any help to help to get me started would be much appreciated. I see the `post-form.php` file that contains the HTML form elements but how can my text box be added using a plugin through a filter?


title: Displaying taxonomies as category links within sidebar and creating pages for these

text: I've created a custom post type called 'work' for a portfolio section on the site I am working on at the moment. I have also registered the taxonomy 'workcategories' so that I can assign different pieces of work to different categories like: Artists, Charities, Independents, International, Well Known Which I have created via the WordPress Admin. My problem is that I can't figure out how to display these terms as a list of links within my sidebar under the title 'Categories' and for these terms to link to archive pages displaying the work assigned to each. At the moment I have this code in my index-work.php page to display ALL WORK:               <?php query_posts('post_type=work&posts_per_page=4'); ?>      And I think I need to adapt this for my taxonomy pages. I've created a taxonomy-workcategories.php page for this purpose, but not sure if I actually have to create a separate page for each term listed above? Or can I use the taxonomy-workcategories.php all. Any help much appreciated as I'm a bit lost. It's my first time working with taxonomies and I'm finding it all a bit confusing.


title: Hook different functions to the same filter conditionally OR Pass additional arguments to existing filter?

text: Is it possible to hook 3 different functions to the same filter conditionally, like:               <?php     if(a){         add_filter('the_content', 'fnc_1');     }     else if(b){         add_filter('the_content', 'fnc_2');     }     else{         add_filter('the_content', 'fnc_3');     }     ?>      Or if this isn't possible, then can I pass an additional argument to the same function to flag my 3 different conditions? Something like:               <?php     if(a){         add_filter('the_content', 'fnc_1', 'condition_a');     }     else if(b){         add_filter('the_content', 'fnc_1', 'condition_b');     }     else{         add_filter('the_content', 'fnc_1', 'condition_c');     }     ?>      All I could find from my reading is that it has to do something with `apply_filters`, but couldn't get around it. Please can anyone tell me how to achieve this? Thanks!


title: How to create a clone role in wordpress

text: How to create new role with same capabilities of existing role. Eg: I would like to create a new role with same capabilities of administrator or editor and so on..


title: Page navigation within a category

text:
I would like to know why my page navigation within a particular category doesn't work. The code seems correct but I never see the pagination links.               <?php      $my_query = new WP_Query('cat=18&showposts=8');      while ($my_query->have_posts()) : $my_query->the_post();     ?>      <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>            <?php the_content(); ?>
          <?php endwhile; ?>          <?php if (  $wp_query->max_num_pages > 1 ) : ?>
<?php _e( 'Post navigation', 'themename' ); ?>

<?php next_posts_link( __( '← Older posts', 'themename' ) ); ?>

<?php previous_posts_link( __( 'Newer posts →', 'themename' ) ); ?>
           <?php endif; ?>


title: Custom field/meta populated by dropdown of existing posts?

text: (My first WP question ever asked! Be gentle!) I'm building a site that is mostly pages (i.e., static), using WP as CMS. At the bottom of several of the pages, there will appear 1, 2, or 3 "promo boxes" -- basically button-images that link to other parts of the site. Though only up to 3 promo boxes will appear on any given page, there will be ~30 different ones to choose from. When my client creates a new page, I'd like him to be able to choose promo boxes from something like a dropdown list of all of the possible promo boxes. Seems to me this should work like this:   * Create a custom post type called "promo-box". (Though it could just as easily be a tag for regular posts.)   * Use a tool like Custom Field Template to create a dropdown on the page editor, where the values of the dropdown options are dynamically generated from the list of all existing promo-box posts. ( **This is the part I don't know how to do.** )   * Access the resulting metadata (post number is really all I need, then I can get everything else) on the page template. Based on responses to other questions here, I have taken initial looks at WPAlchemy MetaBox, Posts-2-Posts, and SLT Custom Fields, but I confess the documentation for each of them is slightly geekier than I am, so I haven't delved too deeply. Advice? Is one of the above tools the right solution for me, and I just have to figure it out? Am I missing something here?


title: How to schedule future and past posts with metaWeblog.newPost

text: I am attempting to remotely post articles to a wordpress page and no matter what I attempt to do I cannot publish in the future and the past. I have commented out some past attempts (some found on here).                   $url = $rpcurl."/xmlrpc.php";               /*     Thanks, this is a life saver! If you need to provide tags for your post, you can pass them in array using tags_input property, like this:          $content['tags_input'] = "action, adventure, thriller";     If you need to pass in a specific time stamp, you should use the following format          D, d M Y H:i:s +0000     and pass it using the post_date or post_date_gmt property:          $content['post_date_gmt | post_date'] = date("D, d M Y H:i:s +0000", strtotime($your_specific_date_and_time));          */       error_reporting(E_ALL);     ini_set('display_errors', '1');               include("IXR_Library.inc.php"); // http://www.hurricanesoftwares.com/php_uploads/IXR_Library.txt          //$client->debug = true; //Set it to false in Production Environment I think          //$title="Blog Title5"; // $title variable will insert your blog title  or should     //$body = $content;          $title = htmlentities($title,ENT_NOQUOTES,$encoding);     $keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding);     //$date = new IXR_Date( strtotime( '2015-12-25 09-20-58' ) );               //$pubdate = strtotime( '2015-04-08 13:46:43' );      //$pubdate = new IXR_Date( $pubdate );     $postdate = date('Y-m-d H:i:s', strtotime('2010-02-23 18:57:33'));     $test = new IXR_Date(time($postdate));          $content = array(         'title'=>$title,         'description'=>$body,         'post_status'=>'future',         'post_date' => $test,         'mt_allow_comments'=>0,  // 1 to allow comments         'mt_allow_pings'=>0,  // 1 to allow trackbacks         'post_type'=>'post',         'mt_keywords'=>$keywords2,         'categories'=>array($category),         //'custom_fields' =>  array($customfields)               );          // Create the client object     $client = new IXR_Client($url);               $params = array(0,$username,$password,$content,false); // Last parameter is 'true' which means post immideately, to save as draft set it as 'false'          // Run a query for PHP     if (!$client->query('metaWeblog.newPost', $params)) {     die('Something went wrong - '.$client->getErrorCode().' : '.$client->getErrorMessage());     }     else     echo "Article Posted Successfully";                    ?>     <?php     };                    //global $post;     $my_post = array(         'title'=>$title,         'description'=>$body,         'post_status'=> 'publish',         'mt_allow_comments'=>0,  // 1 to allow comments         'mt_allow_pings'=>0,  // 1 to allow trackbacks         'post_type'=>'post',         'mt_keywords'=>$keywords2,         'categories'=>array($category),     );                    /*               array();     $my_post['title']="title";     $my_post['description']="content";     //$my_post['ID'] = $ID;     $my_post['post_status'] =  'publish';     //$my_post['post_date'] =  '2015-12-25 09-20-58';      //$my_post['description'] = 'this is a test';     //$my_post['title'] = 'test 73';     //$my_post['excerpt'] = '64 ways';     //wp_update_post( $my_post );               */                   /*     if(!$client->query('metaWeblog.newPost', $spam)){         die('somethign went wrong -'.$client->getErrorCode().' : '.$client->getErrorMessage());         }         else             echo "Article Posted Successfully WOOT!";     */


title: How is this sliding/scrolling navigation made?

text: Does anyone know how the navigation on this site was made?   http://www.thinkingforaliving.org


title: Front end empty (i.e. nothing displays); Back end looks fine; What are possible causes?

text: My customer's site was working last night. Today nothing displays from the front end. Firebug gives as the contents of the home page. I logged in. The back end looks fine. The most recent post (added yesterday some time) is there. I looked (briefly) at index.php, wp-blogheader.php, wp-config.php. They all look right at first glance. No obvious problem like the file being deleted or contents munged or the like. I looked at the database with phpmyadmin. The obvious options (home, etc.) look ok. The numbers of pages and posts etc. look OK. Which is consistent with the back end looking right. Running WP 2.9.2 and Semio Reloaded 0.9.2, Version Checker 2.1.5 active. All plugins updated according to version checker. Does anybody know what might be causing this? Possible clue based on "what did you do recently?"... I deleted an old (2.8.?) WP install from a different directory/folder. The deleted install was in /news2/. The current one is served from /news/. The databases for both installs were in the same MySQL db. The old deleted one had "wp_" as the table prefix. The current one has "asepco_" as the table prefix. Again, a look at the db using phpmyadmin shows that both sets of data are there, and nothing obvious seems amiss. Any "did you look at ..." type suggestions would be welcome. I'm a bit stumped right now. -Denny


title: How do you customize the admin bar for buddypress?

text:
I would like to update the coding on the wp-admin-bar. Since its positioned absolute, I would like to put a div around it that is relative and or just in a normal div. Or, I see you can hide the bar, does anyone have link structure for the admin bar? Ex:

My Account


title: Adding Additional Menus In Genesis Child Themes

text: I have a Genesis child theme that I bought, and it only supports two menus, a primary and a secondary. However, for what I would like to do with my site I need to have 6 menus all together. This is my website http://thenottypicalarmywife.com This is what I want the menus to look like http://livingwellspendingless.com with the menus across the top of the page.


title: WooCommerce: Translation lost on AJAX call in Checkout page

text: I'm using **WooCommerce** for a site that I'm currently working on. And I'm creating it for a language other than English. I do the translations by means of the `.po` file. The issue that I'm encountering is in the **Checkout page**. There is a table of **order review** which upon page loaded seems to be refreshed by means of **AJAX call**. Before the **call** the texts are all translated. But after the **call** the texts all reverted back to their original language (ie. English). **How do I retain the translation after the AJAX call?** ![enter image description here](http://i.stack.imgur.com/xLY9I.jpg)


title: Remove are you sure dialog from editor

text: I'm trying to stop the "Are you sure" dialog from appearing on a custom post type. I've tried the suggestions over on this question and this one but they are two and three years old respectively so didn't want to reply to them. Any pointers gratefully received as I can't figure it out! Ideally I want to just be able to do it on one certain button, but at the moment just a global block would be good. As it stands I have a button that allows a user to create another entry in another post type. Because it takes you away from the current page, I understand why the dialog pops up, but it isn't required as the entered data is saved. Thanks, Adam


title: After importing data to new DB with new name, receiving a constant MySQL warning

text: I've just spent several hours trying to understand why a WP install is really slow, I tracked it down to the database and realised everything in the db was just running super slow with the debug bar (very handy). I tried various things before thinking I should just reload the database into a new db and see what happens. So in wp-config.php I am using a new user name, password and different host address. And just by doing this, now the site is super quick, and everything appears to work, but I get this on every page in debug and have no idea how to resolve it: > WARNING: wp-includes/wp-db.php:1241 - mysql_fetch_object(): supplied > argument is not a valid MySQL result resource


title: Classes and functions involved in serialization and unserialization

text: I want to know all the classes and functions(individual .php files) in a wordpress installation that handle serialization and unserialization.


title: Creating new page/tab in groups section not working!

text: I'm trying to add a new tab/page in the groups page. This is the code I'm using:               <?php     /*     Plugin Name: Groups Links     Description: Add links to the groups page.     Author: Thomas Clayson     */     function add_groups_links_page(){         global $bp;              $groups_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $bp->groups->current_group->slug . '/';              bp_core_new_subnav_item( array(            'name' => 'Links',            'slug' => 'group-links',            'parent_url' => $groups_link,            'parent_slug' => $bp->groups->slug,            'screen_function' => 'group_links_function_to_show_screen',            'position' => 40 ) );     }     add_action( 'wp', 'add_groups_links_page');          function group_links_function_to_show_screen() {              add_action( 'bp_template_title', 'group_links_function_to_show_screen_title' );         add_action( 'bp_template_content', 'group_links_function_to_show_screen_content' );              $templates = array('groups/single/plugins.php','plugin-template.php');         if( strstr( locate_template($templates), 'groups/single/plugins.php' ) ) {             bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'groups/single/plugins' ) );         } else {             bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'plugin-template' ) );         }     }          function group_links_function_to_show_screen_title() {         echo 'Links';     }          function group_links_function_to_show_screen_content() {          echo "Rawr";     }               ?>      Yet when I click on "Links" on the groups page it just takes me back to the homepage! :( I have no idea why this isn't working. Here is a screenshot of the page: ![enter image description here](http://i.stack.imgur.com/za4F5.png) In the picture I've mouse-over'd the link and you can see that it points to the right place... `wordpressdomain/groups/test-group/group-links/` however clicking it takes me to the homepage! :( Any ideas? Thank you.


title: Why does my subcategory URL give 404 eror?

text: I'm using WordPress's standard theme **Twenty Fourteen**. Here is my problem Not Working: http://ispeedify.com/internet/paypal/ I've made my "PayPal" a sub category of the parent "Internet". But the above URL doesn't work. Rather, this seems to be **working** : http://ispeedify.com/paypal/ I don't see why this is happening. How do I make sure my subcategory is listed under my parent category URL? And I don't see any reason why WordPress should have such settings. Its counter intuitive. I'm using `/%category%/%postname%/` in my permalink settings. Thank you, Sai


title: WP HTTP Error: couldn't connect to host for RSS feeds on same domain

text: I'm having trouble reading RSS feeds created by WP3 on the same domain. When I do a print_r($rss); at the part of my plugin where it does the RSS parsing, I get the following output:               WP_Error Object ( [errors] => Array ( [simplepie-error] => Array ( [0] => WP HTTP Error: couldn't connect to host ) ) [error_data] => Array ( ) )      The RSS feed address being supplied validates and everything, btw. It seems to me the issue has something to do with the webserver being unable to grab its own RSS feeds. This is all very confusing. There's a blog post that seems to identify the issue at: http://www.ajaykumarsingh.com/wordpress/rss-error-wp-http-error-couldnt- resolve-host.html ...Alas, it does not contain any solutions. Any ideas for a workaround would be much appreciated.


title: Get all categories of custom post even not assigned

text: I know how to get all categories with `get_categories` and name custom taxonomy name, but wordpress only shows those categories those are assigned to a post. Those which are created, but not assigned, will not show up with any of these methods. So is there any function that shows all categories that created + assigned and not assigned. I am working in a admin panel to show all categories in a drop down list in a custom post type.


title: Remotely search WordPress sites using xml-rpc

text: This is the scenario: There are say 3 sites - A, B and C. Sites A and B have several custom posts. Now, from site C, I'd like to make a search for the posts in sites A and B. After reading up through online resources, I realized that xml-rpc can be used to achieve this. I read about adding custom functions, but I didn't understand where exactly the add_filter method is to be put (along with the custom method definition). Can someone guide me along?


title: Why There Is No "get content by ID" Function

text: When i need to get content of a post with ID, I'm always using this function :               function getContentByID($id)     {     //http://wordpress.stackexchange.com/questions/9667/get-wordpress-post-content-by-post-id     $content_post = get_post($id);     $content = $content_post->post_content;     $content = apply_filters('the_content', $content);     $content = str_replace(']]>', ']]>', $content);     return $content;     }      Can you tell me, why there isn't any core function for this ? There are functions like get_the_title($id), get_the_category($id) ...


title: Contact Form 7 submission does not complete

text: I have a Content Form 7 Version 3.8.1 form which seems to function perfectly in that the validation events all work and when submit is clicked the console shows no error, a 200 response comes back from the post but no success message displays and the ajax-loader continues to display indefinitely. No email is received either. The form can be seen at http://peteshighway.com/public-meeting-comment-form/ Here are the network and console tabs after submission: ![network tab](http://i.stack.imgur.com/6pYp3.png) ![console](http://i.stack.imgur.com/UoMqA.png)


title: Wordpress posts pagination with rand and meta_value

text: I have posts that have a meta_key (is_premium) that owns "Yes" or "No" values. I want to show pagination with random post but premium first. It's from several days i'm looking around and read really a lot of posts without success. Here is my code in the page where i have to show posts:               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $gallery_order = get_theme_option(tk_theme_name.'_gallery_gallery_order');     $args=array('post_type' => 'team-members', 'post_status' => 'publish', 'ignore_sticky_posts'=> 1, 'posts_per_page' => 4, 'paged' => $paged,  'orderby' => 'rand meta_value', 'meta_key' => $prefix . 'is_premium');          //The Query     query_posts($args);          //The Loop     if ( have_posts() ) : while ( have_posts() ) : the_post();      I read online to add this filter in functions.php               session_start();          add_filter('posts_orderby', 'edit_posts_orderby');          function edit_posts_orderby($orderby_statement) {         $seed = $_SESSION['seed'];         if (empty($seed)) {             $seed = rand();             $_SESSION['seed'] = $seed;         }              $orderby_statement = 'RAND($seed)';         return $orderby_statement;     }      Now the random and pagination work but i cannot see the premium first and than others but the posts are all random. This is the query belonging to the query_posts:               SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON     (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type = 'team-members' AND     (wp_posts.post_status = 'publish') AND (wp_postmeta.meta_key = 'tk_is_premium' ) GROUP BY     wp_posts.ID ORDER BY RAND(58371773) LIMIT 0, 4       but i expected something like **ORDER BY wp_postmeta.meta_value, RAND(58371773)** I don't know how to go forward, should i use taxonomy or something else? Regards, V.


title: Headers for Contact Form are wrong

text: I am using a simple contact form I created myself that consists of just a script (php) and a WordPress shortcode. It works fine except the headers are saying something like foo@somewebhosting.server54 instead of displaying my admin email (or my correct email). Can someone see where my mistake is? Thank you. The two codes are here: Pastebin


title: Server-side processing of AJAX login

text: I'm using AJAX to login users on my website to avoid the need for a page refresh when they get their username or password wrong. Everything is done over SSL. My server-side processing:               function ajax_login() {              check_ajax_referer( 'my_nonce', 'secure' );              $response = array();              // get form data         $data = array();         $data['user_login'] = sanitize_user( $_POST['u_login'] );         $data['user_password'] = sanitize_text_field( $_POST['u_password'] );         $data['rememberme'] = false;         $user_login = wp_signon( $data, true );              if ( is_wp_error( $user_login ) ) {             $response['status'] = 'error';         } else {             $response['status'] = 'success';         }              echo json_encode( $response );              die();     }     add_action( 'wp_ajax_nopriv_ajax_login', 'ajax_login' );      As you can see, I'm just verifying the nonce, using `wp_signon()` and then sending a response to my JS script. Everything works fine but my question is: is verifying the nonce and using `wp_signon()` enough? Or is there something else important I should be doing when signing in a user?


title: Is it possible to set up multistore in Woocommerce?

text: Is it possible to have multistore in WooCommerce? I want to divide my WooCommerce store into 3 distinct stores with the toys showing up in 3 different collection names called:                   remote cars, robots and funny.      Is it possible to setup up 3 different stores or collections using woo commerce? How to do that? need guidance. Is it possible using WordPress WooCommerce plugin or do i need to go for Magento.?


title: What conditional to use for dynamic sidebar check?

text: I have looked here on WA and also on the codex but there is no definitive source that I could find. Which is the proper/best way to check to see if a dynamic_sidebar is active and contains a widget? I see these 3 solutions at large but not sure what the proper way is:                1. if(is_active_sidebar('foo')){ //check if the sidebar is active             dynamic_sidebar('foo');      }      2. dynamic_sidebar('foo'); //basically just call it      3. if(dynamic_sidebar('foo')) //also have seen the inverse if(!dynamic_sidebar('foo') check the return of the function      If they are all valid then why not just choose option 2?


title: attachment.php code or tutorial

text: I am confused about the exact purpose attachment.php ( and image.php) . I notice many themes dont have them. If single.php displays the image the way I want then is it OK to leave it out. On the other hand could i just make a copy of single.php for attachment.php and leave out the sidebar. The other thing that confuses me is that when I add a gallery to a post I get the option to open images in an attachment page but when I add a single image to a post it only gives me the option to open the image as an image file (outside of the theme - ie without menus etc). I cant understand the point of this. What is the point in having an attachment.php file for images (or an image.php file) if it isn't going to get invoked when someone clicks on an image. Ideally what i need is a good tutorial on attachments but I cant find any and i can find very little info in the codex.


title: Custom Post Type - Taxonomy Dropdown Menu?

text: I have created a custom post type and added various meta boxes/fields to this custom post type. All is working excellent except for one element... Instead of utilizing the default interface for selecting a taxonomy I would like to just have a drop down menu for the user to select from. The idea here is to enable the admins to add taxonomy elements which can be managed centrally however for a specific post to only be associated with one taxonomy. Further more, I would prefer to just add this drop down into one of my existing meta boxes. Does anyone happen to have any sample code which would enable me to complete this task?


title: Custom query, static page pagination and canonical

text: We have a custom query used in a template file, which is a page builder, with pagination that query latest posts. The problem is with Yoast SEO plugin and it's canonical URLs. When we navigate to any page using the pagination, the canonical always show the front page/homepage URL without the next/prev URLs. The plugin just not recognize that the homepage is being paginated. We tried different pagination approaches and plugins, the result is always the same. So the problem is with the query it self or with the plugin. Here is the query from the template:                 if ( get_query_var('paged') ) $paged = get_query_var('paged');       if ( get_query_var('page') ) $paged = get_query_var('page');            $args = array(         'post_type' => 'post',         'posts_per_page' => 10,         'paged' => $paged       );            $wp_query = new WP_Query( $args );            if ( $wp_query->have_posts() ) :          while ( $wp_query->have_posts() ) : $wp_query->the_post();                  // Post               endwhile;                  // Pagination            else:                  // No Posts            endif;


title: How can i specify the size of the image rendered by the_content();?

text: I can do it manually like this:               echo get_the_post_thumbnail($post->ID, 'large');      But how can i set the size of the image rendered by `the_content();` to Large too ?


title: How to load parent theme style.css?

text: My WordPress site uses a theme that is a child of a parent theme. As required, both themes have style.css files. However, as far as I can tell WordPress only provides the mechanism to load the child theme style.css file. How do the parent theme styles get loaded? Is it necessary to manually import the parent theme's style.css file into the child style.css file?


title: Related posts for a post

text: For a post we need to maintain a list of "related posts" (links to other posts), and this list should be visible to a user. What is the easiest way to do this?


title: Open Wordpress 'Add New Post' admin page with parameters set via $_GET

text: I want to launch my web browser from an automation tool I use and open Wordpress "Add Nwe Post" page in the admin area with specific title and content (it varies everytime, I generate it dynamically on my local machine). I know that I can use http://blog.mysite.com/wp-admin/post- new.php?post_title=sometitle This is fine. However, if I try to set the content of the post, using "content" url parameter, it can be only plain text. If I set HTML, it is escaped automatically. Is there a way to set the HTML content of the post? Also, I don't know how I can set page categories via url parameters too? P.S.: I don't want to create programatically a new post, but just to have the Add Post page open with prefilled fields.


title: Increase search results for Admin -> Appearance -> Menus -> Search (default is 10)

text: I have over 800 pages in WordPress which becomes a challenge trying to find a specific page to add it to the menu. View all works if you have only a few pages so the best option would be to search for the page to add it to the menu. The problem is that the search result only brings up 10 pages, I need it to return more results (say 30) so I can find the page that I am looking for, the page that I am looking for might be result number 22 but I can't find it because it is not displayed, hope this makes sense. Just a reminder that I want to increase the search results for "Admin -> Appearance -> Menus -> Search" and not "Admin -> Pages -> Search" Any body can help me with what code to add to the functions.php file to increase the search results? Thank you in advance Tony


title: Change behavior of "Insert into Post" based on attachment metadata

text: For a custom plugin I'm working on, I have added a checkbox element to the attachments editor in a manner like the answer provided here: How to add a checkbox element to attachments editor with example What I would like to do is, based on the value of that checkbox, alter the behavior of the "Insert into Post" button. Eg., if the checkbox is not checked, "Insert into Post" does the default WordPress action for the file type. If the box is checked, insert my plugin shortcode instead. I've tried the following (based on the answer here):               function my_media_insert($html, $id, $caption, $title, $align, $url, $size, $alt) {         $orig_html = $html;              $attachment = get_post($id);         $my_meta = get_post_meta($post->ID, '_myMeta', true); // try to get checkbox value              $mime_type = $attachment->post_mime_type;         if (($mime_type == "application/pdf") && ($my_meta == "1")) {             $src = wp_get_attachment_url( $id );             $html = '[shortcode url="'.$src.'"]';           } else {             $html = $orig_html;         }         return $html;     }     add_filter('media_send_to_editor', 'my_media_insert', 20, 3);      ...but get_post_meta() never seems to return any value to work with. (If I change the value of $html to $my_meta for testing purposes, the insertion is "blank".) The short version: Is there a way for me to set metadata on an attachment with a checkbox, and alter the value of $html sent to the editor in response? UPDATE: I found an example that accomplishes basically what I want to do (changes the behavior of the button) but I would like to adapt this to add a checkbox on the attachment metadata that would do this versus doing this for every file all the time. That way the behavior can be overridden when needed and I can apply it only to specific file types. http://justingable.com/2008/10/03/modifying-wordpress-default-method-for- inserting-media/


title: Why are <a> Tags "Slipping" in TinyMCE / Page Builder editor?

text: I'm trying to figure out why this might possibly be happening: Basically I have a section of code with an tag, like so:               Word here      After entering that into the TinyMCE editor (I'm using the Page Builder plugin by SiteOrigin as well, so I'm using the BlackStudio Tiny MCE editor) and updating the page, then opening that section to make further edits, I'm getting this:               Word here.      So in essence the tag has "slipped", with the word / element that it should be wrapping getting bumped outside of it. Any guesses as to why this might be? I've tried disabling / re-enabling plugins but nothing doing so far.


title: Adding Theme File for Non-Wordpress Content

text: I have a third party events plugin that uses custom tables in the database. I have created a theme file (event.php) that pulls the data in based on a slug that is ideally given in the URL. I want to create a custom URL rewrite rule for this template, so a URL like this: /event/my-slug Will call the event.php file, grabbing the specific event they have requested (the slug). The class I am including in the functions.php to accomplish this is:               <?php      $EventpageCode = new Eventpage();     register_activation_hook( __file__, array($EventpageCode, 'activate') );          add_filter('rewrite_rules_array', array($EventpageCode, 'create_rewrite_rules'));     add_filter('query_vars',array($EventpageCode, 'add_query_vars'));          add_filter('admin_init', array($EventpageCode, 'flush_rewrite_rules'));     add_action('template_include', array($EventpageCode, 'template_redirect_intercept'));          class Eventpage {              function activate() {             global $wp_rewrite;             $this->flush_rewrite_rules();         }              function create_rewrite_rules($rules) {             global $wp_rewrite;             $newRule = array('event/(.+)' => 'index.php?pagename=event&eventid='.$wp_rewrite->preg_index(1));             $newRules = $newRule + $rules;             return $newRules;         }              function add_query_vars($qvars) {             $qvars[] = 'eventid';             return $qvars;         }              function flush_rewrite_rules() {             global $wp_rewrite;             $wp_rewrite->flush_rules();         }              function template_redirect_intercept($template) {             global $wp_query;             if ($wp_query->get('eventid')) {                 $template = locate_template( array( 'event.php' ) );             }             return $template;         }              function pushoutput($message) {             $this->output($message);         }              function output( $output ) {             header( 'Cache-Control: no-cache, must-revalidate' );             header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );                  echo json_encode( $output );         }     }     ?>      This works great for displaying the content, except that the page throws a 404 error (but still displays the content). Any suggestions on how to avoid having the 404 error returned?


title: is_dynamic_sidebar always returns true while using Jetpack visibility

text: If I have any widgets in the sidebar, even if the jetpack visibility is set to not show on that page, is_dynamic_sidebar return true. Here's the code in my theme functions file:               add_action( 'init', 'iartz_add_sidebar_class' );          function iartz_add_sidebar_class() {         add_filter('body_class','check_has_sidebar');         function check_has_sidebar($classes) {             if ( is_dynamic_sidebar() ) {                 $classes[] = 'has-sidebar';             } else {                 $classes[] = 'no-sidebar';             }             return $classes;         }     }      (I tried using several different hooks thinking that the sidebar would have to unregister or something, but it doesn't seem to matter) Is there a different way to check for sidebars that would take jetpack visibility into account, or another plugin that would have the same functionality, but also work with is_dynamic_sidebar?


title: More than one WordPress site using the same database - how to disable plugin for one site?

text: I am going to have two WordPress websites running off the same database, so that they both have the same products set (each post is a product) but they have different homepages, about us pages, etc. thanks to the themes of each site. (Note: NOT using MU). But there is once concern: `<title>` and `<meta>` tags on the site. I want the mini-site to have completely separate tags, as it has a different identity. So I will use custom fields in the posts to set the tags for each domain but herein lies the problem: I already have an SEO plugin installed and loads of custom tags, so how do I disable that plugin for the new site _only_? I assume that if I just omit the files for that plugin on one of the installs then WordPress will detect that it is not there, and disable it in the DB, so it will disable for both sites. Does anyone know the answer?


title: Staging setup for multisite installation

text: I'd like to setup a staging instance of my multisite network and I'm not sure how best to do it. I'm will be using version control to deploy to staging and production environments and I'd like the staging to be a full mirror of the production multisite network. How feasible is it to set this up on a subdomain ? staging.mydomain.com Has anyone done this before ? Any advice is appreciated. Cheers


title: How do i get a specific user metadata using custom metavalue outside of wordpress?

text: I need help. I need to get a user ID or email (email is can do but ID is better) based on their phone number, outside of WordPress. I already have their phone number in a variable and billing_phone is custom metadata in the wp_users table. This is what I am using to load wp               `$parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] ); require_once( $parse_uri[0] . 'wp-load.php' );`          and how I am fetching the email.                   `$email = $wpdb->get_var("SELECT user_email FROM wp_users WHERE billing_phone = $phone_number ");`      Thank you all in advance. Any help is appreciated.


title: Links to my uploads went crazy

text: First things firs.... up until now (before I experimented with some plugins - many) my blog was behaving properly.... 1. I write the post 2. Import the media from my computer 3. Insert the media into my post 4. When I click on media link ... it fires up the pdf file (for example) Now when I do everything same from 1 to 3 and when I try to open up the pdf file, my blog leads me from post url (/?p=1491 in the url) first to attachemtn URL (/?attachment_id=1927) which is WRONG. On that page there is a link to the pdf file. How can I bypas this extra step and go directly to pdf? |help|please|


title: Loading internal page

text: How can I load another page in wordpress? For example, I created a post called "Services" and want it to be associated with a page-services page. My index is thus:               <?php     if (have_posts()) : while (have_posts()) : the_post();             ?>             <?php get_template_part('content', get_post_format()); ?>             <?php             break;         endwhile;     else:         ?>         Nenhum post encontrado     <?php endif; ?>          <?php get_footer(); ?>


title: Upload an image at frontend > Create direction and/or rename filename possible?

text:
I have a form for a non-profit-club, that publish posts + up to 20 images. The image-path will be writen in a custom-field. Images are uploaded. Ok, now i want to rename the pictures or (much better) create a folder. But there is a special: the form uploads 2 styles of images. There are up to 15 images for a wanted person (g) and up to 5 images for the person, who is missing this person (s). So i have to seperate the images at the server. The images are given from several input-fields. I named the input-fields for "g" like:               <input type="file" name="image_1_gesucht" id="image_1_gesucht">     <input type="file" name="image_2_gesucht" id="image_2_gesucht">     ...     <input type="file" name="image_15_gesucht" id="image_15_gesucht">      The field for "s" named like:               <input type="file" name="image_1_suchend" id="image_1_suchend">     <input type="file" name="image_2_suchend" id="image_2_suchend">     ...     <input type="file" name="image_5_suchend" id="image_5_suchend">      If i can rename the pictures: I could do that with a prefix like g- or s- and a unique number. For the unique number i can use the post-id. If i create a folder: Then i need a folder named like the post-id. If i can rename the pictures with the prefix, this one folder with the the post-id is ok. If i can't rename the pictures, i need 2 more subfolders - one for "g" and one for "s". My existing script looks like the following example. I post this, that u can imagine the existing work. Can anybody tell me how to rename the pictures or to create folders? Sorry, i'm silly enough, that i don't can realise/understand, what the wordpress-codex want to tell me. There are two a little bit simiolar articles at stackexchange too ( Rename image uploads with width in filename and Issues renaming images during upload ), but also here: sorry, can't realise/understand. I relly hope, anybody can help me               if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {         $file=$_FILES;         // Funktion zum Image-Upload, falls sie noch nicht existiert         if ( ! function_exists( 'wp_handle_upload' )) {              require_once(ABSPATH . "wp-admin" . '/includes/image.php');             require_once(ABSPATH . "wp-admin" . '/includes/file.php');             require_once(ABSPATH . "wp-admin" . '/includes/media.php');         }              // Variablen für die Bilder         $overrides = array( 'test_form' => false);         $image_1_gesucht = wp_handle_upload( $file['image_1_gesucht'], $overrides );         $image_2_gesucht = wp_handle_upload( $file['image_2_gesucht'], $overrides );              // Benutzerdefinierfte Felder für die Bilder         add_post_meta($pid,'image_1_gesucht',$image_1_gesucht['url']);         add_post_meta($pid,'image_2_gesucht',$image_2_gesucht['url']);     }          <form id="new_post" name="new_post" method="post" action="" enctype="multipart/form-data">
             <fieldset class="images">                 Bild 1:                 <input type="file" name="image_1_gesucht" id="image_1_gesucht">             </fieldset>

             <fieldset class="images">                 Bild 2:                 <input type="file" name="image_2_gesucht" id="image_2_gesucht">             </fieldset>
     </form>


title: Saving metabox repeatable fields

text:
This is a code that I'm adapting from https://gist.github.com/2057532. The problem is that I'm not being able to save the content from the new fields that I created. I had checked the other questions here, but none helped me. Any idea where is the problem?               add_action('admin_init', 'slider_metabox_caption', 1);     function slider_metabox_caption() {     add_meta_box( 'repeatable-fields', 'Captions', 'repeatable_metabox_display', 'slide', 'normal', 'high'); }          function repeatable_metabox_display() {     global $post;          $repeatable_fields = get_post_meta($post->ID, 'repeatable_fields', true);     wp_nonce_field( 'repeatable_meta_box_nonce', 'repeatable_meta_box_nonce' ); ?>

                 	                 Text	                 Fx	                 Easing	                 Speed	                 X	                 Y	                 Width	                 Height

              <?php          if ( $repeatable_fields ) :             foreach ( $repeatable_fields as $field ) { ?>
             -	                  <input type="text" class="widefat" name="text[]" value="<?php if($field['text'] != '') echo esc_attr( $field['text'] ); ?>" />	             <input type="text" class="widefat" name="fx[]" value="<?php if($field['fx'] != '') echo esc_attr( $field['fx'] ); ?>" />	             <input type="text" class="widefat" name="easing[]" value="<?php if($field['easing'] != '') echo esc_attr( $field['easing'] ); ?>" />	             <input type="text" class="widefat" name="speed[]" value="<?php if($field['speed'] != '') echo esc_attr( $field['speed'] ); ?>" />	             <input type="text" class="widefat" name="x[]" value="<?php if($field['x'] != '') echo esc_attr( $field['x'] ); ?>" />	             <input type="text" class="widefat" name="y[]" value="<?php if($field['y'] != '') echo esc_attr( $field['y'] ); ?>" />	             <input type="text" class="widefat" name="width[]" value="<?php if($field['width'] != '') echo esc_attr( $field['width'] ); ?>" />	             <input type="text" class="widefat" name="height[]" value="<?php if($field['height'] != '') echo esc_attr( $field['height'] ); ?>" />	                  |||
         <?php } else :          // show a blank one ?>
             -	                  <input type="text" class="widefat" name="text[]" />	             <input type="text" class="widefat" name="fx[]" />	             <input type="text" class="widefat" name="easing[]" />	             <input type="text" class="widefat" name="speed[]" />	             <input type="text" class="widefat" name="x[]" />	             <input type="text" class="widefat" name="y[]" />	             <input type="text" class="widefat" name="width[]" />	             <input type="text" class="widefat" name="height[]" />	                  |||
              <?php endif; ?>
             -	                  <input type="text" class="widefat" name="text[]" />	                     <input type="text" class="widefat" name="fx[]" />	             <input type="text" class="widefat" name="easing[]" />	             <input type="text" class="widefat" name="speed[]" />	             <input type="text" class="widefat" name="x[]" />	             <input type="text" class="widefat" name="y[]" />	             <input type="text" class="widefat" name="width[]" />	             <input type="text" class="widefat" name="height[]" />	                  |||

Add another     <input type="submit" class="metabox_submit" value="Save" />
          <?php     }          add_action('save_post', 'repeatable_meta_box_save');     function repeatable_meta_box_save($post_id) {     if ( ! isset( $_POST['repeatable_meta_box_nonce'] ) ||         ! wp_verify_nonce( $_POST['repeatable_meta_box_nonce'], 'repeatable_meta_box_nonce' ) )         return;          if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)         return;          if (!current_user_can('edit_post', $post_id))         return;          $old = get_post_meta($post_id, 'repeatable_fields', true);     $new = array();          $text = $_POST['text'];     $fx = $_POST['fx'];     $easing = $_POST['easing'];     $speed = $_POST['speed'];     $x = $_POST['x'];     $y = $_POST['y'];     $width = $_POST['width'];     $height = $_POST['height'];          $count = count( $text );          for ( $i = 0; $i < $count; $i++ ) {         if ( $text[$i] != '' ) :             $new[$i]['text'] = stripslashes( strip_tags( $text[$i] ) );              elseif ( $fx[$i] != '' ) :             $new[$i]['fx'] = stripslashes( strip_tags( $fx[$i] ) );              elseif ( $easing[$i] != '' ) :             $new[$i]['easing'] = stripslashes( strip_tags( $easing[$i] ) );              elseif ( $speed[$i] != '' ) :             $new[$i]['speed'] = stripslashes( strip_tags( $speed[$i] ) );              elseif ( $x[$i] != '' ) :             $new[$i]['x'] = stripslashes( strip_tags( $x[$i] ) );              elseif ( $y[$i] != '' ) :             $new[$i]['y'] = stripslashes( strip_tags( $y[$i] ) );              elseif ( $width[$i] != '' ) :             $new[$i]['width'] = stripslashes( strip_tags( $width[$i] ) );              elseif ( $height[$i] != '' ) :             $new[$i]['height'] = stripslashes( strip_tags( $height[$i] ) );              endif;     }          if ( !empty( $new ) && $new != $old )         update_post_meta( $post_id, 'repeatable_fields[$i]', $new );     elseif ( empty($new) && $old )         delete_post_meta( $post_id, 'repeatable_fields[$i]', $old );     }


title: Scheduled event does not run at midnight

text: I have an event scheduled to fetch feeds from different sources at midnight. I believe for some reason it is not being triggered. I use Core Control plugin for testing. When I 'Run Now' through it, it works fine. What could be possible reason? Any hint that could facilitate me to get to the cause? There is no argument to the handler and it is a reoccurring once daily task.


title: Confit theme on Wordpress.org

text: I'm a fairly new user of wordpress.org. I have a wordpress.com site using the Confit theme and wish to transfer it to .org. I exported the site from .com and into imported to .org successfully, only to find that .org did not offer the Confit theme. I have since downloaded the directory for the Confit theme from here: https://wpcom-themes.svn.automattic.com/ and saved it in the wp- content/themes/confit. The Confit theme option appears normally in the installed themes section of the .org suite, alongside twenty eleven and twenty twelve preinstalled themes. However, when trying to apply the theme to the site, the progress bar gets half way before the whole thing turns blank, no matter what address within the site I try and visit. I can no longer access the admin page to change the theme back. As a result, I wiped the databases on the domain, deleted and reinstalled wordpress on the site etc. Again the site works fine until I try to apply the theme. The last time, I have tried to preview the theme before applying it and, unsurprisingly, the preview is blank - no side bar or anything. Can anyone suggest what I might have done wrong when installing the theme? Cheers, Tom.


title: Exclude category from loop not working

text:
I have this code in my index.php file. I have a different template for a static home page, this is the blog page. I'm trying to exclude all posts with the category "new" which is tag_id "13"               <?php query_posts($query_string . '&cat=-13'); ?>     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>          <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<?php the_title(); ?>

<?php the_excerpt(); ?> <a href="<?php the_permalink()?>">read in full

Written by: <?php the_author_posts_link(); ?>
                                <?php the_time('F jS, Y') ?>

          <?php endwhile; ?>      Any ideas why this isnt working?


title: single page site with subpages

text:
i want to make a single page site which has subpages with following structure about us   team   -member1   -member2   contact   and i want the output to be like
     team content

     team content

              member1 content

              member2 content

     team content
      and this is my loop so far               <?php query_posts(array('post_type'=>page, 'orderby'=>menu_order, 'post_parent' => $thePostID)); ?>                  <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                       <?php if ( 0 == $post->post_parent ) { ?>
<?php the_title(); ?>
                  <?php } else { ?>
<?php the_title(); ?>
                  <?php } ?>
<?php the_title(); ?>
                  <?php the_content(); ?>             <?php endwhile; endif; ?>      thanks for helping, helmut


title: Taxonomy term in permalink

text: I have a big problem. I have been banging my head on this all day long. It seems to be a stupid easy question. Possibly also with a stupid easy answer. But I can't seem to find it. What I want is simple. I have a custom_post_type called "producten" and a taxonomy called "producten_categorie". Inside there I have got some couple hundred products that are all assigned to a "produten_categorie" term. I want to change the permalinks so they display the taxonomy term in the product permalink. **What I have now is as follows:**   * www.domain.com/producten/ (producten archive)     * www.domain.com/producten/category (producten category archive)   * www.domain.com/producten/category/subcategory (producten subcategory archive)   * www.domain.com/producten/post_tile (single page for post in "producten") **What I want is the following:**   * www.domain.com/producten/ (producten archive)     * www.domain.com/producten/category (producten category archive)   * www.domain.com/producten/category/subcategory (producten subcategory archive)   * www.domain.com/producten/category/post_tile (single page for post in main category)   * www.domain.com/producten/category/subcategory/post_tile (single page for post in sub category) I can't get it to work. I first tried the "custom post type permalinks" plugin. Which did not work and gave me 404 errors. Even after flushing the permalinks more than a few times. After that I tried manually changing the permalink by using "filter_post_type_link". But I just can't get it to work. You can find my code for registering the post type on the taxonomy here -> http://pastebin.com/DMfA21qb Hope someone can help me.


title: Get all image from single page using this query

text:
I'm having some trouble with this sample widget code. I want to get all images (Minus the post thumbnail) from a page called "Gallery" but for some reason this is pulling all uploaded images from the entire site. Also, how would I go about excluding the post thumbnail from this query?                 query_posts('pagename=gallery');     if (have_posts()) :      echo "
";     while (have_posts()) : the_post();         $args = array(         'post_type' => 'attachment',         'numberposts' => 1,         'post_status' => null,         'post_parent' => $post->ID     );          $attachments = get_posts( $args );         if ( $attachments ) {         foreach ( $attachments as $attachment ) {            echo '
';            echo wp_get_attachment_image( $attachment->ID, 'full' );            echo '
';           }         }     endwhile;          endif;      wp_reset_query();


title: How to add a 2nd "featured image" to a post?

text: My theme has a slider widget that allows the end user to select a category and it assigns the posts in that category to the slider. If a post has a featured image, its used as the background of the slide for that post. However, there are cases where the featured image on the post itself needs to be different that the one used in the slider. What are some options for a workaround? Ideally, I'd like to just create a clone of the "Featured Image" panel, calling it "Slider Image". How difficult would that be? What files do I need to clone? Any plugins that already do this?


title: What plugin should I use for a basic user signup/login system

text: I need to present a user signup/login system on the front end of my site. My requirements are pretty straight forward:   * I don't want the user to ever wind up in the WP admin panel.    * A signed up user will have access to one additional page    * I want to keep track of email addresses from these users   * I would like to provide a forgot my password link.    * The users only need to provide an email and password to sign up Any ideas? plugin or otherwise?


title: Notice: Undefined index

text:
Got this great contact us page to use on in my theme. It works great, but the problem is, in debug mode I get undefined index errors on the following line of code:               $name       = $_POST['name'];     $email      = $_POST['email'];     $message    = $_POST['text'];     $human      = $_POST['human'];     $submitted  = $_POST['submitted'];      So I changed the code to the next two pieces of code based on previous answers and tutorials:               $name       = (isset($_POST['name'])        ? $_POST['name']    : '');         $email      = (isset($_POST['email'])       ? $_POST['email']   : '');         $message    = (isset($_POST['message'])     ? $_POST['message'] : '');         $human      = (isset($_POST['human'])       ? $_POST['human'] : '');         $submitted  = (isset($_POST['submitted'])   ? $_POST['submitted'] : '');      and                    if (isset ($_POST['name'])) {       $name = $_POST['name'];     }     if (isset ($_POST['email'])) {       $email = $_POST['email'];     }     if (isset ($_POST['message'])) {       $message = $_POST['message'];     }     if (isset ($_POST['human'])) {       $human = $_POST['human'];     }     if (isset ($_POST['submitted'])) {       $submitted = $_POST['submitted'];     }      The first set of code removes all debug error messages, but when you submit the form, it triggers the > $missing_content message which fires when all fields are left empty. The second set of code gives me undefined index debug error messages on the following set of code:               $headers = 'Van: '. $email . "\r\n" .         'Aantwoord op: ' . $email . "\r\n";            if(!$human == 0){     else if ($submitted) my_contact_form_generate_response("error", $missing_content);
<?php _e('Naam')?>*
<input type="text" name="message_name" value="<?php echo esc_attr($name); ?>" placeholder="Iemand Anders">

<?php _e('E-pos')?>*
<input type="text" name="message_email" value="<?php echo esc_attr($email); ?>" placeholder="iemand@iemandanders.com">

<?php _e('Boodskap')?>*
<textarea type="text" name="message_text" placeholder="Skryf asseblief jou boodskap hier."><?php echo esc_textarea($message); ?></textarea>
      It also gives me the > $missing_content error. This all tells me that somehow somewhere I must define name, email, text, human and submitted. And this is where my limited skills halts me. Any suggestions on how to define the above and to remove the errors and still have the form to work as it should. Before I forget, the complete code can be viewed here


title: Login redirect problem

text: hey i got a slightly weird problem.. i got a form enabling login in certain single's according to the cateory and user level.. it works great but the server which is windows (where the website is hosted on returns the wrong "current page" value Meaning.. this:               'redirect' => site_url( $_SERVER['REQUEST_URI'] ),       returns this: www.somewebsite.com/sub/sub/?p=100 instead of: www.somewebsite.com/sub/?p=100 **This is the actuall form:** > >               <div class="logincategory"> >                 <?php wp_login_form( $args ); >                  $args = array( >                 'echo' => true, >                 'redirect' => site_url($_SERVER['REQUEST_URI']), >                 'form_id' => 'loginform', >                 'label_username' => __( 'Username' ), >                 'label_password' => __( 'Password' ), >                 'label_remember' => __( 'Remember Me' ), >                 'label_log_in' => __( 'Log In' ), >                 'id_username' => 'user_login', >                 'id_password' => 'user_pass', >                 'id_remember' => 'rememberme', >                 'id_submit' => 'wp-submit', >                 'remember' => true, >                 'value_username' => NULL, >                 'value_remember' => false ); ?> >                 </div> >   > > **So..** this is a bug of the server which i can't solve directly **so i used** > $myCurrentUrl = site_url( $_SERVER['REQUEST_URI'] ); $myCurrentUrltwo = > str_replace("www.somewebsite.com/sub/sub/","www.somewebsite.com/sub/", > "$myCurrentUrl"); That (when eching) returns the right URL but how do i insert the variable into this command                   'redirect' => site_url( $_SERVER['REQUEST_URI'] ),


title: When is get_template_part() preferable to simply using the template.php files?

text: In this post on wordpress.stackexchange.com I asked whether using get_template_part(), as demonstrated in the TwentyTen theme, is a recommended best practice. The general consensus I got was that it was not necessarily the best practice in all situations. This related question then is: can you provide me with an example where using get_template_part() _would_ be the recommended approach, over simply defining the separate template.php files? For example, I can either define archive.php, single.php and page.php; or I can define loop-archive.php, loop-single.php and loop-page.php. In what circumstances would it be preferable to use get_template_part('loop', 'single') and leverage loop-single.php versus simply defining single.php?


title: I have over 3000 child pages - but I need a different main page

text: I set up my website using WordPress. The goal, to have about 70 pages directly linked to the main page (my landing page) and most of those pages having anywhere from 5 to 200 blogs coming off each of those. All seemed well and good until i realized that the reason I was seeing 'no parent' as the parent page of each of my 70 pages was because my main page is not a page at all, but merely a blog post! Oh, no, what to do! I tried creating an identical page to my initial blog main one. I also went into the settings>reading and checked off that I wanted the main page to land on this new page. I attempted to then begin transferring the 70 pages underneath that newly created page (copy of the original main blog). But I soon found out that it won't work, because when I go to the second tier of pages, the url shows three tiers. I want my second tier of pages to have urls that show only two tiers. this is what i want: ttp://www.mainpage.com/ ttp://www.mainpage.com/child-page/ ttp://www.mainpage.com/child-page/grandchild-page/blog but instead I have this: ttp://www.mainblog.com/newlycreatedpage/child-page/grandchild-page/blog I'm a complete newbie and not familiar with unusual jargon-like web building terms. Is it possible for me to change out the main blog landing site for a main web page, and switch the other child pages over to it so I can have a clean-looking url string? At this point I am considering trashing over 3000 pages and starting from scratch!


title: How to show a tag archive of one post type only

text: I have a site with multiple custom post types and taxonomies. The taxonomies are shared across all of the post types. On the archive page of the 'videos' post type, I want to show a list of all of the 'country' tags that are associated with videos. When this link is clicked on, I'd like to be able to go to an archive for that country but that only shows the 'videos', not the other post types that may have the same country tag. I also need to be able to do the same for other post types and taxonomies, e.g. when on the 'galleries' post type archive, a tag cloud is shown that links to the tag archive showing only the galleries. I think that this should be easy, but I just can't figure it out! Will I need to create archive templates that take arguments passed via the url? E.g. mysite.com/country/canada?type=video ..and then manipulate the get_tags function somehow? I really just can't get my head around this one. Cheers for your help.


title: How do you add custom logo to entire themes

text: I would like to add a custom logo to my entire blog network's dashboard. I went trough a recipe on smashing magazine and got this code:               //hook the administrative header output     add_action('admin_head', 'my_custom_logo');          function my_custom_logo() {         echo '           <style type="text/css">           #header-logo { background-image: url('.get_bloginfo('template_directory').'/images/custom-logo.gif) !important; }           </style>         ';      }      Where do I add it? I think that I should add it in `functions.php`. But if so I should add the code to every theme in my mutlinetworks. Does any one have idea to add it to the entire network? I should also able to set only for a particular sub and not to entire network If I change my mind in future :) Thank you!


title: How to get the date dynamically from archive.php to date.php?

text:
My **archive.php**               <?php wp_get_archives( array( 'type' => 'monthly', 'limit' => 12, 'show_post_count' => 1 ) ); ?>
      My **date.php**               $date1 = get_query_var('date');                        // The Query                   query_posts( array ( 'date' => $date1, 'posts_per_page' => -1 ) );                        // The Loop                  while ( have_posts() ) : the_post(); ?>
                     <?php the_time( get_option( 'date_format' ) ); ?>
                     <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?>

                        <?php endwhile;                        // Reset Query                   wp_reset_query();?>      but it show all the posts form the blog. how can I edit it to show the post from the proper year and month when some one click the link generated by arhive.php?


title: Custom Permalink: /year/month/post-goes-here/?

text: I'm experimenting with adjusting permalinks (for purely educational experimentation). What would I need to place in the "Custom Permalink" option to get my post URLs in the form... /year/month/post-title-goes-here/


title: Redirect to current page after wordpress login

text: I just want to redirect the users to their current page after logged in my wordpress website. I have used the following but it won`t work for me since it is in page that created from the admin side.               <?php echo wp_login_url(get_permalink()); ?>


title: WordPress Tag Page Hook?

text: Is there any hook for a tag page, so I can alter it's content before outputting?


title: Is it possible to split database tables using HyperDB?

text: I'm looking for an answer from someone who's implemented HyperDB or has knowledge of it. I have a database which has just passed the 100mb mark a week or so ago, the problem is my host only allows databases of 100mb a time. I was looking to implement HyperDB but wanted to find out some information first. My current database is around 100mb alone on the posts table of the database. If I implement HyperDB will this table get split between two databases?


title: Filter custom posts using auto populated dropdown selectors

text: I've created a custom post type named _agent_. I have a page that lists all agents. When I add an agent I have a whole series of custom meta boxes that can be filled out, region, specialty, language... I'd like to add a series of dropdown boxes on the front end that will populate with all the terms from each custom meta. For example a regions dropbox would populate with all the regions from all the agents. If I add a new agent in a new region, the dropbox will automatically pick that up. Thanks for looking.


title: WordPress missing user roles on local dev machine. Live site works fine

text: I have a live WordPress installation and a local one for development purposes. I just exported the live database, replaced all occurences of the live siteurl with the local one, and imported on my dev machine. Problem is that on my dev machine all users have lost any permissions. When logging in I get:               Notice: Undefined offset: 2 in /var/www/mysite/wp-admin/includes/plugin.php on line 1390       On a page template I dumped out the current userinfo with               global $current_user;     var_dump( get_currentuserinfo() );      This returns NULL on my dev machine and the correct userinfo on my live installation. I double checked the table prefixes, permissions, tried a clean WordPress installation, etc but had no luck. The confusing thing about this is, that I can query the userinfo perfectly fine with a custom sql query. EDIT: Upon further inspection I found out that the global $wp_roles contains no user roles and capabilities. WordPress somehow can't retrieve this from the database... EDIT 2: Sorry for the edits. But I found the problem. Inside the wp_options table there is a row "wp_user_roles". The value, an unserialized string did somehow include whitespaces which lead to errors when trying to unserialize the string. I replaced the database value with the live site's one and everything works now.


title: Add page title as a javacript variable to specific posts

text: I'm very new to WordPress and I'm sorry if this question may sound ridiculous. I need a way to add the post title into it's content, only in specific posts, and not always at the same place in the content. I've done some research, but all I find is about changing functions in .php files or in _The Loop_. I don't know if there are any kind of predefined functions, tags or code that can be used to print this type of information manually into the content. I tried including `<?php` code, but obviously is not the way as it gets commented (please correct me if I'm wrong). Ps: This is intended to be used by content publishers, SEOs, and people knowing almost nothing about programming.


title: Wordpress database synch between dev and prod

text: Question has been asked before about how to synchronize files as well as the database between two Wordpress installations. For the database level, the answer is usually to basically dump one database and insert it onto another server. The problem with this is that you end up losing any changes that have potentially been made on the prod server. For instance, usage metrics, comments, etc... With this in mind, I was starting to wonder whether the it would be possible to extend the Wordpress ORM so that you can generate deltas and then inject those into the prod site. Has anyone tried this, looking into it, or have any ideas or comments ?


title: How to edit attachment with media-upload.php?

text: I'm looking to edit an attachment and I'm trying to supply a link to the existing preview image.                    <img src="<?php echo $src_output; ?>" class="preview-upload"/>           I tried adding a **post_id** argument to the href but the thickbox only shows the media-upload box for a new upload. How can I edit an existing image using a link on the preview image?               <a href="media-upload.php?type=image&TB_iframe=true&post_id=<?php echo $id; ?>" ...


title: Unable to add TAB character to post?

text: I am using the CodeColorer plugin to display source code in my WordPress. I am trying to have my code indented so that it displays properly on the website. However, when I try to add the following code to the WYSIWYG editor:               [cc lang="csharp"]     using System;     using System.Collections.Generic;     using System.Linq;     using System.Text;          namespace LittleSoftwareStats     {         public static class Config         {             public static bool Enabled { get; set; }                  internal static string ApiUrl             {                 get                 {                     UriBuilder uri = new UriBuilder((Config.ApiSecure) ? ("https") : ("http"), Config.ApiHost, Config.ApiPort, Config.ApiPath);                          return uri.ToString();                 }             }             internal static string AppId { get; set; }             internal static string AppVer { get; set; }                  internal const string ApiHost = "stats.yourwebsitehere.com";             internal const int ApiPort = 80;             internal const bool ApiSecure = false;             internal const string ApiPath = "api."+ApiFormat;                  internal const string ApiFormat = "json";             internal const string ApiUserAgent = "LittleSoftwareStatsNET";             internal const int ApiTimeout = 25000;         }     }     [/cc]      When I update it, the code then becomes:               [cc lang="csharp"]     using System;     using System.Collections.Generic;     using System.Linq;     using System.Text;          namespace LittleSoftwareStats     {     public static class Config     {     public static bool Enabled { get; set; }          internal static string ApiUrl     {     get     {     UriBuilder uri = new UriBuilder((Config.ApiSecure) ? ("https") : ("http"), Config.ApiHost, Config.ApiPort, Config.ApiPath);          return uri.ToString();     }     }     internal static string AppId { get; set; }     internal static string AppVer { get; set; }          internal const string ApiHost = "stats.yourwebsitehere.com";     internal const int ApiPort = 80;     internal const bool ApiSecure = false;     internal const string ApiPath = "api."+ApiFormat;          internal const string ApiFormat = "json";     internal const string ApiUserAgent = "LittleSoftwareStatsNET";     internal const int ApiTimeout = 25000;     }     }     [/cc]      I have also tried replacing the spaces with ` `, and `	` and the actual TAB character. If I add the TAB character in the Text editor then it will stay but once when I switch it to the Visual editor then it is all removed. I was wondering if anyone knows a trick to keeping the code indented or if there's someway to fix it (without modifying the CodeColorer plugin)?


title: Theme Customization API and child themes

text: I've recently developed a parent theme that makes heavy use of the Theme Customization API. Is there an easy way to port these settings when a user activates one of my child themes? Currently, the data previously saved in the Customize screen disappears when activating a child theme. Of course, once they reactivate the parent theme, the settings return. Any dealt with this yet?


title: Code to auto expire posts after 30 days

text: I've tried the plugins that are available in the Wordpress plugins section but they seem to fail miserably. Initially, I used Auto Post Expire By User Role which worked for a time, but for some reason now it doesn't. What I want is to add a code in functions.php that will automatically set as drafts posts which are 30 days older than their published date. I have the following code but don't know if this is the one that I should be using. Is this correct and if not, what is the correct form?               function expire_posts() {     global $wpdb;     $daystogo = "30";     $sql = "UPDATE wp_posts SET `post_status` = 'draft' WHERE `post_type` = 'post' AND DATEDIFF(NOW(), `post_date`) > '$daystogo')";     }          add_action('wp_head', 'expire_posts');


title: What's the best way to show custom post types? With page template it's not perfect!

text:
I created a custom post type with name career. I would like to know what's the best way to list the posts. I created a page template with a query inside, but the pager is invisible. I don't know what's wrong.

                     Position	                     Location	                     Close date	                     View details
             <?php $mypost = array( 'post_type' => 'career', );             $loop = new WP_Query( $mypost ); ?>             <?php while ( $loop->have_posts() ) : $loop->the_post();?>             <?php                  $custom = get_post_custom($post->ID);                 $location = $custom["location"][0];                 $close_date = $custom["close_date"][0];             ?>             <tr id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                 <?php the_title(); ?>	                 <?php echo $location; ?>	                 <?php echo $close_date; ?>	                 <a href="<?php the_permalink(); ?>" title="Details">> Details
             <?php endwhile;  ?>
<?php next_posts_link( '← Older'); ?>

<?php previous_posts_link( 'Newer→' ); ?>

      How do you list your custom post types with pager?


title: Limit user to one comment

text: is there a nice function I can use to limit logged in users to one comment per post? I'm setting up a review system and only one review permitted per user. Thanks.


title: How to detect if a viewer is not registered/not logged in and prompt the viewer to register/sign in?

text: I want to "lock" a certain portion of my website (i.e., user reviews) only to users who are registered and logged in. This is similar to what Quora does. However, this is not just a simple restrict content. I want to be able to detect the user scrolling down and as he scrolls down, start to blur and restrict content while asking him to register/log in to view more. Again, like how Quora does. However, for viewers I want to show a blurred background of the content (as a teaser, if you will) of what it will look like, but require them to register/log in first: ![screenshot](http://i.imgur.com/XYQbgrl.png) I am working with Wordpress/PHP -- I've googled for hours but can't find a plugin or solution for this.


title: Check Paypal Purchase is Success or Not in Easy Digital Download Plugin

text: I trying to do something for every purchase of corresponding product in easy digital download. Let say i need to add the auto random discount code for every purchase made in easy digital download. I tried with different hooks. But still i didn't get the correct callback on success process of paypal. Let i make it alert on success callback of paypal. what i am trying is something like this               if($paypal == 'success') {     //do something     } else {     //do something     }     function pw_edd_on_complete_purchase($payment_id) {              // Basic payment meta         $payment_meta = edd_get_payment_meta($payment_id);         ?>         <script type="text/javascript">             alert("this is for payment");         </script>         <?php              // Cart details         //$cart_items = edd_get_payment_meta_cart_details($payment_id);              // do something with payment data here     }          add_action('edd_complete_purchase', 'pw_edd_on_complete_purchase');      But i am not sure how to do this. I have the product which name as gift card let say $5. If the user purchased this gift card then he/she get the random code of discount for purchasing some other product in future. Can anyone tell me which hook is achieving the above criteria ? Any Suggestion would be great thanks


title: Retrieving Image Storage path

text: $attachment_id = 8; // attachment ID     $image_attributes = wp_get_attachment_image_src( $attachment_id ); // returns an array      Could you please specify which database table is referred for to retrieve the image source url?


title: JSON API : Add a method called create_user to create a new user

text: First of all I would like to thank **Dan Phiffer** for providing such a wonderful plugin. I have installed the JSON API Plugin on my blog and it works and post perfectly. The problem that I need to add a method called create_user to create a new user. Can someone give me the steps to add such method to JSON API. Thanks for all :)


title: Approve Page Edits

text: I'd like to create a role group where users can edit pages and submit them for approval before they are displayed on the website. I've used the following roles (shown below) but they don't allow me to approve page edits. Is it possible to create a role where a user can edit pages and then have the edits be approved by me before being shown on the website?               edit_pages     edit_published_pages     edit_others_pages


title: /tag/tag_name/page/2 gives a 404 error

text: I created my own template for list of entries for certain tag (`tag.php`), It will shows up 10 entries, and with Previous & Next link.               <?php     $paged = get_query_var('paged') ? get_query_var('paged') : 1;     $args = array(     'post_type'     => 'custom_post',     'posts_per_page' => '10',     'tag'           => "$some_tag",     'paged'         => "$paged",     'post_status'   => 'publish',     'orderby'       => 'date',     'order'         => 'ASC'     );           $loop = new WP_Query($args);     while($loop->have_posts()): $loop->the_post();     // displaying items here     endwhile;     <nav id="page-nav">         <?php previous_posts_link('≪ Previous', $loop->max_num_pages); ?>         <?php next_posts_link('More ≫', $loop->max_num_pages); ?>     </nav>     <?php endif; ?>     ?>      It creates a `More` link with `/tag/ta_name/page/2` but when i click on it, it shows 404. I've checked on other blogs, tag archives pagination indeed ends with `/page/N` so i guess there is no problem with my url. Where did i make the mistake or any of my settings is wrong?


title: Tables not showing divs and loop/php items

text: I know this is an absurd questions, as who uses tables anymore? I got handed this and just need to make it work really. I don't know anything about tables so it's been a learning experience. I finally got my loop to show up but only parts of it. I'm missing some crucial items and can't figure it out. Example: post title shows up but its not a hyperlink. I tried to put these in the post but they broke terribly so I used pastebin. I guess cause the tables? lol blog.php can be viewed here: http://pastebin.com/fYyhGMYa Live version: http://elite.ikvclients.com/blog/ Really appreciate any insight or help. This is confusing as hell.


title: How to auto send email when publishing a custom post type?

text: I'd like to have an email automatically sent out to my website's subscribers when I publish a post for a specific custom post type. I've found a few plugins that will do this but only for regular posts (or for any post type that gets published, not allowing you to specify a particular post type). Any suggestions would be greatly appreciated! Thanks.


title: Automatic linking terms

text: I am trying to link words that show up anywhere on the website to go to a pre- defined internal url. In the post editor the author is able to choose a product from a drop-down menu using custom fields to add to the post. Client-side, all the products chosen display inline separated by a comma. There is no limit to the amount of products that can be listed, and those names include hyphens and/or slashes. Example: AWESOME-2000 or RAD3/45 I have tried a variety of automatic linking plugins (such as ultimate seo and seo smart links) and all fall short in either being able to handle special characters in the term or they don't link anything in custom fields. Does anyone have a suggestion of what else to try? I'm even willing to try adding a hook from functions.php to swap terms from a pre-define list, but I don't author php yet so have no idea where to start on that front (hence looking for plugin).


title: do_shortcode() doesn't work if shortcode contained in variable, works if shortcode passed as string

text: I'm developing a plugin, wherein one of the features is to switch out forms on a specific page by changing the shortcode within a custom field. within my plugin file:               function getShort()     {         global $post;         $m = get_post_meta($post->ID, 'short', true);         return $m;     }      within my theme file:               $short = getShort();     echo do_shortcode($short);      With the code above, it just prints out the shortcode. If I echo the value of $short, copy and paste that as the argument for do_shortcode(), it prints out the expected value. I am 100% confident that the value of $short is a string, and is the correctly formatted shortcode. Any idea why this doesn't work?


title: How 'secure' are loops?

text: I am using loops as means of displaying personal meta and customer information on the frontend. For example, I have a page which displays a user's 'profile' information to edit. Their profile is custom post type that was created when the registered. The loop for the edit screen finds the one cpt based on the current user id, populates the form fields, and after submission updates the post. Is this secure? If not what some better ways to handle this type of action? *--Edited to include example code Here is a sample loop. This is pulling in a vendor's items they sell. The GF hooks pre-populate the form in the middle with the meta from the product, after submission the post is updated.               <?php     $q = new WP_Query( array( 'author' => $current_user->ID, 'post_type' => 'product' ) );       if ( $q->have_posts() ) {           while ( $q->have_posts() ) {              $q->the_post( ); ?>                   <div id="<?php the_id(); ?>" class="tab_content_trip" style="display:none;">                    <?php echo do_shortcode('[gravityform id="7" title="false" description="false"  ajax="true"]'); ?>              </div>                  <?php }        wp_reset_postdata();     } ?>      So my question is if it is possible for someone to somehow hijack a loop like this and edit other users posts in some way? (of course not including if they somehow steal their password, or something of that nature) Essentially, I am seeking some insight on best practice for securely filtering user information to be displayed on the frontend


title: Calculate percentage of post by category

text: Is it possible to calculate the percentage of posts in each given category? I'd like to make a bar chart to visualize the amout of posts in those categories. I thought what one needs would be the total amount of posts, the amount of posts in each category and then a PHP function that calculates percentages with those values and applies a variable to it which I need to use when building the bar chart. I am not very familiar with extended PHP, so if anyone could show me the right direction, I'd be grateful


title: How to upload images using Settings API

text: I want to allow users to upload images for use in a rotating banner. I tried using the media library, but didn't get much help ... So I thought, I'd just implement the upload myself. But I encountered another problem... I am using the settings API they do the update options and stuff for me. How can I handle the upload then? I thought of using the validate callback to upload images and then set $_POST variables manually so that Settings API can save those. But it sounds wrong. Any ideas?


title: Does WordPress validate inputs to all functions? (such as get_user_meta and insert_user_meta)

text: Does WordPress validate inputs made to all built-in functions that access the database to protect against SQL injection vulnerabilities or do we have to validate before passing them?


title: Taxonomy filter all children

text: I have a custom taxonomy filter that will filter all the pages in the selected taxonomy. I would like the code to select the pages in that taxonomy, and the children of thous pages. Heres the code.               add_action('restrict_manage_posts', 'restrict_manage_posts_section');     function restrict_manage_posts_section()     {         global $post_type;         if ( is_object_in_taxonomy( $post_type, 'section' ) )         {             $dropdown_options = array(                 'show_option_all' => __( 'View all sections' ),                 'hide_empty' => 0,                 'hierarchical' => 1,                 'name' => 'section',                 'show_count' => 0,                 'taxonomy' => 'section',                 'orderby' => 'name',                 'selected' => $cat             );                  add_filter('wp_dropdown_cats', 'wp_dropdown_section_filter', 10);             wp_dropdown_categories( $dropdown_options );             remove_filter('wp_dropdown_cats', 'wp_dropdown_section_filter', 10);         }     }          function wp_dropdown_section_filter($select)     {         $terms  = get_terms('section', array('hide_empty' => false));            foreach( $terms as $term )         {             $select = str_replace('value="'.$term->term_id.'"', 'value="'.$term->slug.'"', $select);             if (isset($_GET['section']) && $term->slug == $_GET['section']){                 $select = str_replace('value="'.$term->slug.'"', 'value="'.$term->slug.'" selected', $select);             }         }            return $select;     }      EDIT Here is my Custom Post Type and Taxonomy Function               /* Register Custom Post Type and Taxonomy     ---------------------------------------------------*/     add_action('init', 'register_module_type');     function register_module_type() {         $labels = array(             'name' => _x('Modules', 'post type general name'),             'singular_name' => _x('Modules', 'post type singular name'),             'add_new' => _x('Add Module', 'module item'),             'add_new_item' => __('Add Module'),             'edit_item' => __('Edit Module'),             'new_item' => __('New Module'),             'view_item' => __('View Module'),             'search_items' => __('Search Module'),             '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,             'rewrite' => array( 'slug' => 'module', 'with_front' => false ),             'capability_type' => 'post',             'hierarchical' => true,             'has_archive' => true,             'can_export' => true,             'menu_position' => null,             'supports' => array('title','editor','thumbnail',/*'excerpt',*/'revisions','custom-fields','post-formats'/*,'page-attributes'*/)             #'taxonomies' => array('category', 'post_tag')         );               register_post_type( 'module' , $args );         #register_taxonomy_for_object_type('category', 'testimonial');         #register_taxonomy_for_object_type('post_tag', 'testimonial');              $labels = array(             'name' => _x( 'Sections', 'taxonomy general name' ),             'singular_name' => _x( 'Section', 'taxonomy singular name' ),             'search_items' =>  __( 'Search Sections' ),             'all_items' => __( 'All Sections' ),             'parent_item' => __( 'Parent Section' ),             'parent_item_colon' => __( 'Parent Section:' ),             'edit_item' => __( 'Edit Section' ),             'update_item' => __( 'Update Section' ),             'add_new_item' => __( 'Add New Section' ),             'new_item_name' => __( 'New Section Name' ),         );                register_taxonomy( 'section', array( 'module' ), array(             'hierarchical' => true,             'labels' => $labels,             'show_ui' => true,             'query_var' => true,             'rewrite' => array( 'slug' => 'section' ),         ));              #add_theme_support( 'post-formats', array( 'chat','aside','gallery','link','image','quote','status','video' ));         flush_rewrite_rules( false );     }


title: Plugin - Social media share buttons

text: Is there a plugin with the social media share buttons where I have more control of where to place them? At the moment, the only one's I can find only allow you to place the buttons at the top or bottom of pages/posts. Ideally I'd like a snippet of code to just place wherever I wanted.


title: Custom Post Type with Custom Title

text: I have a custom post type without title support and I'm trying to generate one from post's taxonomies and custom fields. To do so, I'm using this code:               function custom_post_type_title_filter( $data , $postarr )         {           if ($postarr['post_type'] == 'cars'){                 $id = get_the_ID();                 $engine= ', '.get_post_meta($id, 'Engine', true).'l';                 $terms = wp_get_object_terms($id, 'brand');                 $abrand= ' '.$terms[0]->name;                 $amodel = ' '.$terms[1]->name;                 $data['post_title'] = $id.$abrand.$amodel.$engine;           }           return $data;         }         add_filter( 'wp_insert_post_data' , 'custom_post_type_title_filter' , 99, 2 );      Problem is, to make it work, I have to republish my post. It does not work with new post (it has no ID yet, I guess) and if I change custom field values in post, it won't generate name from them yet, I'll have to save it twice to get it done. Can someone share a solution with example how it's done properly? Also, would be nice to be able to set custom slug too (different from the title).