title: For loop logic for combinations

text:
I have WP E-Commerce installed and I'm moving whole it's dashboard to frontend. I have everything ready and am on the last part. In fact I thought this part was ready, until I added two variations, where I understood that it works a little bit different. Let me show you what I'm talking about. ![variations1](http://i.stack.imgur.com/nEh2j.png) And this are product variations ![variations2](http://i.stack.imgur.com/rNrcf.png) here every variation from second category is assigned to first like (1,a;1,b;1,c);(2,a;2,b;2,c);(3,a;3,b;3,c); Here is my codebin So how to remake my for loop with some nested for loop ( I guess ) to work like combinations. At this moment it just creates separate variations without nesting them.               $parent = $_POST['variationParent'];     $children = $_POST['variationChild'];     if(!empty($parent)) {         $affparent = wp_set_post_terms( $post_id, $parent, 'wpsc-variation', true );         $affchildren = wp_set_post_terms( $post_id, $children, 'wpsc-variation', true );         $N = count($children);         for($i=0; $i < $N; $i++) {             $cat_id = (int) $children[$i];             if(!in_array($cat_id,$varArray)){                 $cat = get_term( $cat_id, 'wpsc-variation' );                 $new_entr = array();                 $new_entr['post_title'] = esc_attr(strip_tags($_POST['postTitle'])) . " (" . $cat->name . ")";                             $new_entr['post_content'] = esc_attr(strip_tags($_POST['postContent']));                                 $new_entr['post_status'] = 'inherit';                                 $new_entr['post_category']  = $cat->term_id;                                 $new_entr['post_type'] = 'wpsc-product';                                 $new_entr['post_parent'] = $post_id;                                 $new_entr['post_author'] = $user_id;                                 $var_id = wp_insert_post($new_entr);                                 wp_set_post_terms( $var_id, $cat->term_id, 'wpsc-variation' );                                 update_post_meta($var_id, '_wpsc_price', $price);                                 update_post_meta($var_id, '_wpsc_special_price', $special_price);                                 update_post_meta($var_id, '_wpsc_sku', $sku);                                 update_post_meta($var_id, '_wpsc_stock', $stock);                             }                         }                     }       I think at first I need to remake my FORM to chain parents with their parent.               <fieldset>

             <?php                 $parentArray = array();                 foreach ($parentVariations as $variation) {                     $parentArray[] = $variation->term_id;                 }                 foreach($variationCategories as $category) {                     //var_dump($category);                     //echo ;                     // check if this variation is already checked                     if (in_array($category->term_id, $parentArray)) {                         if ($category->parent == 0) {                             echo "

<input type='checkbox' checked name='variationParent[]' autocomplete='off' value='". $category->term_id ."'>" . $category->name . "";                         } else {                             echo "

<input type='checkbox' checked name='variationChild[". $category->parent ."][]' autocomplete='off' value='". $category->term_id ."'>" . $category->name . "

";                         }                     } else {                         if ($category->parent == 0) {                             echo "

<input type='checkbox' name='variationParent[]' autocomplete='off' value='". $category->term_id ."'>" . $category->name . "";                         } else {                             echo "

<input type='checkbox' name='variationChild[". $category->parent ."][]' autocomplete='off' value='". $category->term_id ."'>" . $category->name . "

";                         }                     }                 }             ?>
     </fieldset>      That's the output of this form. first value in array is parent termID and second is ChildID.               array(2) {           [3]=> array(3) {               [0]=> string(1) "4"               [1]=> string(1) "5"               [2]=> string(1) "6"         }          [7]=> array(3) {               [0]=> string(1) "8"               [1]=> string(1) "9"               [2]=> string(2) "10"         }     }      So my code should assign all values from parent[7] to parent 3. meaning in the end of the loop, there will be 9 variations. Question is, how to solve this nested loop. count parents first and and nest that many loops (or foreach) ? (also might be interesting how wpsc deals with that, which I don't understand at all wpsc class


title: How we display Archives for specific categories

text:
I just want to show `Archives` for special categories. For example i have `categories` `abc`,`xyz`. I just want to show `Archives` for `xyz` not for abc. Currently i am using code to display Archives is

<?php wp_get_archives( array( 'type' => 'monthly', 'format' => 'li', 'show_post_count' => 1, 'include'=>1 ) ); ?>

      so how can i show `Archives` for `xyz` `category` only. Thanks


title: How can I use wp_save_image_editor_file filter?

text: I would like to use `wp_save_image_editor_file` filter, but there is no documentation on the internet. Also, it seems that no matter how many arguments I pass to the handler, all are null.


title: How to make wp cron job not fire immediately?

text: I'm scheduling a job in wp cron:               add_action('my_cron_hook', 'my_cron_action');     wp_schedule_event( time(), 'interval1', 'my_cron_hook' );           function my_cron_action(){         //do something     }      The variable interval1 is set by the admin in another part of the code.   Also, there is a switch that lets the admin _enable_ or _disable_ the wp crop job. **My problem is this:**   my_cron_action is executed as soon as it is scheduled   (this means, as soon as the admin enables the cron job from the backend). **What i want to do is this:**   if we suppose that the time that the admin enabled the job is **T** ,   i want the job to be run at **T+interval1** for the first time, and _not at T_. The next thing i want after this is done, is to create a button "Execute job now" that will run the job as soon as it's clicked.


title: Load more posts (Ajax) in tabbed sidebar on single.php

text:
I'm trying to use this approach http://wordpress.stackexchange.com/a/56349/18144 to create a 'load more' button in the sidebar on single.php. I would like to able to load more posts in a sidebar tab after clicking the load more button. I'm missing something, since it doesn't work. But there are no errors in the console, so I don't really know where to start. The sidebar on single.php has the following (simplified)structure:
....

...

...

Up | My Fav's |Load More

           What I've got so far: In functions.php I've added:               add_action( 'wp_enqueue_scripts', 'wpa56343_scripts', 100 );          function wpa56343_scripts() {     wp_enqueue_script(         'wpa56343_script',         get_template_directory_uri() . '/js/ajaxscripts.js?ver=1.0',         array( 'jquery' ),         null,         false     );     wp_localize_script(         'wpa56343_script',         'WPaAjax',         array(             'ajaxurl' => admin_url( 'admin-ajax.php' )         )     );     }          add_action('wp_ajax_wpa56343_more', 'wpa56343_more');     add_action('wp_ajax_nopriv_wpa56343_more', 'wpa56343_more');          function wpa56343_more(){     global $wp_query;          $offset = $_POST['postoffset'];     $args = array(         'offset' => $offset,         'posts_per_page' => 10     );     $wp_query = new WP_Query( $args );          get_template_part( 'includes/ajaxsidebar');     exit;     }      ajaxscripts.js contains:               jQuery(document).ready(function($){          $('#blog-more').click(function(e){ // <- added         e.preventDefault(); // <- added to prevent normal form submission         var postoffset = 5;         $.get(             WPaAjax.ajaxurl,             {                 action : 'wpa56343_more',                 postoffset : postoffset             },             function( response ) {                 $('#new').append( response );             }         );     });          });      template part ajaxsidebar contains:               <?php if (have_posts()) : ?>                <?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail() ?><?php the_title(); ?>
                <?php endwhile; ?>      <?php endif; ?>


title: Update widget form after drag-and-drop "only specific plugin"

text: This solution, Update widget form after drag-and-drop, works correctly but I want to adapt this function to affect only a **specific plugin and not every plugin**. How could I do it?


title: Get data from Theme Options and use them into meta options field in custom post type

text: I want to grab data from my theme options and have to use them in meta option fields in custom post types. I know how to grab theme option data and show them on front pages but don't know how to grab it for backend usage. I want to use data from one of my theme options text field and put it into my metabox text field. Actually I have two check boxes on my metabox text field and also two metabox text fields above that text field. Also two text fields in my theme options in which I have to put some html and javascript code. So here is my code: Metabox text fields and checkboxes:               <input type="textarea" id="c" value="Your Name" />     <input type="textarea" id="d" value="My Name" />     <input type="checkbox" id="a" />     <input type="checkbox" id="b" />     <input type="textarea" id="e" />      Theme Option Text fields:               <input type="textarea" id="f"  />     <input type="textarea" id="g"  />      I have to put javascript in theme option text fields somewhat like this:               <div>     <script type=text/javascript> name: 'My Name is/', name2: 'Your name is/', </script>      </div>      Now comes the real worry. I want that when I click check box with the id 'a', the code from the theme options text field with the id 'f' will be put into the metabox text field with the id 'e' but with little modification. The modification i need is that the data from metabox text fields with the id 'c' and 'd' will first be added to the code that has been grabbed from the theme option text field with the id 'f' in such a way that value of metabox text field with the id 'c' is added to the "name: My Name is/(Here will be the value of text field with the id 'c')" and value of metabox text field with the id 'd' is added to the "name2: Your Name is/(Here will be the value of text field with the id 'd')". I am also using jquery code for these checkboxes behaviour. Here is my jQuery code.               $(function () {     $('#a, #b').change(function () {         var $a = $('#a'), $b = $('#b'), $c = $('#c');         if (this.id == 'a' && this.checked) {            $c.val('Hello World!');            $b.prop('checked', false);         } else if (this.id == 'b' && this.checked) {            $c.val('Not hello World!');             $a.prop('checked', false);         } else {            $c.val('');         }     });     });       Obviously there is flaw in this jQuery code as I don't want these values such as Hello world or Not Hello World of my metabox text field with the id 'c'. I want the value of that field as I explained earlier. Please help me in this regard. I am very much frustrated.


title: Exclude Author by ID

text:
How can I exclude authors by ID from this:               <?php     //displays all users with their avatar and their posts (titles)     $blogusers = get_users_of_blog();     if ($blogusers) {       foreach ($blogusers as $bloguser) {         echo '
';         $user = get_userdata($bloguser->user_id);         echo '
' . get_avatar( $user->ID, 128 ) . '
';         $args=array(           'author' => $user->ID,           'post_type' => 'post',           'post_status' => 'publish',           'posts_per_page' => 1,           'caller_get_posts'=> 1         );         $my_query = null;         $my_query = new WP_Query($args);         if( $my_query->have_posts() ) {           //echo 'List of Posts for ' . user->user_firstname . ' ' . $user->user_lastname;           while ($my_query->have_posts()) : $my_query->the_post(); ?>


title: Add a custom stylesheet for BlackBerry

text: I want a little help loading a custom stylesheet in wordpress. I'm using PHP to check if the user agent is BlackBerry. If yes, I want to load blackberry.css, if no, regular wordpress style.css. Here's what I have so far:               $ua = strtolower($_SERVER['HTTP_USER_AGENT']);        $pos_blackberry = strrpos($ua, "blackberry");        $pos_webkit = strrpos($ua, "webkit");             if (!($pos_blackberry === false)) {           if (!($pos_webkit === false)) {                   **//load blackberry.css**                }        } else {          wp_enqueue_style( 'twentytwelve-style', get_stylesheet_uri() );        }      **Question:** what is the "grammatically correct" WordPress syntax for loading blackberry.css stylesheet?


title: How I can change PayPal IPN 'custom' field in woocommerce?

text: I use Woocommerce plugin. All works great, but I need add to PayPal IPN 'custom' field only 1 word instead "order_id" that writes at 'custom' field now. I trying edit this file: ...woocommerce/classes/gateways/paypal/class-wc- gateway-paypal.php here you can see code here screenshot of code that maybe needs to change Need to change script that send "order_id" to PayPal on script that send my word to PayPal. That's all. I believe it's easy to do. Please help. Appreciate any answers. Thanks.!


title: JS plugin script loading but not working

text: I am trying to create a theme using curtains.js but am having a few problems. I have both registered and enqueued the script and the part that would go in the footer like so:               add_action('wp_enqueue_scripts', 'tf_load_custom_scripts');          function tf_load_custom_scripts() {         wp_register_script('curtain', get_template_directory_uri().'/js/curtain.js', array('jquery'), 2.0 );          wp_register_script('curtain-instance', get_template_directory_uri().'/js/curtain-instance.js', array('curtain','jquery'), true );               if( is_front_page() ) {             wp_enqueue_script('curtain');             wp_enqueue_script('curtain-instance');         }              wp_enqueue_script('custom_script', get_template_directory_uri().'/js/script.js', array('jquery'), 1.0, true );          }      I've also changed all the `$` to `jQuery` to comply with no-conflict rules. My scripts all seem to be loading fine but not running. I'm probably missing something very obvious. Thanks in advance for any insight.


title: Order by meta values

text: I have 3 meta fields related to dates:   * `year = 2012`   * `release_date = 14 November 2012`   * `release_date_db = 20121114` I need to show the posts from year 2012 sorted by release_date. I made this:               query_posts('meta_key=year&meta_value=2012&order=ASC&posts_per_page=7');      How can I order posts by `release_date` or `release_date_db`?


title: Why does WordPress reverse conditional statements?

text: In WordPress' core code, you often see this:               if (1 == $someVar)      as opposed to this:               if ($someVar == 1)      I don't know if the first way is a WordPress-centric style of coding, but I've only noticed it in WP code (either core or 3rd-party code).


title: Alter image output in content

text: I'm trying to implement the JAIL javascript into my WordPress install. The javascript requires me to add a data-attribute and change the output html of images. I have been looking through the codex for filters or hooks that can help me, but i can't find anything. Anyone have a solution?


title: inner jQuery won't work

text: i'm enqueuing jQuery with `wp_enqueue_script( 'jquery' );` (i see               <script type='text/javascript' src='http://localhost/wp/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script>     <script type='text/javascript' src='http://localhost/wp/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>      in the resulting html page) now, i'm tryin to use:               $(document).ready(function() {         $('#showmenu').click(function() {                 $('.menu').slideToggle("fast");         });     });      and it only works if i add a jQuery reference manually (`<script src="//code.jquery.com/jquery-1.10.2.js"></script>`) do i miss something?


title: FTP credentials on localhost

text: > **Possible Duplicate:**   >  wordpress on localhost lamp doesn't let me install plugins I just started working locally with Wordpress. Trying to update theme/plugins I get asked for my FTP credentials and I get really confused...what the heck is my FTP credentials when working locally?


title: wordpress on localhost lamp doesn't let me install plugins

text: i've installed a LAMP server on my ubunutu 11.04. i've installed wordpress and hooked it right with the MySQL db. i've changed the permissions of the www- data group to read and write files. every thing is seems to work and i can manage the site through the admin panel, but i can't install plugins cause the system is asking me the FTP details, and i can't seem to go through it. can any body help? please...


title: Trying to display stick or featured post on homepage

text:
Im trying to add the last sticky post to a section on my homepage as a Featured article. I have created this so far and it displays posts but not the sticky ones:               <?php query_posts(array('post__in'=>get_option('sticky_posts'),'showposts' => 1 )); ?>     <?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
         <?php the_content(''); ?>     <?php endwhile; ?>     <?php wp_reset_query(); ?>      I have tried to change the query_posts to get_post. The problem then is that it displays the other 3 'latest news' posts from the other loop at the top of the page. Any help would be really really appreciated


title: get_terms - only top level

text: I am trying to get only top level term:               $cat_args = array(         'parent '       => 0,         'number'        => 10,         'hide_empty'    => false,                );          $categories = get_terms( 'question_category' , $cat_args);       But this query return all childterms too, I tried everything but it always get child terms too. I am trying since last 5 hours and can't find whats wrong in my code, is this a WP bug or there is something wrong in my code ? Thanks for helping.


title: How to hold all comments for moderation, including author's comments on own post

text: I want all comments no matter what, to be held for moderation and not appear till approved by an admin. Wordpress allows author comments on own posts to show up without holding for moderation. Any way around that please?


title: Taxonomies not appearing in columns on dashboard

text: I'm having some issues trying to get taxonomies to appear in the post columns on my dashboard, the custom functions appear correctly, just not the taxonomies, anyone see where I'm going wrong? Here is a screenshot showing the issue: http://i.imgur.com/GiMSfhF.png               // Add filters for the Games Database in the control panel     add_filter( 'manage_edit-games_database_columns', 'my_columns' );     function my_columns( $columns ) {     $columns['games_database_platform'] = 'Platform'; // Taxonomy     $columns['games_database_genre'] = 'Genre'; // Taxonomy     $columns['games_database_publisher'] = 'Publisher'; // Custom Function     $columns['games_database_developer'] = 'Developer'; // Custom Function     $columns['games_database_rating'] = 'Review Score'; // Custom Function     unset( $columns['comments'] );     return $columns;     }     add_action( 'manage_posts_custom_column', 'populate_columns' );     function populate_columns( $column ) {     if ( 'games_database_publisher' == $column ) {         $game_publisher = esc_html( get_post_meta( get_the_ID(), 'game_publisher', true )     );         echo $game_publisher;     }     elseif ( 'games_database_developer' == $column ) {         $game_developer = get_post_meta( get_the_ID(), 'game_developer', true );         echo $game_developer;     }     elseif ( 'games_database_rating' == $column ) {         $game_rating = get_post_meta( get_the_ID(), 'game_rating', true );         echo $game_rating . '%';     }     elseif ( 'games_database_platform' == $column ) {         $game_platform = get_post_meta( get_the_ID(), 'games_database_game_platform', true );         echo $game_platform;     }     elseif ( 'games_database_rating' == $column ) {         $game_rating = get_post_meta( get_the_ID(), 'game_rating', true );         echo $game_rating . '%';     }     }


title: Make Textarea a TinyMCE (editor box)

text:
Ive picked up an old plugin and am needing to enhance it for my clients specific needs. In the admin section there is a text area used to add info about a download (essentially a custom post type). However the description field is a simple text area, and so only text is stored. The client need to be able to use this in a similar fashion to the post or blog editor elsewhere in WP. Primarily it needs to add new lines and formatting without the need to manually add html. So, from my limited knowledge of WP I'm assuming that the way forward is to some how tell WP to make this utilise the TinyMCE... Here is the function used to create the in the relevant admin page;                   public function display_sdm_description_meta_box($post) {  // Description metabox         _e('Add a description for this download item.', 'sdm_lang');         echo '

';              $old_description = get_post_meta($post->ID, 'sdm_description', true);         ?>         <textarea id="sdm_description" name="sdm_description" style="width:60%;height:100px;"><?php echo $old_description; ?></textarea>         <?php         wp_nonce_field('sdm_description_box_nonce', 'sdm_description_box_nonce_check');     }      If someone could show me how to adapt this code to get the required result, I'd be really grateful. Thanks in advance!


title: Mandatory excerpt for custom post type

text:
This is proving to be a challenge. I'm trying to make the excerpt a required field, but only when editing/saving a post in a custom post type. The following code makes the excerpt a required field for all posts, but doesn't take into account for narrowing its affect to a single custom post type.               function mandatory_excerpt($data) {       $excerpt = $data['post_excerpt'];            if (empty($excerpt)) {         if ($data['post_status'] === 'publish') {           add_filter('redirect_post_location', 'excerpt_error_message_redirect', '99');         }              $data['post_status'] = 'draft';       }            return $data;     }          add_filter('wp_insert_post_data', 'mandatory_excerpt');          function excerpt_error_message_redirect($location) {       remove_filter('redirect_post_location', __FILTER__, '99');       return add_query_arg('excerpt_required', 1, $location);     }          function excerpt_admin_notice() {       if (!isset($_GET['excerpt_required'])) return;            switch (absint($_GET['excerpt_required'])) {         case 1:           $message = 'Excerpt is required to publish a post.';           break;         default:           $message = 'Unexpected error';       }            echo '

' . $message . '

';     }          add_action('admin_notices', 'excerpt_admin_notice');


title: How to add a class to Buddypress avatars in the Activity stream?

text:
I'm in the process of trying to integrate bootstrap with Buddypress and am trying to add a class of "media-object" to Buddypress avatars. I could do this by mimicking the Bootstrap CSS, but in the interest of learning new things is there a way to add a class, perhaps by using a filter? The bp_loggedin_user_avatar is where the image is created. How can I hook into it and add a class?
             <a class="pull-left" href="<?php echo bp_loggedin_user_domain(); ?>">                 <?php bp_loggedin_user_avatar( 'width=' . bp_core_avatar_thumb_width() . '&height=' . bp_core_avatar_thumb_height() ); ?>


title: Custom Post Type Capabilities

text: I have a custom post type which I want authors to be able to edit others posts but no able to delete others posts. My code as follows:               $labels = array(         'name'          => __( 'Book', 'textdomain' ),         'singular_name' => __( 'Book', 'textdomain' ),         'menu_name'     => __( 'Books', 'textdomain' ),         'add_new'       => __( 'New book', 'textdomain' ),         'add_new_item'  => __( 'New book', 'textdomain' ),         'edit_item'     => __( 'Edit book', 'textdomain' ),     );     $args = array(         'labels'        => $labels,         'public'        => true,         'menu_position' => 6,         'menu_icon'     => 'dashicons-book',         'has_archive'   => true,         'supports'      => array( 'title', 'author' ),         'capabilities'  => array(             'edit_post'             => 'edit_posts',             'read_post'             => 'edit_posts',             'delete_post'           => 'edit_posts',             'edit_posts'            => 'edit_posts',             'edit_others_posts'     => 'edit_posts',             'publish_posts'         => 'edit_posts',             'read_private_posts'    => 'edit_others_posts',             'delete_others_posts'   => 'edit_others_posts',         ),     );     register_post_type( 'book', $args );      What I am experiencing with the above code is:   1. When `'edit_others_posts' => 'edit_posts'`, "mine" tab in admin post editor list doesn't show, and I want it to be always shown. Is it possible to force it back?   2. Even if `'delete_others_posts' => 'edit_others_posts'` (author users don't have the capability to 'edit_others_posts'), authors can delete others posts.   3. If I modify the code above with `'edit_others_posts' => 'edit_others_posts'`, "mine" tab shows up but author users still can edit others posts, which confuse me. I'm really not sure if I am using capabilities the right way or if what I intent to do is possible. Thanks in advance.


title: Global change of permalink structure across multisite

text: Is there a way to update the permalinks across an entire multisite without having to update them one by one?


title: Wp Pagenavi how to display all results

text: I'm using Wp Pagenavi Plugin. I'm trying to display all results from a button. I'm using this:               $out .= '<form action="" id="showall" method="POST" name="results">     <input type="hidden" name="woocommerce-sort-by-columns" id="woocommerce-sort-by-columns" class="sortby" value="100"><input type="submit" name="submit" value="All">     </form>';      It's working if I'm on the first page, but if I'm on another page (second one / third one..), it gives me the 404 Error message. How can I fix this problem? Thanks.


title: how to change permalinks from id to name of a particular location

text: I am working on WordPress permalinks. I wanted to change the permalink URL from `xyz.com/abc/locations/18` (which is location id) to `xyz.com/abc/locations/locationname` With locationid the page is loading perfectly but when I change to locationname the page is giving a 404 error.


title: Wordpress multisite,several different languages,page redirect?

text: I have something like this http://example.com/en , http://example.com/fr and http://example.com/es for example I would like if I'm on this page http://example.com/en/about-us/ when I click on other language link,just to redirect to that language,but to stay on same page,for example if I click on link that will go to french site,and I'm currently on http://example.com/en/about-us/, I would like to go to this link http://example.com/fr/about-us/ if that page doesn't exists I would like to be redirect to homepage,is this possible.Hope you understand me,thank you in advance.


title: How to redirect wp-admin/index.php to a custom post type?

text: I want to redirect my index.php on the admin side to a custom post type. When I go to mysite.com/wp-admin, it must show a custom post type and not the dashboard. How can I do this?


title: Send a Notification to a Wordpress Theme

text: I'm basically looking for something or at least a base line to create a piece of code that allow me to send notifications to my clients via the Wordpress CMS. The Study case is basically like, I'm creating some themes and clients can select between different "modules" to buy, so I'm looking for a way to notify when new modules are available, or when I update some of them. I've been looking for a solution around and I cannot find anything good enough, would be great. Thanks in Advanced.


title: WP url to get rss with full text of post

text: I need to curl a wordpress site and fetch in rss format:   1. all categories   2. for a category, all posts. They need to contain title and full body (not description). given my site is somewpsite.com, how do I write the 2 URLs for above needs? thank you.


title: Display custom content using page.php from theme

text: I am developing a plugin and need to generate a blank page (load the `page.php` from the current theme) and print custom content such as an HTML form or a message. It should have a URL like `http://example.com/?wpex_page=confirm` How can I display a page with the current theme's page.php and custom content in it? **EDIT (18 Jan 2012):** Found a better and simpler working solution: **Generate a custom/fake/virtual Wordpress page on the fly**


title: How to prevent parent being choosen in wp_dropdown_categories

text: I have a grand-parent-category with several parent-category. Each groundchild means a specific method to process later. Parents should not be selected, it merely means to group the children together. I use `wp_dropdown_categories` with `child_of` to show the dropdown form. The parents shows up as a choice which can course confusing for users.               wp_dropdown_categories('child_of'=>$ground_parent_id);      If I add `exclude = $parent_ids`, the whole dropdown list gone.               wp_dropdown_categories('child_of'=>$groun_parent_id,'exclude'=>$parent_ids );      I can throw error message or process to a default value if a user choosed a parent, but this is a way to frustrat my users. Is there any other way to make a dropdown without parent?


title: Twenty Eleven theme-options error

text: I was trying to add Google Analytics and added it to the theme-option page by accident when I went to remove the added info I received the following error. Parse error: syntax error, unexpected '<' in /home/content/07/9999407/html/wp- content/themes/twentyeleven/inc/theme-options.php on line 416 Is there a way to restore the twenty eleven theme-option? Self taught and not doing well apparently


title: How to let user know his session has expired and show him a popup?

text: Can anyone knows how to show a popup once user session has expired? This is what i want to achive When User has been automatically logged out due to inactivity or session expiration I need to show them a pop-up warning: "Due to inactivity, you have been automatically logged out for security reasons. Please log in again." I have researched a lot but not able to figure out how to handle this?


title: Multisite - create new site with precreated pages, menu etc

text: I'm developing a site, where users will be creating their own sub-sites. On new site creation, I would need to prefill it with some Pages, Menu settings etc. Is there an easy way to do this, any hook to use?


title: Infinite Scroll plugin works but no [shortcode]

text: On my blog I use the Infinite-Scroll plugin. Works properly, but in the new post loaded I didn't see shortcodes (ex. [jwplayer ..]), or the galleries created by the editor (appears "This slideshow requires JavaScript.") Where is the problem?


title: Should I use transients for these API call results?

text: I am consuming an API that gives me a list of people and their profiles. My initial idea was working perfectly fine when it's just the list of people because I was just saving the ids and names using transients and then displaying them on a page. However, I now need to display each person's profile on a page so I reconstructed my idea. My flow is now like this: Hit API Store in cache (transient) Insert in post (custom post type) - my reason for inserting to the DB is because I need to have a format like /people/person_id. /people has the list of people /people/person_id has a person's profile. The API consumer just runs once a day. Is this a good process?


title: Determine mime type, wordpress mechanism

text: I need to tell file mime type. I'm really don't want to deal with PECL finfo extension. I don't know what php version client server has. Since I'm using wordpress, and it does have file upload feature, I thought wp should have some mechanism for saving mime types to DB along with attachment. There is mime_type column in db for attachements. Inside include.php I found:               wp_check_filetype_and_ext();      But it returns false all the time.               $appointment_id = $wpdb->insert_id;             $files = $_FILES['files']['tmp_name'];             foreach ($files as $f) {                 $mime = wp_check_filetype_and_ext($f,$f);                 $resp2 = $wpdb->query(                     $wpdb->prepare(                         "INSERT INTO wp_appointments_attch                                      (appointment_id, attachement, attach_type, mime)                               VALUES (%d, %s, %s, %s)",                         array(                             $appointment_id,                             file_get_contents($f),                             $_POST['requireddocs'],                             json_encode($mime)                         )                     )                 );             }             echo $resp2;      This is how my code looks. Is there a better function? I think the fact that wp upload happens by admin from backend, there was no need for more thorough function? I need to see if uploaded binary data is PDF or img.


title: Filter set-screen-option value not saving in 3.9

text: This code works fine in 3.7, but not in 3.9 and I have no idea why not. The value 'stores_per_page' is created in the db, but the value is never saved in 3.9. I tried 'init', 'admin_init' and 'plugins_loaded' with this line of code, but it makes no difference.               add_action( 'plugins_loaded', array( $this, 'screen_options' ) );      Also tried to place the set-screen-option add_filter line at the bottom of the create_admin_menu function, but it makes not difference. It never saves the value.               class Screen_Option_Test {          function __construct() {         add_action( 'admin_menu', array( $this, 'create_admin_menu' ) );          add_action( 'plugins_loaded', array( $this, 'screen_options' ) );     }          function create_admin_menu() {         $hook = add_menu_page( 'Screen Test', 'Screen Test', 'manage_options', 'screen_test_menu', array( $this, 'screen_test' ) );         add_action( "load-$hook", array( $this, 'add_screen_options' ) );     }          function screen_options() {         add_filter( 'set-screen-option', array( $this, 'set_screen_options', 10, 3 ) );     }          function screen_test() {         echo 'screen test';     }          function add_screen_options() {         $option = 'per_page';         $args = array(             'label'   => 'Stores',             'default' => 10,             'option'  => 'stores_per_page'         );              add_screen_option( $option, $args );     }          function set_screen_options( $status, $option, $value ) {              if ( 'stores_per_page' == $option ) return $value;              return $status;     }           }          new Screen_Option_Test();      Does anyone see what I'm doing wrong here, and what I would need to change to make it save the screen option value in 3.9?


title: Sanitize Term Custom Field - apostrophe problem

text: Alright guys, before posting I've searched the similar questions but I couldn't find the answer. **Problem** : I've added custom fields to a custom taxonomy, when I'm saving the options using (update_options) the single quotes get slashes in front. Text area value: `l'a` Once saved, I get: `l\'a` **What do I use?** I use `sanitize_text_field()` before the update_option, when I get the value from the `$_POST` And then I use `esc_attr()` when printing the value in the textarea. I've reviwed the codex: http://codex.wordpress.org/Data_Validation but I don't seem to find the right combination. **Any ideas?**


title: Why isn't admin_notices displaying my text? [Simple Plugin, Beginner]

text: Here is some code that is the result of four days of studying Wordpress and PHP. Unfortunately, it's not working the way it's supposed to. Nothing displays at the admin_notices bar. Originally, I thought it was the **$filename = is_plugin_active($filename) ? "$filename: Active" : "$filename: Disabled";** line, but that was not the problem. What say you?               function show_names()     {                         $paths = array();            foreach (glob("*/plugins/*") as $filename) {                                                                                $filename = is_plugin_active($filename) ? "$filename: Active" : "$filename: Disabled";         $filename = str_replace('wp-content/plugins/', '', $filename);         $paths[] = $filename;            }            $paths = implode("---", $paths);       echo $paths;     }          add_action("admin_notices", "show_names");


title: How to filter posts by categories?

text:
I have a custom post type and now I need to filter the projects according to their categories and without being directed to another page. Also I need to have `all` category which would show all the projects. Link to the test site. I would appreciate any help. portfolio-type.php:                <?php           if ( function_exists( 'add_theme_support' ) ) {          add_theme_support( 'post-thumbnails' );         set_post_thumbnail_size( 270, 170, true ); // Normal post thumbnails         add_image_size( 'screen-shot', 720, 540 ); // Full size screen      }           add_action('init', 'portfolio_register');             function portfolio_register() {      $labels = array(         'name' => _x('Portfolio', 'post type general name'),         'singular_name' => _x('Portfolio Item', 'post type singular name'),         'add_new' => _x('Add New', 'portfolio item'),         'add_new_item' => __('Add New Portfolio Item'),         'edit_item' => __('Edit Portfolio Item'),         'new_item' => __('New Portfolio Item'),         'view_item' => __('View Portfolio Item'),         'search_items' => __('Search Portfolio Items'),         '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' => true,         'capability_type' => 'post',         'hierarchical' => false,         'menu_position' => 5,         'supports' => array('title','editor','thumbnail')     );      register_post_type( 'portfolio' , $args );     }          function create_portfolio_taxonomies() {     $labels = array(         'name'              => _x( 'Categories', 'taxonomy general name' ),         'singular_name'     => _x( 'Category', 'taxonomy singular name' ),         'search_items'      => __( 'Search Categories' ),         'all_items'         => __( 'All Categories' ),         'parent_item'       => __( 'Parent Category' ),         'parent_item_colon' => __( 'Parent Category:' ),         'edit_item'         => __( 'Edit Category' ),         'update_item'       => __( 'Update Category' ),         'add_new_item'      => __( 'Add New Category' ),         'new_item_name'     => __( 'New Category Name' ),         'menu_name'         => __( 'Categories' ),     );          $args = array(         'hierarchical'      => true, // Set this to 'false' for non-hierarchical taxonomy (like tags)         'labels'            => $labels,         'show_ui'           => true,         'show_admin_column' => true,         'query_var'         => true,         'rewrite'           => array( 'slug' => 'categories' ),     );          register_taxonomy( 'portfolio_categories', array( 'portfolio' ), $args );     }      add_action( 'init', 'create_portfolio_taxonomies', 0 );          ?>      index.php:

Portfoolio

Tööd:
                                                                      <?php                                $taxonomy = 'portfolio_categories';                           $terms = get_terms($taxonomy); // Get all terms of a taxonomy                                if ( $terms && !is_wp_error( $terms ) ) :                           ?>

A
                                   <?php foreach ( $terms as $term ) { ?>
<a href="<?php echo get_term_link($term->slug, $taxonomy); ?>" ><?php echo $term->name; ?>
                                   <?php } ?>
                           <?php endif;?>
                                     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                                      <?php                                     $title= str_ireplace('"', '', trim(get_the_title()));                                     $desc= str_ireplace('"', '', trim(get_the_content()));                                 ?>
                                      <a class="project-wrp fancybox" title="<?=$title?>" rel="lightbox[work]" href="<?php print portfolio_thumbnail_url($post->ID) ?>">

f
<?php the_post_thumbnail(array('230','170'),array('alt' => '')); ?>

<?php echo $title; ?>

<?php echo $desc; ?>

                             <?php endwhile; endif; ?>


title: Multiples Realtions with meta keys

text: I need multiple relations with meta keys. Bu the follow loop doesn't work.               $args = array(                   'post_type' => 'any',                   'posts_per_page' => 5,                   'meta_query' => array(                            'relation' => 'OR',                        array('key' => 'iframe'),                        array('key' => 'video'),                                'relation' => 'AND',                        array('key' => 'videoflv')                   )                 );


title: Query Posts with Custom Taxonomy from a Custom Post Type

text:
I've been bashing my head against my desk over this for the past day or so...I have created a custom post type called 'advertisement' and a custom taxonomy within that post type called 'group'. I've created a bunch of different posts and assigned them to the various groups that I have created, but the problem is when I try to query the posts for my custom taxonomy, it comes up empty. When I try to query a regular post with the default category it works fine, so I'm beginning to think it has something to do with the way I have setup my taxonomies. I've already tried resetting permalinks, but to no luck. Here is what I have so far: If anyone could shed some light on where I might have gone wrong, that would be wonderful. Thanks!               /*-----------------------------------------------------------------------------------*/     /*  Initialize the post type     /*-----------------------------------------------------------------------------------*/          /**      * Custom Post Type: Advertisements      *      * @package WordPress      * @subpackage ExportWise      */               /* Register custom taxonomies on the 'init' hook. */     add_action( 'init', 'register_taxonomy_groups' );          function register_taxonomy_groups() {              $labels = array(              'name'                          => __( 'Groups',                            'bd' ),             'singular_name'                 => __( 'Group',                             'bd' ),             'search_items'                  => __( 'Search Groups',                     'bd' ),             'popular_items'                 => __( 'Popular Groups',                    'bd' ),             'all_items'                     => __( 'All Groups',                        'bd' ),             'parent_item'                   => __( 'Parent Group',                      'bd' ),             'parent_item_colon'             => __( 'Parent Group:',                     'bd' ),             'edit_item'                     => __( 'Edit Group',                        'bd' ),             'update_item'                   => __( 'Update Group',                      'bd' ),             'add_new_item'                  => __( 'Add New Group',                     'bd' ),             'new_item_name'                 => __( 'New Group',                         'bd' ),             'separate_items_with_commas'    => __( 'Separate groups with commas',       'bd' ),             'add_or_remove_items'           => __( 'Add or remove groups',              'bd' ),             'choose_from_most_used'         => __( 'Choose from the most used groups',  'bd' ),             'menu_name'                     => __( 'Groups',                            'bd' ),         );              $args = array(              'labels'                        => $labels,             'public'                        => true,             'show_in_nav_menus'             => false,             'show_ui'                       => true,             'show_tagcloud'                 => false,             'show_admin_column'             => true,             'hierarchical'                  => true,                  'rewrite'                       => true,             'query_var'                     => true         );              register_taxonomy( 'group', array('advertisement'), $args );     }               /* Register custom post types on the 'init' hook. */     add_action( 'init', 'my_register_post_types', 20 );          /**      * Registers post types.      *      * @since  0.1.0      * @access public      * @return void      */     function my_register_post_types() {              /* Set up the arguments for the post type. */         $args = array(                  'public'              => true,             'publicly_queryable'  => true,             'exclude_from_search' => true,             'show_in_nav_menus'   => false,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_admin_bar'   => true,             'menu_position'       => 20,             'menu_icon'           => 'dashicons-chart-line',             'can_export'          => true,             'delete_with_user'    => false,             'hierarchical'        => true,             'has_archive'         => false,             'query_var'           => true,             'rewrite' => array(                 'with_front' => false,                 'pages'      => true,                 'feeds'      => true,             ),                  'supports' => array( 'title' ),             'taxonomies' => array( 'group' ),                  'labels' => array(                 'name'               => __( 'Advertisements',                   'bd' ),                 'singular_name'      => __( 'Advertisement',                    'bd' ),                 'menu_name'          => __( 'Advertisements',                   'bd' ),                 'name_admin_bar'     => __( 'Advertisements',                   'bd' ),                 'add_new'            => __( 'Add New',                          'bd' ),                 'add_new_item'       => __( 'Add New Advertisement',            'bd' ),                 'edit_item'          => __( 'Edit Advertisement',               'bd' ),                 'new_item'           => __( 'New Advertisement',                'bd' ),                 'view_item'          => __( 'View Advertisement',               'bd' ),                 'search_items'       => __( 'Search Advertisements',            'bd' ),                 'not_found'          => __( 'No advertisements found',          'bd' ),                 'not_found_in_trash' => __( 'No advertisements found in trash', 'bd' ),                 'all_items'          => __( 'All Advertisements',               'bd' ),                      'parent_item'        => __( 'Parent Advertisement',             'bd' ),                 'parent_item_colon'  => __( 'Parent Advertisement:',            'bd' ),             )         );              /* Register the post type. */         register_post_type(             'advertisement',             $args         );     }               /*-----------------------------------------------------------------------------------*/     /*  Add custom taxonomies to the post type     /*-----------------------------------------------------------------------------------*/          function create_my_taxonomies() {         register_taxonomy(             'group',             'advertisement',             array(                 'labels' => array(                 'name' => 'Groups',                 'add_new_item' => 'Add New Group',                 'new_item_name' => "New Group"             ),             'show_ui' => true,             'show_tagcloud' => false,             'hierarchical' => true,             'public' => true             )         );     }     add_action( 'init', 'create_my_taxonomies', 0 );          /*-----------------------------------------------------------------------------------*/     /*  Query the CPT for Posts from a specific custom taxonomy     /*-----------------------------------------------------------------------------------*/              // If on an Article, display random advertisements         if ( is_single() ) {             $posts_per_page = 1;             $orderby = 'rand';              // Otherwise display the latest advertisement         } else {             $posts_per_page = 1;             $orderby = 'date';           }              $args = array(             'post_type' => 'advertisement',             'tax_query' => array(                 array(                     'taxonomy' => 'group',                      'terms' => array( 'homepage' ),                     'field' => 'slug',                 ),             ),             'posts_per_page'    => $posts_per_page,             'orderby'           => $orderby,          );              $query_advertisements = new WP_Query( $args );              //echo $query_advertisements->request; ?>              <?php if ( $query_advertisements->have_posts() ) : ?>

                         <?php                              while ( $query_advertisements->have_posts() ) : $query_advertisements->the_post();                                 $adv_image = getUploadedImageSrc();                                 $adv_url = get_post_meta( get_the_ID(), 'adv_url', true );                                  echo '';                             endwhile;                              wp_reset_postdata();                         ?>

         <?php else : ?>
Error retrieving advertisements! Please try again later.

         <?php endif; ?>


title: Disable edit media attachments?

text: Looking for a way to disable the "Edit Image" option. I would still like to be able to edit the description, alt, etc. But remove the Edit image button or disable that image editor. Thanks,


title: How to create tabled index of posts in a certain category

text: I have a tech blog, what I want to do is to create an index page for articles in a certain category. For example, I want all the articles under the category "WordPress BasiX" to be arranged in an index (tabled preferably) at one page. Is there a way to do it in wordpress? Help please. My wordpress version is 3.4.2


title: Shortcodes, output buffering, and WordPress functions

text:
I have a couple of long forms which I want to output as shortcodes. Shortcode API indicates that > If the shortcode produces a lot of HTML then ob_start can be used to capture > output and convert it to a string This seems to be **exactly** my case. Also, I want to use WordPress functions inside my HTML, like this:               function my_shortcode_register_form( $atts, $content = null ) {              ob_start();         ?>

<?php echo __('Login info', 'my-plugin-domain'); ?>

<a href="<?php echo site_url( 'dashboard' ); ?>"><?php echo __('Go to Dashboard', 'my-plugin-domain'); ?>!
         <?php         $output_string = ob_get_contents();         ob_end_clean();              return $output_string;     }          add_shortcode('register_form', array( $this, 'my_shortcode_register_form' ));      It works fine, but I'm interested in best-practices, potential bugs, as well as performance. Any downsides to this approach? Anything that could go awfully wrong? I saw at least one question on here warning not only use output buffering unless absolutely necessary. Should I just bring these forms out into templates instead?


title: Create a short code that inserts js

text: **Note:** People are assuming this question is already answered when in fact it is no where close to being the right answer. I have created tons of short codes, How ever I am using Jquery plugin TOC and I would like to create a short code for it, I am not sure where to begin. I would assume you would follow standard procedure for creating one, but I have never had one spit out javascript before. The only code I have to show you is, my short code:               if(! function_exists ('aisis_toc') ){         function aisis_toc($atts, $content = null){             return '             <script type="text/javascript" charset="utf-8">                 $(function(){ $("#toc").tableOfContents(); })             </script>';         }     }      I have registered the hort code as toc, and tried doing `[toc]` but alas nothing happens. What am I doing wrong? I don't need or shouldn't need ajax of any kind. this should be easy. I should also state that this short code should only get the h1-6 tags that are in the post them selves and not on the page in general.


title: External Page Displaying Properties of [If (Home Page)]

text: I have a slider set to display only on the homepage with `<?php if( is_front_page() ) : ?>` This works properly for all pages, except my landing pages that have get_header. Does anyone know how to designate the page I have created is not the front page? It seems wordpress isn't recognizing the page as a non front page. Thanks!


title: Need to make a php file inside theme accessible via url

text: I checked this post here Making a plugin file accessible via url rewrite? which seems to have the same problem as me but its for a plugin. But so far i am getting 404.               add_action( 'init', 'my_rewrite' );     function my_rewrite() {         global $wp_rewrite;              add_rewrite_rule('/$', '/wp-content/themes/econ/adserver/adserver.js.php', 'top');         $wp_rewrite->flush_rules(true);       }      I have this file path `/wp-content/themes/econ/adserver/adserver.js.php` and need to show it as `http://mysite.com/adserver.js.php` **UPDATE:** The code that **Bainternet** gave is working good except the rewrite rule part. I can now access the file using `index.php?myjs=true`. Here is the code in my htaccess file you might wanna take a look.               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress


title: Custom Post Type Works but Still Shows "Page Not Found"

text: I have a weird problem when creating custom post types. Everything works, the archive page shows the posts and the posts show their content, but for both the title of the site says, "Page not found." You can see an example at `http://coachingforliteracy.org/events/`. I've flushed the permalinks, which is why the pages load their content, but there is still some disconnect. Any thoughts?


title: Woocommerce Export Orders with Order Item Meta

text: I have this plugin http://docs.woothemes.com/document/ordercustomer-csv- exporter/ but it doesn't seem to export product variations / attributes per order. What I want to do is to make a separate column for each product attributes with their corresponding values in each order's row. Does anybody have tried it before? Thanks in advance! Regards, Vance


title: bulk update meta value with ajax

text: I want to update posts meta value in the wp_query to a different value on click. What I am basically doing is making a notification bubble (like stackoverflow).   1. `wp_query` with the number of posts that have meta value 'unread' - WORKING   2. Show the count bubble on top op logged in user's display name - WORKING   3. On clicking the notification, hide the bubble and change post meta value with ajax only for the posts in the `wp_query` from 'unread' to 'read' so that the count is only visible next when there's a new post with meta value 'unread' - HOW?   4. Show a dropdown of all latest posts with meta value 'read' - maybe another query? Here's my code for count bubble.               add_shortcode('notify', 'notify_member');         function notify_member() {             global $current_user;             get_currentuserinfo();             $userid = $current_user->ID;                 $args = array(                     'posts_per_page' => '-1',                     'post_type' => 'answer',                     'post_status' => 'publish',                     'author__not_in' => $userid, //exclude user posts                     'meta_query' => array(                             'relation' => 'AND',                         array(                             'key' => 'question_owner_id'                             'value' => $userid, //only show posts for the user                             'compare' => '='                         ),                             array(                                 'key' => '_read_answer'                                 'value' => 'unread', //only show unread posts                                 'compare' => '='                             ),                         )                     );                     $questions = new WP_Query( $args );                     $html = '';                     $html .= ''.$questions->found_posts.''; //total count                     return $html;         }      I have looked at ajax like and vote tutorials, they tackle one post at a time. I will need the below to work for all returned posts from the query and change at the same time.                           if( $questions->have_posts() ) {                 while ( $questions->have_posts() ) { $questions->the_post();                      update_post_meta( $post->ID, '_read_answer', 'read' );                      }                 }      I am out of ideas, any direction is welcome. Thanks. P.S. I am not a coder, so please do explain a little.


title: Roles other than Super admin accessing manage_network_themes

text: We currently use the Wordpress Multisite and Networks to control a few blogs of ours. We are looking to give other users on the network permission to manage the themes on the network. We've installed a few plugins to manage roles, create roles and modify the roles permissions.. but we haven't managed to find a solution. Basically we are trying to allow roles other than Superadmin access to manage_network_themes. The role we are trying to allow access to this has the permission checked, but they still can't access the network themes. Is this area locked down to Super admins only? Is there a way around this? We want to allow our other blogs access to manage themes, but we don't want to give them super admin access. I look forward to your reply.


title: Changing Table Prefixes - once done, am I good to go going forward?

text: In the book _Beginning WordPress 3_ the author advises that changing the default WP table prefixes can provide some slight security advantage (protects from SQL injection scripts). I found several articles that explain how to do this as well. I've also seen people arguing that it's not all that helpful. I thought I would try it on the theory that if it was reasonably doable and even slightly helpful, why not do it? So, for a new project I did a Fantastico Installation, which meant that I had to go into the actual Tables via PHPmyAdmin, which I did. I changed the 11 standard table names, plus a couple of things in wp_options and in wp_usermeta, and finally the table prefix in the wp-config.php. When done I was able to login to the admin and all seems well. My question is: can I now go forward and not worry about needing to change anything when I activate new plugins? Is this something that, once done properly, is done? That seems to be the implication but no one explicitly states this, either in the book, or in the articles I've read. Here's links to 2 articles, for FYI: http://digwp.com/2010/10/change-database- prefix/ http://tdot-blog.com/wordpress/6-simple-steps-to-change-your-table-prefix-in- wordpress Thanks!


title: The website has resulted in too many redirects (redirect plugin)?

text: I changed the redirect URL of one page from http://goldstarteachers.com/teachers/jobs to http://goldstarteachers.com/teachers/teaching-jobs-china/. I set up a redirect so that the old URL lead to the new one. I'm using the Redirection plugin by John Godley I then realised it affected a lot of other pages so I changed the URL back to the original one (http://goldstarteachers.com/teachers/jobs) and deleted the redirects I had set up. The problem is, if I now visit http://goldstarteachers.com/teachers/jobs it comes up with an error message. The page still exists and can be seen in the WordPress admin section as a page called "Teaching Jobs in China". I have deleted my computers cookies and tried loading this page on another computer but it does not load. Now each time I visite that page I get this error: > This webpage has a redirect loop The webpage at > http://goldstarteachers.com/teachers/jobs/ has resulted in too many > redirects. Clearing your cookies for this site or allowing third-party > cookies may fix the problem. If not, it is possibly a server configuration > issue and not a problem with your computer. What could be the cause of the problem? Any suggestions to fix this? **EDIT:** **Monkeyman Rewrite Analyzer** ![enter image description here](http://i.stack.imgur.com/paxeF.png) **Redirection** ![enter image description here](http://i.stack.imgur.com/Qwv7P.png)


title: save_post action hook for comments

text: Is there a action similar to save_post for comments? Already tried comment_post which does not fire when clicking the update button on a comment in WordPress.


title: Sort a custom post type loop by a custom taxomomy instead of chronologically

text: I simply want to list out the books (a custom post type) organized by their respective genre (the taxonomy made with the code below). I have all the code being used listed below. I am using the following code in a page template to call the custom post type 'book':               <?php         if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }          elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }          else { $paged = 1; }         $myposts = array(         'post_type' => 'book',         'posts_per_page' => '40',         'orderby' => 'id',         'order' => 'ASC',         'paged'=> $paged        );       query_posts($myposts);     ?>      This is the custom post type origin in the functions.php file:               add_action( 'init', 'register_cpt_book' );          function register_cpt_book() {              $labels = array(              'name' => _x( 'Books', 'book' ),             'singular_name' => _x( 'Book', 'book' ),             'add_new' => _x( 'Add New', 'book' ),             'add_new_item' => _x( 'Add New Book', 'book' ),             'edit_item' => _x( 'Edit Book', 'book' ),             'new_item' => _x( 'New Book', 'book' ),             'view_item' => _x( 'View Book', 'book' ),             'search_items' => _x( 'Search Books', 'book' ),             'not_found' => _x( 'No books found', 'book' ),             'not_found_in_trash' => _x( 'No books found in Trash', 'book' ),             'parent_item_colon' => _x( 'Parent Book:', 'book' ),             'menu_name' => _x( 'Books', 'book' ),         );              $args = array(              'labels' => $labels,             'hierarchical' => true,             'description' => 'A collection of books',             'supports' => array( 'title', 'editor', 'excerpt', 'author',  'custom-fields' ),             'taxonomies' => array( 'author', 'genre' ),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'has_archive' => true,             'query_var' => true,             'can_export' => true,             'rewrite' => true,             'capability_type' => 'post'         );              register_post_type( 'book', $args );          }      Here is the custom taxonomy 'genres' in functions.php:               // Add new taxonomy, make it hierarchical (like categories)         $labels = array(             'name'              => _x( 'Genres', 'genre' ),             'singular_name'     => _x( 'Genre', 'genre' ),             'search_items'      => __( 'Search Genres' ),             'all_items'         => __( 'All Genres' ),             'parent_item'       => __( 'Parent Genre' ),             'parent_item_colon' => __( 'Parent Genre:' ),             'edit_item'         => __( 'Edit Genre' ),             'update_item'       => __( 'Update Genre' ),             'add_new_item'      => __( 'Add New Genre' ),             'new_item_name'     => __( 'New Genre Name' ),             'menu_name'         => __( 'Genre' ),         );              $args = array(             'hierarchical'      => true,             'labels'            => $labels,             'show_ui'           => true,             'show_admin_column' => true,             'query_var'         => true,             'rewrite'           => array( 'slug' => 'genre' ),         );              register_taxonomy( 'genre', array( 'book' ), $args );      The code works great. Like I said, I just want to list out the books organized by their respective genre (the taxonomy made above). So, the book loop would then look something like this: **Philosophy** Philosophy Book 1, Philosophy Book 2, Philosophy Book 3 **Psychology** Psychology Book 1, Psychology Book 2, Psychology Book 3 **History** History Book 1, History Book 2, History Book 3 I have tried several methods I found when googling this, but haven't been able to find anything that works. I would be greatly indebted if anyone could give me a workable answer. Thanks.


title: Static Text in Permalink

text: Can i have a static text in Permalink like this => /%post_id%/sometext/%postname%/ I tested this and works fine, but i am concerned whether it will bring some issues in future. So looking for some thoughts from people who have more experience in WordPress.


title: Change language of pages/categories based on ID

text: My Wordpress is in Arabic, I'd like to make an English category which would use the English language from `wp-content` folder; it and its child posts. Is there any conditions to do that? something similar to this:               if ( is_category(12) || in_category(12) ) { $set_language = 'en'; }


title: how to remove category from database

text: is there a way to remove the category from the database? I just moving my old wordpress blog (that has the category in url), to new domain (without category). I change everything except the category. Even i don't know where it is stored in database :( ## Update **Problem is resolved, I added the answer below so that it will help to others.**


title: Accessing Global Vars & Functions in custom php page

text: I have created a php page called "test.php" and uploaded this file to the root folder of my wordpress installation. This file contains only this:               <?php if ( is_user_logged_in() ) { blah..... }  ?>      I need to check if user is logged in and if so, get some details. So what I need to know is what wp file(s) I need to include in my php file to be able to get the results of this function and also I prob need to check on an id, username.


title: Image editor not working correctly

text: Here is my process..   * When editing a new post I click on the 'Set featured image' link   * I then select an image from the Media Library   * I click 'Edit Image'   * I make my changes in the edit image section (crop image and resize it)   * I click 'Save' to update the image Now when I go back to the media library I can't see this edited version, only the original version before editing. I get the same result even if I give the edited version a new name. I am doing this on a fresh WordPress 3.8 install using the 2014 theme. Can anyone help or am I going about things the wrong way?


title: Correct way to customise a child theme

text: I know that the best way to customise a theme is to make a child theme. In this instance I am helping someone make changes to an existing 3rd party child theme, can I make a child theme of a child theme?


title: Using wp_editor in shortcode

text: I am building a plugin for frontend submission. I am using shortcodes API to display the form for content submission, but I am having troubles. The problem is, wp_editor echoe's data, and shortcode should return data. When I integrate wp_editor like this:               $final_form .= wp_editor();      form does render, but not in the place but on top of the post content, where shotcode is included. Do you have any idea how would one use wp_editor in shortcode API? I don't wan't to bother with manually calling TinyMCE etc. Thank you.


title: If no author posts, echo out some text

text:
I have this piece of code to show the author posts of the author of the current post, but I want to make an if statement, if no posts then echo out some text. I have now this but it do not work (above is the function for author posts and at the bottom is my if statement):                           <?php                       function get_related_author_posts() {                     global $authordata, $post;                          $authors_posts = get_posts( array( 'author' => $authordata->ID, 'post_type' => 'kenniscentrum', 'post__not_in' => array( $post->ID ), 'posts_per_page' => 5 ) );                          $output = '
';                     foreach ( $authors_posts as $authors_post ) {                         $output .= '
ID ) . '">' . apply_filters( 'the_title', $authors_post->post_title, $authors_post->ID ) . '' . apply_filters( 'the_excerpt', $authors_post->post_excerpt, $authors_post->ID ) . '
';                     }                     $output .= '
';                          return $output;                      }                      /*add this hook where you need the related posts*/                 if(get_related_author_posts()) :                     echo get_related_author_posts();                 else :                         echo 'No articles...';                 endif;                   ?>      Can someone help me out with this?


title: What is the difference between get_page_link and get_permalink functions?

text: Both functions return permalink to the post or page by it's ID. What are the differences and which of these functions should I use in which cases?


title: How to Show Different Information to your authors/contributers

text: One of the nice tricks that WordPress admins who have a number of authors/contributors could do to help them in writing content is to share with them relevant information based on where they are in the writing process. ![enter image description here](http://i.stack.imgur.com/QAuWY.png) Using the code below, you can display helpful information above the back-end editors. This can be: guidelines, pre-publish checklist, certain codes or formatting tips, a video, or even a simple visual process just telling them at what stage of the publishing process they are at and how to proceed to the next one. Of course, this depends largely on your writing or editorial process, but basically, if you use WordPress built-in or custom post statuses with your writers, this trick can be very useful.


title: Remove pretty photo style and script if not exist!

text: I need to dequeue or remove style and script related to "pretty_photo" from my theme but load it again only when it **called or needed** i have this code in my `functions.php`               wp_enqueue_style('pretty_photo', MASTER_THEME_DIR . '/addons/prettyphoto/prettyPhoto.css',array() ,false,'all')


title: is WGET correct for this cron job?

text: I'm using Bluehost which gives the option to set up a cron job with the command, and then they give you settings options for setting the timing the job should run. I think I have these commands set up properly, but I'm not sure. The file they're getting is are .xml files. And I'm using them with WP All Import which gave me everything to use in the command ( I replaced the actual username with username - but I know that the client's username would go there ).               wget -q -O /dev/null "/home/username/public_html/wp-cron.php?import_key=tG.IEkYZ&import_id=4&action=trigger"          wget -q -O /dev/null "/home/username/public_html/wp-cron.php?import_key=tG.IEkYZ&import_id=4&action=processing"          wget -q -O /dev/null "/home/username/public_html/wp-cron.php?import_key=tG.IEkYZ&import_id=5&action=trigger"          wget -q -O /dev/null "/home/username/public_html/wp-cron.php?import_key=tG.IEkYZ&import_id=5&action=processing"


title: How to create database table, add data, update and delete using wpdb via plugins?

text: I am just starting out to create plugins with database. I know to create a custom database when activating the plugin. I just want to know whether we can create tables at the front end like adding the field name, field type. And also I tried creating a row values, but it seems that the values are not getting inserted in the table. Here's my code for adding values to the tables.                function test_get_log_table_columns(){     return array(         'log_id'=> '%d',         'user_id'=> '%d',         'activity'=>'%s'     );     }      function insert_data_into_table(){       global $wpdb;      $logid=$_POST['logid'];      $userid=$_POST['userid'];     //Set default values      $data = wp_parse_args($data, array(                  'user_id'=> get_current_user_id(),                  'date'=> current_time('timestamp'),     ));          //Check date validity     if( !is_float($data['date']) || $data['date'] <= 0 )         return 0;          //Convert activity date from local timestamp to GMT mysql format     $data['activity_date'] = date_i18n( 'Y-m-d H:i:s', $data['date'], true );          //Initialise column format array     $column_formats = test_get_log_table_columns();     //Force fields to lower case     $data = array_change_key_case ( $data );          //White list columns     $data = array_intersect_key($data, $column_formats);          //Reorder $column_formats to match the order of columns given in $data     $data_keys = array_keys($data);     $column_formats = array_merge(array_flip($data_keys), $column_formats);      $wpdb->insert($wpdb->wptuts_activity_log, $data, $column_formats);     return $wpdb->insert_id;          }      function retrieve_val_data() {     global $wpdb;           }      And Is it possible to add, delete, and update datas in tables via the front end? I mean adding, editing, deleting data values after activating the plugin and from a seperate menu page.


title: Get data from style.css file and from from users->your profile

text: Hi I am new to template development and today I started my first theme.Things are not going as well as I tought I can't seem to find anything I need in the codex it seems to disorganized to me. I would like to know if there is a function that I can acces the info in the style.css file posted on the top.More specificaly I am interested in geting the author and author URL from these:               Theme Name: Twenty Ten     Theme URI: http://wordpress.org/     Description: The 2010 default theme for WordPress.     Author: wordpressdotorg     Author URI: http://wordpress.org/     Version: 1.0      Another thing I would like to know is how can I get the info for the admin user set in USERS -> YOUR PROFILE


title: GetShopped Ecommerce: hide checkout form from customer until shipping country selected

text: I am using Wordpress Ecommerce by GetShopped, and on the checkout page there is a part where the user selects their country. By default, not all the available delivery options are displayed until the user selects their country or the Calculate button. The problem is, the customers **assume** that there is no delivery available (as its hidden until they select the country or click Calculate). How can I hide the rest of the form from the customer (therefore requiring them to select their country), before displaying the remainder of the form?


title: Category List (Archive) Page Template By Category

text:
I feel like this is probably a duplicate question, but cannot find the search terms to find what I'm looking for. Is it possible to have different category list (archive) pages (or views/templates) based on the post's category? I'm working on a site that's using the blog as a top-level category, but I want my other "pages" to just be other top level post categories, each with a custom look for the category list/archive page. Example: Going to /category/blog outputs the default category.php output, listing out all the recent blog posts (that are categorized with the top-level category of blog, or are children categories of blog) Going to /category/work lists out all recent work entries (that are categorized with the top- level category of "work" and any children categories) Is this possible? Edit: Here's how I have my category.php page setup (basing this "custom" template on the twenty_ten obviously. At this point, would I just modify the `get_template_part('loop', 'category');` part in the work if statement to point to something different than "loop?"               <?php     /**      * The template for displaying Category Archive pages.      *      * @package WordPress      * @subpackage Twenty_Ten      * @since Twenty Ten 1.0      */          if (is_category('blog')) :         $GLOBALS['pagetype'] = 'blog';     endif;          if (is_category('work')) :         $GLOBALS['pagetype'] = 'work';     endif;          get_header(); ?>
                                       <?php if (is_category('blog')) : ?>
                         <?php                             $category_description = category_description();                             if ( ! empty( $category_description ) )                                 echo '
' . $category_description . '
';                              /* Run the loop for the category page to output the posts.                          * If you want to overload this in a child theme then include a file                          * called loop-category.php and that will be used instead.                          */                         get_template_part( 'loop', 'category' );                         ?>

                 <?php endif; ?>                                                                  <?php if (is_category('work')) : ?>
                     <?php                     $category_description = category_description();                     if ( ! empty( $category_description ) )                         echo '
' . $category_description . '
';                          /* Run the loop for the category page to output the posts.                                          * If you want to overload this in a child theme then include a file                                          * called loop-category.php and that will be used instead.                                          */                     get_template_part( 'loop', 'category' );                     ?>

                 <?php endif; ?>
               <?php if (is_category('blog')) :         get_sidebar();     endif;     ?>     <?php get_footer(); ?>


title: How to store multiple values in 1 meta_key with radio input?

text: How do I store multiple values in one `meta_key` through a radio input and then display the two values on the page? One value would be a text string and the other would be a link that would go with that text. These values would not change and would be populated by the data in the radio box. Here is the code for my meta boxes. I want the radio box `event_venue` to have an additional value that would be the link to the venue page. That way I would just have to click the radio button for the venue and the name and link to the page would automatically show up.                $meta_box['event'] = array(         'id' => 'event-meta-details',         'title' => 'Event Information',         'context' => 'normal',         'priority' => 'high',         'fields' => array(             array(                 'name' => 'Start Date',                 'desc' => '(Enter yyyy/mm/dd)',                 'id' => 'start_date',                 'type' => 'text',                 'default' => ''             ),             array(                 'name' => 'End Date',                 'desc' => '(Enter yyyy/mm/dd)',                 'id' => 'end_date',                 'type' => 'text',                 'default' => ''             ),             array(                 'name' => 'Opening',                 'desc' => 'YYYY-MM-DD 00:00 24 hour clock',                 'id' => 'opening_time',                 'type' => 'text',                 'default' => ''             ),                array(                 'name' => 'Closing',                 'desc' => 'YYYY-MM-DD 00:00 24 hour clock',                 'id' => 'closing_time',                 'type' => 'text',                 'default' => ''             ),             array(                 'name' => 'Artist Talk - Lecture',                 'desc' => 'YYYY-MM-DD 00:00 24 hour clock',                 'id' => 'artist_talk_time',                 'type' => 'text',                 'default' => ''             ),             array(             'name' => 'Venue',             'desc' => 'Venue of Event',             'id' => $prefix . 'event_venue',             'type' => 'radio',             'options' => array(                 array('name' => 'William Busta Gallery', 'value' => 'William Busta Gallery'),                 array('name' => 'Spaces', 'value' => 'Spaces'),                 array('name' => 'Enter Text Below', 'value' => 'other')             )         ),             array(                 'name' => 'Custom Venue',                 'desc' => 'Enter Venue Name if Enter Text Below is Checked',                 'id' => 'custom_event_venue',                 'type' => 'text',                 'default' => ''             ),             array(                     'name' => 'Featured / Reccomended',                 'desc' => 'Recommended Event',                 'id' => 'featured_event',                 'type' => 'checkbox',                 'default' => ''               )              )     );      Right now I display the venue value like this.               if (get_post_meta(get_the_ID(),'event_venue', true) != 'other') {          echo get_post_meta(get_the_ID(),'event_venue', true);         }     if (get_post_meta(get_the_ID(),'event_venue', true) == 'other') {         echo get_post_meta(get_the_ID(),'custom_event_venue', true);         }      This is the code that saves the data.               // Save data from meta box     function plib_save_data($post_id) {         global $meta_box,  $post;              //Verify nonce         if (!wp_verify_nonce($_POST['plib_meta_box_nonce'], basename(__FILE__))) {             return $post_id;         }              //Check autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {             return $post_id;         }              //Check permissions         if ('page' == $_POST['post_type']) {             if (!current_user_can('edit_page', $post_id)) {                 return $post_id;             }         } elseif (!current_user_can('edit_post', $post_id)) {             return $post_id;         }              foreach ($meta_box[$post->post_type]['fields'] as $field) {             $old = get_post_meta($post_id, $field['id'], true);             $new = $_POST[$field['id']];                  if ($new && $new != $old) {                 update_post_meta($post_id, $field['id'], $new);             } elseif ('' == $new && $old) {                 delete_post_meta($post_id, $field['id'], $old);             }         }     }          add_action('save_post', 'plib_save_data');      Thank you in advance for any advice. I am very confused.


title: posts_nav_link() not working on index.php

text:
I have a problem with the `posts_nav_link()` function on index.php. It works but it's not displaying the older posts. When someone clicks on the "next page" link the same posts from the fist page are loading. This is the code I'm using:               <?php if ( is_home ()) {$myquery = new wp_query('cat=-41');}?>      <?php         global $wp_query;         $temp_wp_query = $wp_query;         $wp_query = null;         $wp_query = $myquery;     ?>                        <?php if(have_posts()) : while(have_posts()) : the_post(); ?>         <?php the_title();?>             <?php              if( has_post_thumbnail()) {                  the_post_thumbnail('article-thumb'); }              ?>              <?php the_author_posts_link();?>                          <?php the_category(', ');?>                          <?php the_time('j F, Y'); ?>.              <?php the_excerpt();?>              <a href="<?php the_permalink();?>">Citeste mai departe                      <?php endwhile; ?>                         <?php else : ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
                          <?php endif; ?>               <?php posts_nav_link( ' ', '', '' ); ?>                 <?php $wp_query = $temp_wp_query;?>      The `posts_nav_link()` function works properly on the `category.php`, only on `index.php` I have this problem and it's definitely related to my custom loop but I can't figure out what I'm missing.


title: Singular name Plugin localization

text: I'm trying to localize the singular name of a custom post type.               ...     'singular_name' => __('key', 'plugindomain')     ...      I created a .po and compiled it as .mo. I also loaded the translation using `load_plugin_textdomain` using the `init` action.               // $directory plugin directory relative to plugins dir     load_plugin_textdomain('plugindomain', false, $directory);      The string _are_ localized correctly in the backend sidebar. However, the strings are not translated in the frontend with:               // $post_type returned from get_post_type_object     echo $post_type->labels->singular_name;      Am I doing something wrong? **Edit** Apparently the problem is related to Polylang. Strings are loaded before the multilanguage plugin mentioned sets the current language during the execution. Is there a way to trigger the registration of post types after the language changes made by Polylang have had their effect?


title: Let registered users add posts

text: I want registered users to add new posts and comments, but I as admin must moderate all their reactions. Is there a plugin for user registration and post moderation? Thanks


title: Author page link in comments is different than in posts?

text: When I `hover` over the comment author link on my `comments`, it shows a link like http://mysitenameeeee.com/?author=24 After I click it, it gets me to `/author/authorname`, which is fine, but I don't want the link to be author=24 when I hover it. If I hover the `post author link`, it shows me the correct link to `author.php`. What is the difference, why and how can I solve it? Here is the snippet:               <a rel="author" href ="<?php bloginfo('url'); ?>/?author=<?php echo $comment->user_id ?>"><?php echo $comment->comment_author?>


title: Display post title on individual image attachment page

text: How to display parent post title on individual image attachment page heading of the post gallery? Currently, it shows image name as page heading on image attachment page. Any help appreciated. Thanks


title: How to redirect to correct pages after permalink structure change

text: I am changing my permalink structure from `/%year%/%monthnum%/%postname%/` to `/%category%/%postname%/`.   Is it possible to redirect old links using old permalink structure to the new link? Possibly via the postname?


title: auto login after registeration for wp-members plugin

text: I've tried to do automatic login to wordpress after registering with password when using WP-Members plugin. I don't have a blog so I decided to write it here, so it may be helpful for someone. I'm not really good in programming wordpress plugins. And it took me some time to find it. Of course that works if you add custom field (option_name = password) in the plugin's settings. In file _wp-members.register.php_ in function *wpmem_registration( $toggle )* I've replaced this line:               return "success"; exit();      with that code from function *wpmem_login()* in file _wp-members-core.php_ :                   /** assemble login credentials */         $creds = array();         $creds['user_login']    = $username;         $creds['user_password'] = $password;         $creds['remember']      = true;                   /** wp_signon the user and get the $user object */         $user = wp_signon( $creds, false );              /** if no error, user is a valid signon. continue */         if( ! is_wp_error( $user ) ) {                  /** set the auth cookie */             wp_set_auth_cookie( $user->ID, true );                       /** determine where to put the user after login */             $redirect_to = $_SERVER['PHP_SELF'];             if( isset( $_POST['redirect_to'] ) ) {                 $redirect_to = $_POST['redirect_to'];             }                       /** apply wpmem_login_redirect filter */             $redirect_to = apply_filters( 'wpmem_login_redirect', $redirect_to );                            /** and do the redirect */             wp_redirect( $redirect_to );                  /** wp_redirect requires us to exit() */             exit();              } else {                  return "loginfailed";         }      Is this safe? Could it be done in some better way?


title: How to use different jquery function of idangero swiper dependant on page template?

text: I have struggled with adding the idangero swiper jquery plugin to my site, but have managed to produce the code below. This works very well but only on the one custom page template defined in the `function register_swiper()` part of the code below. However, I need to use the swiper on another set of pages using a different page template, use different options for the slider, as defined in `var mySwiper = $('.swiper-container').swiper({ mode:'horizontal',` such as `slidesPerView: 3`.               function register_swiper() {     wp_register_style( 'swiper-css', get_stylesheet_directory_uri() . '/css/idangerous.swiper.css' );     wp_register_script( 'swiper-js', get_stylesheet_directory_uri() . '/js/idangerous.swiper-2.1.min.js' , array( 'jquery' ) );     if ( is_page_template('Review.php')|| is_page_template('Comparison.php' )){          wp_enqueue_style( 'swiper-css' );          wp_enqueue_script( 'swiper-js' );     }     }     add_action( 'wp_enqueue_scripts', 'register_swiper' );          function print_my_inline_script() {        if ( wp_script_is( 'swiper-js', 'done' ) ) { ?>             <script type="text/javascript">                  $(document).ready(function(){     var mySwiper = $('.swiper-container').swiper({     mode:'horizontal',     });     })                  </script>           <?php }      }          add_action( 'wp_footer', 'print__my_inline_script' );      I am really sorry if I have explained this badly, but I am not great at explaining these things, so if there is any more information you need in able to help please do ask! Thanks a lot in advance! Here is the link to the swiper website: http://www.idangero.us/sliders/swiper/api.php


title: get_page() unlike Loop returns the post content without html tags. How can I fix this?

text: get_page() unlike Loop returns the post content without html tags. I need tags. How can I fix this? I don't want to change wysiwyg editor, here is the bad solution http://wordpress.org/support/topic/preserve-html-with-get_pages


title: Get current page_id before loop, in functions.php

text: In the Shoestrap theme, you often change content by using hooks. I want to add the following to `functions.php` but it doesn't work...               // in functions.php     if ( is_home() ) {       add_action( 'shoestrap_below_top_navbar', 'my_custom_below_top_navbar' );     }     // also tried since we're before the loop     if ( 684 == get_queried_object_id() ) {       add_action( 'shoestrap_below_top_navbar', 'my_custom_below_top_navbar' );     }     // but get_queried_object_id() returns 0      I'm using WP 3.8. I found this bug report but it doesn't seem to be quite the same issue since my page is just the home page, not a query page. ps, if someone would like to create a shoestrap tag, please add it to this q.


title: How to remove "featured image" functionality from a custom post type?

text: I have made a custom post type for a child theme. I removed "thumbnail" from the supports array in functions.php and that prevents a featured image meta box from being displayed. However, when in the "add an image" modal dialogue thing, there is still a "Use as featured image" link. Why, oh why? More to the point, does anyone know how to remove? I tried... remove_post_type_support( 'itinerary', 'post-thumbnail' ); ...where itinerary is the name of my custom post type. Any help would be greatly appreciated! Steve


title: Prepending character(s) to a custom <!--more--> tag title?

text: I'm hacking around with a blog using Cordobo Green Park and I've noticed when I specify a custom title, instead of it beginning with a `»` symbol (as it does for the standard " _» Read more: [POSTTITLE]_ ") the custom message is simply shown without any prepended character. It's a shame, because the » character would be nice to include for visual consistency. In `./themes/cordobo/index.php` (lines 28-30) there's this piece of code which I think handles the tag:               <div class="entry">        <?php the_content((__( '» Read more: ', 'default')) . the_title('', '', false)); ?>     </div>      Which differs from the Codex example with no 'default' second variable:               <?php the_content("Continue reading " . the_title('', '', false)); ?>      _Never mind my puzzlement over the`__(` after the initial double opening brackets (the Codex doesn't really have anything of help to me for explaining this - any takers?)_ ... I just can't figure out how to simply prepend the `»` character to custom `<!--more-->` text. I'm just tying myself in knots here, but I _think_ the actual crux of adding a prepended character(s) to custom titles is modifying the action of the regex- detecting-then-variable-setting function of get_the_content inside `post- template.php` (line 203):               $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));      However, what's the best (non-destructive, and upgrade-proof) way to override the default behaviour of that subroutine and define a customised version of `$more_link_text`? I really don't want to go destructively hacking core files, but I struggle with coding filters so at the moment it's still looking tempting.


title: How to custom category template based on category?

text: My blog have 2 categories: Photos and Texts. I would like do customize the category template so that when it renders Photos post's, I want to show a thumbnail gallery and when it renders Texts post's, I want show only the excerpt. There is an way to do this without hardcoding on category.php? Or, at least, how is the best way to do this? Thank you!


title: Show One Category on Post

text:
How do i go about making the code only show one category?                   <?php       $categories = get_the_category();       foreach($categories as $key => $category) {         $url = get_term_link((int)$category->term_id,'category');         $categories[$key] =           "

{$category->name}

" .           "
{$category->category_description}
";       }       echo "
\n" . implode("\n",$categories) . "\n
";     ?>      The Reason why am asking is that I have two category(s) on some of the posts but i only want to show one of them. Is there way to add it to the code above so it only shows one thanks.


title: Inserting Mysql queries into array using wp_list_table class

text: I try to make a plugin that can show a table (with rows) in wordpress by using the `WP_List_Table` class. In my "students" table Ive got               Fname,Lname,school,Class      I've already found a example where they use arrays and typing manual everything to the table, which then looks like this               var $example_data = array(               array( 'ID' => 1,'booktitle' => 'Quarter Share', 'author' => 'Nathan Lowell',                     'isbn' => '978-0982514542' ),             array( 'ID' => 2, 'booktitle' => '7th Son: Descent','author' => ' Hutchins',                    'isbn' => '0312384378' ),             array( 'ID' => 3, 'booktitle' => 'Shadowmagic', 'author' => 'John Lenahan',                    'isbn' => '978-1905548927' ),             array( 'ID' => 4, 'booktitle' => 'The Crown Conspiracy', 'author' => 'Michael',                    'isbn' => '978-0979621130' ),             array( 'ID' => 5, 'booktitle'     => 'Max', 'author' => 'Mark Jeffrey',                    'isbn' => '978-0061988929' ),             array('ID' => 6, 'booktitle' => 'Jack Wakes Up: A Novel', 'author' => ' Har',                   'isbn' => '978-0307454355' )         );      So I was wondering about is it possible to make an maybe more arrays where I can type `Select * From table name`? Or something like that?


title: How to remove excerpt white spaces

text: This is my code in wordpress archive:               mb_substr(get_the_excerpt(), 0, 236);      This echos:                                 NGÀY 1: HÀ NỘI – ĐÀ NẴNG         Chiều: khởi hành       In view code `NGÀY 1: HÀ NỘI – ĐÀ NẴNG Chiều: khởi hành` How do I remove white spaces