title: Loop Post Types with Name and Links

text:
I'm trying to create a menu which loops through the registered custom post types and links to their archive pages. I've been able to get the list of post type names but it is not generating the links. It only outputs a en empty anchor tag wrapped around the post types name.               $args = array( 'public' => true,'_builtin' => false );     $output = 'names';     $operator = 'and';     $post_types = get_post_types( $args, $output, $operator );     foreach ( $post_types  as $post_type ) {         $link = get_post_type_archive_link($post_type);         echo '
' . $post_type . '
';     }      This is my output.
posttypeA

posttypeB

posttypeC
      I have archive-posttypeX.php files for each post type. ![enter image description here](http://i.stack.imgur.com/BGVPM.png) All of my custom post types are registered similarly to this one:               function post_type_snippets() {         register_post_type('snippets', array(             'label'=>'Snippets',             'menu_icon' => '',             'labels'=>array(                 'name'=>_x('Snippets', 'post type general name'),                 'singular_name'=>_x('Snippet', 'post type singular name'),                 'add_new'=>_x('Add New', 'snippets'),                 'add_new_item'=>__('Add New Snippet'),                 'edit_item'=>__('Edit Snippet'),                 'new_item'=>__('New Snippet'),                 'view_item'=>__('View Snippet'),                 'search_items'=>__('Search Snippets'),                 'not_found'=>__('No snippets found'),                 'not_found_in_trash'=>__('No snippets found in Trash'),                 'parent_item_colon'=>''),                 'public'=>true,                 'publicly_queryable'=>true,                 'show_ui'=>true,                 'query_var'=>true,                 'rewrite'=>false,                 'capability_type'=>'post',                 'supports'=>array('title','thumbnail','comments','revisions','post-formats'),                 'taxonomies'=>array('category', 'post_tag'),                 'slug'=>'snippets',                 'hierarchical'=>false,                 'menu_position'=>4             ));         }         add_action('init', 'post_type_snippets');


title: Multi-site or categories?

text: I've recently been redesigning a site for a college radio, switching from Drupal to Wordpress from scratch. The site is based on the radio station, but each specialty show will also have its own blog. However, I want the layout to be the same from the main content to each blog. Categories more or less work, but things get tricky when I want information pages for the blogs, such as an 'About' and whatnot. Say I have a "Live" show. I'd want everything to be /live/page or /live/2011/06/post-title, but Wordpress only wants to do posts, and I haven't really found any solid permalink plugins. Should I stick to using categories? How can I improve the situation? Or is multisite a better option? Can I easily set things globally for multisites, like the layout and menu? Thanks!


title: Is it possible to add posts and images (auto resize) for custom post types with a script?

text: I have a specific need to import many post with featured images into a custom post type. The issue is, I need this to be a script because it runs off of another system that collects all the data. I currently have the custom post types setup and I have the data to be displayed in the custom post type using custom templates to pull and display the data (lists and profile pages). I would like to be able to add posts manually (I don't see this being difficult) and add a featured thumbnail using WP built in system. I cannot seem to find any data on how to call the image script directly and pass in the images for it to process and return the data I need for the insertion. Is this possible? Or do I need to just do this all by hand and just add custom fields to each post to have the two thumbnails I need for the pages? I would rather have this go into the database without the custom fields if possible. Thanks for any light you can shine on this.


title: custom field with total count of Facebook likes, comments and shares

text: i want to make custom filed that contains facebook like count for the post url to get the likes i used this code               function fb_count(){     $link = get_permalink($post->ID);     $content = file_get_contents("http://api.facebook.com/restserver.php?method=links.getStats&urls=".$link);     $element = new SimpleXmlElement($content);     $shareCount = $element->link_stat->total_count;     return $shareCount;}      which i don't know how to store the Facebook data in custom filed i tried this code but it dos not work               <?php $like_key = 'likes_count';          $link = get_permalink($id);     $content = file_get_contents("http://api.facebook.com/restserver.php?   method=links.getStats&urls=".$link);     $element = new SimpleXmlElement($content);     $shareCount = $element->link_stat->total_count;      $key1_values = get_post_custom_values($like_key, $id);         foreach ( $key1_values as $value )          update_post_meta($id,$like_key,$shareCount, $value); ?>      i wanna know i what i am doing wrong


title: Does WordPress consider a post name unique if that same post name is in multiple Post Types?

text: I have a situation that I thought WordPress handled, but I seem to have a misunderstanding about how it works. Posts of the same name, under different custom post types, are auto incrementing. I thought wordpress would handle /post-type-red/about and /post-type- blue/about as unique, but in with the post that I enter later, WP auto increments that post number. Is my understanding wrong here of how this should work?


title: Allow users to post to a certain category

text: I have a website running Wordpress. I have lots of content, e.g. tutorials, and I made a new category on a separate page, so I don't have a lot of content there. I want users to be able to add content _only_ to my newly created category, even if they are subscribers. I also want to be able to moderate everything they've posted to the category. Is that possible? Please help!!


title: Display post taxonomies tree

text: I was able to get all the items of a custom taxonomy for a post, like this:               $args=array('orderby'=>'parent',"fields" => "all");     $term_list = wp_get_post_terms($post->ID, 'tvr_amenity', $args);      My problem is that i would like to show the tree (respecting the parents) So i would like to get them ordered by name and parent but i cant find anything related on codex.. any idea how?


title: Form Object Gravity Forms

text: Gravity Forms. I try to manipulate the form fields before they are rendered with               add_filter("gform_pre_render", "my_function", 10, 5);          function my_function($form){     ...     $form["fields"][0]["content"] = 'This is a html-block'     }      Like this, I can pass the html-block's content assumed the html is the first field on the form. How can I target a field by `id`? Let's say the above html- block-field has the field id `13`.


title: Wordpress development: Best practices for documentation?

text: I´m really new in wordpress-development. I want to have a good documentation for all hooks and hacks. What is the best way to record all changes in my local wordpress installation? Thank you Cheers Marco


title: Wordpress VIP realpath Alternative?

text: I am running a scan for a site to be proposed to wp vip. The only error I am getting is : > Warning: Returns canonicalized absolute pathname header-payroll.php > require_once realpath(dirname( **FILE** )). '/header.php'; What would be the fix for this. I believe I would need an alternative for "realpath"?


title: Is there a hook to process a backbone restful PUT request inside wordpress?

text: I play around with Backbone.js (Great !) and want to synchronize my model data with the wordpress ajax api (3.6.1) on the server-side. Adapted to this http://addyosmani.github.io/backbone-fundamentals/#restful-persistence, here is my backbone example:               var new_posts;     var post;     (function($){         var Post = Backbone.Model.extend({             id: '',             title: '',         });         var Posts = Backbone.Collection.extend({             model: Post,             url: APP.ajaxurl + '?action=postaction'  //APP.ajaxurl == http://localhost/wordpress/wp-admin/admin-ajax.php         });         new_posts = new Posts();         new_posts.add([{'id':0, 'title':'Hermann Hesse'}, {'id':1, 'title':'Wolfgang v. Goethe'}, {'id':2, 'title':'Friedrich Schiller'}]);         post = new_posts.get(2);         post.set('title','Honore de Balzac');              post.save();          }(jQuery));      I pick the second element (model) from a collection, change the 'title' - attribute and want to save it on the server side. Backbone now creates with a 'PUT' a RESTFUL Request and append the index of the model inside the collection ('2') to the url:               http://localhost/wordpress/wp-admin/admin-ajax.php?action=postaction/2      ... **but i have NO IDEA** how to handle the changed GET-Parameter 'action' (now: postaction/2), it seems that the standard wordpress approach with an action hook 'wp_ajax_' isn't the right one to handle this               add_action( 'wp_ajax_postaction', '<a function for handling>' );      Of course i cannot code an action hook for every possible parameter, which can be changed! Is there another wordpress approach to handle such PUT/Restful Request via Ajax ? For any idea to this i thank in advance ! Thank you.


title: TheCartPress plugin - Make every item in store unique

text: I have been trying to figure out how to take the WordPress plugin TheCartPress have each item in the shop unique, so that quantity does not matter at all and is essentially disabled. My research has led me to find only another request for this feature and no solutions...onto my (partial) solution: I can hide the quantity adjustments and only allow users to add a single item to their cart at a time but they can come back to the page and add another copy of the same item. The only way I can think of to work around this is to use their cart to detect whether the add to cart button should be disabled on page load...that seems like it would work but maybe isn't the best way...any (better) ideas before I try to hack up this plugin? :D example page: http://babushoe.cordslatton.com/product/paleo-clogs/ contents of getShoppingCart()                tcp_session_start();         if ( TheCartPress::$tcp_shoppingCart !== false ) {             if ( isset( $_SESSION['tcp_session_refresh'] ) ) {                 TheCartPress::$tcp_shoppingCart->refresh();                 unset( $_SESSION['tcp_session_refresh'] );             }             return TheCartPress::$tcp_shoppingCart;         }         if ( isset( $_SESSION['tcp_session'] ) ) {             if ( is_string( $_SESSION['tcp_session'] ) ) TheCartPress::$tcp_shoppingCart = unserialize( $_SESSION['tcp_session'] );             else TheCartPress::$tcp_shoppingCart = $_SESSION['tcp_session'];         }         if ( TheCartPress::$tcp_shoppingCart === false ) {             TheCartPress::$tcp_shoppingCart = new ShoppingCart();             $_SESSION['tcp_session'] = serialize( TheCartPress::$tcp_shoppingCart );         }         if ( isset( $_SESSION['tcp_session_refresh'] ) ) {             TheCartPress::$tcp_shoppingCart->refresh();             unset( $_SESSION['tcp_session_refresh'] );         }         return apply_filters( 'tcp_get_shooping_cart', TheCartPress::$tcp_shoppingCart );


title: stop shortcode stripping in category and archive pages

text: Using the Wordpress default theme 2010 1.1, shortcodes work on the main blog page and individual post pages, but are being stripped out on category and archive pages. For example, stick in the theme's functions.php:               add_shortcode('tsc', 'tsc_process_shortcode' );          function tsc_process_shortcode($atts, $content = null) {     return 'INSERTED TEXT ' . $content;     }      INSERTED TEXT isn't generated from [tsc] in post content shown on category and archive pages. How do I get shortcodes to function on category and archive pages?


title: Creating a Custom Post Type and Joining with Users

text: I'm really having a difficult time figuring this out conceptually. I'm trying to create a sort of management system for events/volunteering. Let's say I create a custom post type called events, for each of these post types I'd like a form to be tied to them (may have this form be built with gravity forms and have it manually in the theme template for the custom post page). When the user fills out the form, they become a user and register for the event (post type). How do I set it up to tie each post id to a registration and when you look up the custom post types table you have a column that lists the amount of people signed up for that specific id? Is there also a way to limit the number of registrations to that event (custom post type id)? There are very few references for this.


title: Custom taxonomy - query returns an error

text: Web page in question: http://www.cambridgesca.org.uk/ExternalDirectory/searchdirectory/ Plug-in used: Search & Filter Frequencies is a custom taxonomy. Code, as follows, inserted at the end of functions.php in the theme folder.               add_action( 'init', 'register_taxonomy_frequencies' );          function register_taxonomy_frequencies() {              $labels = array(              'name' => _x( 'Frequencies', 'frequencies' ),             'singular_name' => _x( 'Frequency', 'frequencies' ),             'search_items' => _x( 'Search Frequencies', 'frequencies' ),             'popular_items' => _x( 'Popular Frequencies', 'frequencies' ),             'all_items' => _x( 'All Frequencies', 'frequencies' ),             'parent_item' => _x( 'Parent Frequency', 'frequencies' ),             'parent_item_colon' => _x( 'Parent Frequency:', 'frequencies' ),             'edit_item' => _x( 'Edit Frequency', 'frequencies' ),             'update_item' => _x( 'Update Frequency', 'frequencies' ),             'add_new_item' => _x( 'Add New Frequency', 'frequencies' ),             'new_item_name' => _x( 'New Frequency', 'frequencies' ),             'separate_items_with_commas' => _x( 'Separate frequencies with commas', 'frequencies' ),             'add_or_remove_items' => _x( 'Add or remove Frequencies', 'frequencies' ),             'choose_from_most_used' => _x( 'Choose from most used Frequencies', 'frequencies' ),             'menu_name' => _x( 'Frequencies', 'frequencies' ),         );              $args = array(              'labels' => $labels,             'public' => true,             'show_in_nav_menus' => true,             'show_ui' => true,             'show_tagcloud' => true,             'show_admin_column' => true,             'hierarchical' => true,                  'rewrite' => true,             'query_var' => true         );              register_taxonomy( 'frequencies', array('post'), $args );     }      "Frequencies" is hierarchical, "type of work" is not. All posts have Frequency assigned. If I search for Type of work + Frequency (weekly + hospitality), I get results (in this case, 2 posts). If I search for Type of work ONLY (hospitality), I get results. If I search for Frequency (weekly) I get an error message (probably 404). I also noticed that post pages do not list Frequency in their meta data (post created, tags such and such). I do not know if the failed query has anything to do with the absent meta data. **Could you please advise me what code I need to implement (and which file / location it needs to go into) to get the query working on custom taxonomy?** EDIT: Code for the Search & Filter plugin is available through github, as far as I can tell the most relevant part to troubleshoot this problem is https://github.com/rmorse/search-filter/blob/master/search-filter.php Sadly, I am not a code-monkey; I can understand simple commands but I get lost when dealing with complex data.


title: How to show only one category in breadcrumb navigation

text: I added breadcrumb navigation to WordPress & I'm facing one problem. Here's the function.php code of the breadcrumb:               function ux_breadcrumbs() {         if (!is_home()) {             echo '';             bloginfo('name');             echo " » ";             if (is_category() || is_single()) {                 the_category('/');                 echo " » ";                 if (is_single()) {                     echo "  ";                     the_title();                 }             } elseif (is_page()) {                 echo the_title();             }         }     }      The above code is displaying all categories of the post. I just want it to display only one category. Thanks in advance! **UPDATE:** Thanks for the help...here's one more thing: I want to know how to display category > sub category in the breadcrumb if exists.


title: how do i add posts-page slug before posts slug in permalinks

text: I have a posts page and the page slug is /blog my current permalink structure is /%postname%/ when i click on a blog post. say for example the posts slug is adrenaline-rush the url is www.siteurl/adrenaline-rush what i am trying to achieve is www.siteurl/blog/adrenaline-rush how would i go about doing this? Thanks in advance


title: Ampersands do not display

text:
I've got a WooCommerce install, running on the latest WordPress version. I'm using the discover theme by antthemes.com. There are four boxes at the bottom of the homepage which allows you to change the title, image, text and links of. When I type `&` into one of those four boxes text areas, it is converted to `&` upon saving. I've tried directly inputting `&` but it doesn't display as an ampersand when you view the page. I've also tried copy and pasting an ampersand into the text box instead of typing it but still no luck. I have attached the code from `element- boxes.php`. If you need any other code then let me know.                           <?php for ($i = 1; $i <= 4; $i++) { ?>

          <a href="<?php echo esc_url(of_get_option('box_link' . $i)); ?>"><img src="<?php if(esc_url(of_get_option('box_image' . $i)) != NULL){ echo esc_url(of_get_option('box_image' . $i));} else echo get_template_directory_uri() . '/images/box' .$i. '.png' ?>" alt="<?php echo esc_html(of_get_option('box_head' . $i)); ?>" />

<?php if(esc_html(of_get_option('box_head' . $i)) != NULL){ echo esc_html(of_get_option('box_head' . $i));} else echo "Box heading" ?>

                      <?php if(esc_textarea(of_get_option('box_text' . $i)) != NULL){ echo esc_textarea(of_get_option('box_text' . $i));} else echo "Nullam posuere felis a lacus tempor eget dignissim arcu adipiscing. Donec est est, rutrum vitae bibendum vel, suscipit non metus." ?>

                 <a href="<?php echo esc_url(of_get_option('box_link' . $i)); ?>"><?php _e('Read More' , 'discover'); ?>
              <?php } ?>


title: how to set parent forum link to menu page?

text: I have installed `bbforum` on my wordpress website. I want to set main forum page to be displayed on MENU `FORUM` How can I set that? My parent link is `http://www.demoweb.com/forums/` Also I want to give rights to create a forum topics to all user?


title: flush_rewrite_rules() not working on plugin activation

text: I am experimenting with creating a simple plugin to create a custom post type named project but am having some trouble with the rewrite rules not been flushed on activation. I have the main plugin file with this function:               register_activation_hook( __FILE__, 'Project_Custom_Post_Type::activate' );      Then within my class I have this:               public function activate() {       flush_rewrite_rules();     }      My class has a construct of:               public function __construct() {       add_action( 'init', array( $this, 'register_post_type' ), 0 );     }      I cannot see why it is not working? My deactivation flush works fine.


title: Customize the previous_post_link output

text:
I am trying to customize the output of the previous post link. I want to display 2 titles (with link) for the previous post, one should be a custom text and other should be title of post, for example: > >     Read Previous >     This is Post tile. >   Both of them should link to the previous post I am trying following code, but it displays both titles as 'Read Previous'.               <?php previous_post_link('

%link

%link

              ', __('Read Previous', 'domain')              ); ?>


title: Showing Subcategory's Name and Link Instead of Parent Category's

text: Right now my code is displaying the category name and link. But if an article is in a subcategory, I want to display the subcategory's name and link instead of the parent category's name and link. For some reason though it's still just showing the parent category. Any ideas what I'm doing wrong with the code?                   <?php $category_separator = "";     foreach((get_the_category()) as $childcat) {          $parentcat = $childcat->category_parent;          if( $parentcat != 0 ) echo '' .get_cat_name($parentcat) .'';          else echo '' . $category_separator . 'cat_name .'">' . $childcat->cat_name . '';         $category_separator = " / ";     }     ?>


title: get url image of custom field with custom size - get_post_meta, wp_get_attachment_image_src

text:
I use a custom `WP_Query` to load image and other information from custom post type event to supersized.js script. This query get all custom post type event with custom field `wpcf-img-event` not empty and with a custom field `_event_start_date` greater than today. From each post i get the url of the image specificed in the custom field mentioned above using `get_post_meta();` but this return the url of original image. So to use the image with a custom size i use a custom function `pn_get_attachment_id_from_url();` (declared inside `funtions.php`) that extract the id attachment from a url. Then i use `wp_get_attachment_image_src();` I would like to share my code but i note that `pn_get_attachment_id_from_url();` use another query so i would aks: **1) if this thing is a bad choise and if is there a better method to do it.** **2) i also have to grab the name of location associated to custom post type event.** Location is another custom post type associated to custom post type event (i can select it by dropdown list metabox of custom post type event). with get_post_meta($postID, '_location_id', true); i can get the id. but if i would like to get its custom field value (city, adress, ecc...) from it have i to use another query? **(get custom field from custom posty type associated to another custom post type)** This my `WP_Query`               <?php     // Don't Populate list if no Featured page is set     if ( $featured_page <>"" ) {          $today = date ('Y-m-d');         $arg = array (             'post_type' => 'event',             'meta_key'  => 'wpcf-img-event',                 'posts_per_page' => '2',             'post_status'    => 'publish',             'meta_query' => array(                 'relation' => 'AND',                 array(                     'key' => 'wpcf-img-event',                     'value' => '',                     'compare' => '!='                 ),                 array(                         'key' => '_event_start_date',                         'value' => $today,                         'compare' => '>='                 )             ),         );         $futurevent = new WP_Query($arg);              // Loop through the custom post type 'event'         if ($futurevent->have_posts()) :              while( $futurevent->have_posts() ) : $futurevent->the_post();                 global $post;     ?>                      <?php                 $postID = $post->ID;                      $imageURI = get_post_meta($postID, 'wpcf-img-event', true);                      $attachmentID = pn_get_attachment_id_from_url ($imageURI);                 $imagearray = wp_get_attachment_image_src( $attachmentID, 'fullsize');                 $imageURI = $imagearray[0];                      $thumbarray = wp_get_attachment_image_src( $attachmentID, 'fullscreen-thumbnails');                 $thumb_imageURI = $thumbarray[0];                      $eventTitle = get_the_title($postID);                      $eventCap = get_post_meta($postID, 'wpcf-event-caption', true);                 // $eventCap = utf8_truncate($eventCap);                      $postlink = get_permalink($postID);                           $eventCap = wp_trim_words( $eventCap, $num_words = 2, ' ...Read More' );                 // If linking is On                 //if ($featured_linked == 1 || $featured_linked == true) {                 //  $attatchmentURL = get_attachment_link($image->ID);                 //}                 // Count                 $count++;                 if ($count>1) { echo ","; }                      $slideshow_title = "";                 $slideshow_caption = "";                      //Find and replace all new lines to BR tags                 $find   = array("\r\n", "\n", "\r");                 $replace = '
';                 $eventCap = str_replace($find, $replace , $eventCap);                      if ($eventTitle) $slideshow_title='
'. esc_attr($eventTitle) .'
';                 if ($eventCap) $slideshow_caption='
'. $eventCap .'
';                      echo "{image : '".$imageURI."', title : '". $slideshow_title . $slideshow_caption . "', thumb : '" . $thumb_imageURI . "', url : ''}";             endwhile;         else:      ?>
?><?php _e( 'Sorry, no posts matched your criteria.' ); ?>
     <?php         // If Ends here for the futurevent         endif;         wp_reset_postdata();          // If Ends here for the Featured Page     }     ?>      and this is the custom funtion (original code https://philipnewcomer.net/2012/11/get-the-attachment-id-from-an-image-url-in- wordpress/)               <?php     function pn_get_attachment_id_from_url( $attachment_url = '' ) {              global $wpdb;         $attachment_id = false;              // If there is no url, return.         if ( '' == $attachment_url )             return;              // Get the upload directory paths         $upload_dir_paths = wp_upload_dir();              // Make sure the upload path base directory exists in the attachment URL, to verify that we're working with a media library image         if ( false !== strpos( $attachment_url, $upload_dir_paths['baseurl'] ) ) {                  // If this is the URL of an auto-generated thumbnail, get the URL of the original image             $attachment_url = preg_replace( '/-\d+x\d+(?=\.(jpg|jpeg|png|gif)$)/i', '', $attachment_url );                  // Remove the upload path base directory from the attachment URL             $attachment_url = str_replace( $upload_dir_paths['baseurl'] . '/', '', $attachment_url );                  // Finally, run a custom database query to get the attachment ID from the modified attachment URL             $attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $attachment_url ) );              }              return $attachment_id;     }     ?>


title: Multiple domains with different child themes on one installation?

text: Is it possible to have multiple domains (each with unique child theme) on one installation? I'm aware of Wordpress's new feature called "Network", which allows you to have one installation for multiple sites. Ideally each site will have it's own child theme, or something similar.


title: Making sure wp term relationships records are unique

text: Which' WordPress function is used in programmatically associating the term taxonomy IDs with post IDs? And does that function have internal mechanisms to make sure no duplicate entries are allowed even if the records were to be added programmatically? Here of course I'm not talking about wpdb->insert.


title: How can I execute shortcode outside the loop?

text: I'm using Contact Form 7 and can display the form by putting the following in the content text field `[contact-form-7 id="453" title="Contact form 1"]`. Now I need to display the form outside the loop. How can I execute a short code from within my template code? **Update**   I found some suggestions to execute shortcode outside the loop:               <?php echo do_shortcode('[contact-form-7 id="453" title="Contact form 1"]') ?>      This solution works fine :)


title: Image Gallery Numbers for 3.5

text: In previous installations of WordPress it was possible to number images in `attachment.php` using the code below, which was originally provided here. However, I'm finding that this code no longer works as the image numbers are inaccurate. Is there a new code available?               <?php     global $post;     $ancestors = get_post_ancestors($post->ID);          $photos = get_children(array(       'post_mime_type' => 'image',        'post_parent'    => array_shift($ancestors),     ));          $index = 0;     foreach($photos as $photo){       $index++;       if($photo->ID === $post->ID) break;     }          printf('%d out of %d', $index, count($photos));           ?>


title: Get Featured Image via direct sql query

text: I know you can use the wordpress methods for getting a featured image, however with this particular project I need to get the featured image via mysql query. Can anyone point me in the right direction. Thank you. This is what I have so far but my query is not doing the trick. I have the $post->id stored as a variable called $da_id                           $Featured_image = $wpdb->get_results("                 SELECT *                 FROM net_5_postmeta                   INNER JOIN net_5_posts ON net_5_postmeta.post_id=net_5_posts.ID                  WHERE post_parent = $da_id                 AND meta_key = '_wp_attached_file'                  ORDER BY post_date                  DESC LIMIT 15",'ARRAY_A');


title: Why isn't my multiple loops working?

text: I would like a multiple look to display `the_content` from the current page, & from another page. My multiple loo doesn't seem to be working. Can anyone advise, please?               while( have_posts() ): the_post();     the_content();     endwhile;          $id=40;     $post = get_post($id);     $title = apply_filters('the_title', $post->post_title);     echo $title;     $content = apply_filters('the_content', $post->post_content);     echo $content;     endif;     endwhile;      Please can someone advise? Thank-you!


title: Filtering posts by category name based on page's slug

text:
I've created a page template and the goal is to create a loop that gets all posts by category name. The category name is passed from the slug of the page name. I haven't been able to get this to work entirely. **EDIT** Here's my function for this loop (updated from answers):               global $post;     $page_slug = $post->post_name;          $category_query = new WP_Query(array(         'category_name' => $page_slug     ));          if ($category_query->have_posts()) :         while ($category_query->have_posts()) :             $category_query->the_post();             $output = '
'.get_the_title().'
';             $output .= '
'.get_the_content().'
';         endwhile;     else :         $output = '
No posts found under "'.$page_slug.'"
';     endif;          wp_reset_postdata();          echo $output;      I screwed up somewhere, as all I get is a blank white page. Any suggestions on how to fix my loop to accomplish what I'm looking for?


title: How to list only child categories?

text: Is there any way to list the child categories only? I just want to filter the Parent Categories


title: how to set array of args for scheduled event?

text: I have a scheduled event that runs twice daily in my plugin, the action is registered with               add_action('fhprw_action','fhprw_check_fetch');           function fhprw_check_fetch($args){       $type=$args['type'];          //do stuff according to $type     }      if I manually call a `do_action('fhprw_action',array('type'=>'uk'));` when a widget is updated then the function receives $args as an array and I can get $type from $args['type'] no problem but when I schedule an event with               wp_schedule_event(time() , 'twicedaily', 'fhprw_action',array('type'=>$instance['type'])); // ($instance['type'] will be 'uk')      then the function receives $args as a string $args = 'uk' instead of array('type'=>'uk'); why is the function not receiving an array for $args when it is called by the cron? [edit] scheduled events call the callback function with a list of parameters, not an array of parameters so my callback function for the action would receive $arg1,$arg2 etc and wouldn't be able to accept an associative array


title: How to redirect multiple subfolders back to root domain?

text: Due to search engine crawling errors, I need to redirect websites of non existing subfolders to a reachable website. This is what is currently leading to 404-errors:   * www.domain.tld/subfolder1/tag1/   * www.domain.tld/subfolder1/tag2/   * www.domain.tld/subfolder1/tag3/ Therefore I simply want to redirect the above URLs to the root domain. The following code is heading to www.domain.tld/tag3/ (which is not what I need)               RewriteRule ^subfolder1/(.*)$ /$1 [R=301,NC,L]      Can anybody help me out what to modify in the .htaccess-file, that all URLs with subfolder1 are redirected to www.domain.tld?


title: Admin blank but Admin menu showing

text: A client website has recently had the issue of a blank admin but the menu is showing. No admin pages appears at all. Just plain ol white, nothing showing in the source code either. Front end of the site works fine. Client states that no plugins, themes or WP Core has been updated. I installed a copy of the site on MAMP (local machine) and the admin works fine. I then installed the site on a server online but the same issue happens. I have tried the following:   * Deleted all plugins   * Renamed the plugins folder   * Deleted theme, left default theme   * Deleted WP files and used latest WP files None of the above made any difference. Can anyone help out with some ideas what could cause this issue? I know that you have no backend access yourselves but any tips would help. The site is: letitgrowhydro.co.uk.


title: Masonry and infinite scroll child theme

text:
I have a question about masonry and infinite scroll plugin by Jetpack. I've added in my function.php file this code:               function mason_script() {     wp_enqueue_script( 'jquery-masonry' );}      add_action( 'wp_enqueue_scripts', 'mason_script' );      Then in my theme archive's template (before get_footer() ):               jQuery( document ).ready( function( $ ) {     $( '#content' ).masonry( { columnWidth: 220 } );     } );      My post structure is this:

     ...     ...

Load more

      Then I've installed and configured Infinite scroll with these configs: #content,.mosaic_navigation, .more a, .post Everything works fine, but still remain one thing: when I upload more post, they're outside masonry div, seems they are not formatted and absolutely not masonry-style; I've installed the last wp version, the last plugin version and really I don't know what else I can do. I've tried with isotope intead of masonry, but this doesn't work too: http://www.drezzy.it/community/speciale/natale/ What can I do? Thanks! Mario


title: Wordpress blog set up

text: I plan to launch my website with multiple blogs plugged into it, with a main index page for all posts. I currently have the index running from the root and two blogs running within their own folders from the root, each with Wordpress installed and running underneath. I have set the database so that the 2 blogs are storing data in the same database with the table prefixes separating out the data. ie. in howard_database, there are tables with blog1_ and blog2_ as their prefixes. (I realise this might not be the cleanest way to do it but I like each blog having its own separate login, as oppose to each being in the same Wordpress installation and separated out by tag/category.) Is there a way that I can show all blog posts from each blog on the index page as a summary of all my posts if the root doesn't have a wordpress installation? Also, I obviously want a theme running through the entire site, and have created a few php includes in a folder on the root. The problem I have is I cannot seem to link back to them from the wordpress blog installation folders to include them within the individual blog pages. Thanks


title: Unable to use meta_query between currency values when value is over 1 million

text: I am trying to add a `meta_query` that searches for values of the field `price` that are between two different values. As long as the values stay below $1 million it works great. However, as soon as one of the values goes above 7 figures it only searches for values as if the last digit was omitted (so $1,000,000 turns into $100,00). **CODE:**               'meta_query' => array(         'relation' => 'AND',         array(             'key' => 'price',             'value' => array( "$400,000", "$1,200,000" ),             'type' => 'CHAR',             'compare' => 'BETWEEN'         )      Removing/adding commas and/or decimals does not fix the issue. Values are stored in the DB in the same format as the values in the array above. **UPDATE** By changing the above to `'type' = 'NUMERICAL'` I was able to get this to work. The problem I am having now is that I need to use variables to populate the array and when I do this I get all posts that match the rest of the criteria. I'm certain it is something to do with the data-type but I'm not sure what to use seeing that the variables and the values in the db contain '$' and ','. So, here's what I have now: **VARIABLES**               $min = "$300,000";     $max = "$1,200,000";      **QUERY**               'meta_query' => array(         'relation' => 'AND',         array(             'key' => 'price',             'value' => array( $min, $max ),             'type' => 'NUMERICAL',             'compare' => 'BETWEEN'         )


title: Custom post type and URL

text: Is it possible to remove alias from custom post type? Let me tell a bit more. For instance, I've created a post type, name "Book". So URL will be `domain.com/book/post-title` or `domain.com/?post_type=book&p=528.` I want the URL as `domain.com/post-title.` Is it possible?


title: Combining multiple RSS feeds using fetch_feed

text: I'm using fetch_feed to display an rss feed on a theme i'm working on. I think the documentation implies that you can combine multiple feeds, can anyone confirm this, ideally with an example. Thanks in advance! George


title: There are any drawbacks for serving Wordpress completely over HTTPS?

text: I've managed to configure an `nginx` server with HTTP and HTTPS for a single site Wordpress Installation. The main goal was to serve restricted pages over HTTPS but this ended up with a huge `nginx.conf` file prone to failure in the feature. And there's some bugs too. So to completelly solve any private information leaking over plain HTTP requests (passwords for example), I would like to simplify things and serve everything over HTTPS. So the main question is: Wordpress is ready or aware of full HTTPS serving? It will work fine?


title: How to determine if a category is empty?

text: Is there an existing function or call in which you can pass a category id to determine if the category has child posts?


title: How to define a callback for an URI?

text: I have a function in functions.php like so:               function myplugin_mycallback($id) {       // do something     }      I want this function called whenever a URL like myplugin/mycallback/xxx is accessed. How/where do I define this path so it doesn't generate a 404?


title: Get the timout value of a saved transient?

text: Does anyone know if there is a Wordpress function to get the timeout value of a saved transient? I am using a transient with a 5 minute timeout to cache data from a web API call locally. Between transient timeouts I load the data locally from the transient acting as a cache and secondary API throttle. What I would like to do is read and display the timeout value of the currently saved transient data so the user knows how long they need to wait before the next data refresh. The value is stored in the 'wp_options' table as '_transient_timeout_transient-name', so I assume I could use the global $wpdb object and just do a SQL query, but I wanted to make sure there wasn't a more elegant way.


title: get_posts() forcing ignore sticky posts on main loop

text: I have a custom query using `get_posts()` that besides ignoring sticky on its main query, ignores sticky posts on main loop. Reading around I've found that `get_posts()` have some trouble with sticky but couldn't found a solution to my needs. The sticky post is shown normally but not at the top, which is unexpected. How can I get it working properly? args I'm using:               'numberposts'       => 5,      'category_name'     => '',     'post_status'       => 'publish',      'post_type'         => 'post',     'meta_key'          => '',     'orderby'           => '',     'order'             => ''


title: Plugin Hook: Get posts

text: I am building a WP plugin. It shows several featured post images with titles atop. It will have a spot on the admin bar to tell it what the featured posts are. What hook do I use to get the post's image and title?


title: Why isn't my link attribute getting my css?

text: <link rel="stylesheet" type="text/css" href="style.css" />      That is the line I am using. The `style.css` file is in the same directory as the file I am running that from. Tt specifically just won’t work on my wordpress page. I am running the page via a HTML file that I am using as the template for that page. It IS getting that file because it does display the HTML elements. Just wont style them with my stylesheet. Why?


title: How to change the post author when the post is published?

text: I wanted to change the author when a post change from draft to publish. I have `$_GET['auth_id']` variable in post edit screen like this `...wp- admin/post.php?post=53&action=edit&auth_id=5`. I tried save_post hook to change the post author like below               function change_pos_auth($post_id){             if ( ! wp_is_post_revision( $post_id ) ){              // unhook this function so it doesn't loop infinitely         remove_action('save_post','change_pos_auth');             if ( isset($_GET['auth_id']) ) {             $args = array('ID'=>$post_id,'post_author'=>$_GET['auth_id']);         // update the post, which calls save_post again         wp_update_post( $args );        }              // re-hook this function         add_action('save_post','change_pos_auth');          }     }      This doesn't work out may be this might not have `$_GET` variables. I tried the get the current user to make them as the author               function change_pos_auth($post_id){             if ( ! wp_is_post_revision( $post_id ) ){              // unhook this function so it doesn't loop infinitely         remove_action('save_post','change_pos_auth');        if ( $last_user = get_post_meta( $post_id, '_edit_last', true) ) {             $args = array('ID'=>$post_id,'post_author'=>$last_user);         // update the post, which calls save_post again         wp_update_post( $args );        }              // re-hook this function         add_action('save_post','change_pos_auth');          }     }      Above also doesn't work. The main idea is that, it is a question & answer type. the author who first answer the question in admin becomes the author of the post. Question will be asked by admin by default.So i'm trying to change the author on save when it gets published. If the post is published already am not allowing other authors to the edit screen. I'll redirect to another page and say someone answered it already. Any Help?


title: Disable feeds for specific custom post types

text: I want to remove the feeds for specific custom post types. Most recommended methods are not clean. There seems to be a option called `$args->feeds` but this does not work within the `register_post_type()` function.                register_post_type(       ...        'rewrite' => array('slug' => 'slug/%term&',                            'with_front' => false,                           'feeds' => false), // Remove feed rewrite-rules?       ...      );      > Source: Line 1324 - /wp-includes/post.php ( _Wordpress 3.5_ ) I'm looking for a solution, to disable the rule generation inside `$wp_rewrite->rules`.


title: Hide page visual editor if template is selected - redux

text: The answer given to a previous and identical question is unfortunately not working on my WP install. I'm using a version of the function recommended there.               function nim_hide_editor() {         $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;         $template = get_post_meta( $post_ID , '_wp_page_template', true );              if($template == 'portfolio.php'){             /*echo "<style>#postdivrich{display:none;}</style>";*/             remove_post_type_support( 'page', 'editor' );         }     }     add_action('admin_init', 'nim_hide_editor');      I've included the commented-out line to show that I tried the technique of echoing the style tag mentioned in the alternate answer, and neither of them worked when selecting by page template. However... Two things seem incongruous:   * I've looked in my SQL database via CPanel and "portfolio.php" is indeed the value stored in post_meta for the pages i'm trying to use this on.   * Selecting the page by $post_ID, and using `remove_post_type_support`, _works_.                  if($post_ID == '13'){         remove_post_type_support( 'page', 'editor' );     }      I'm going a bit crazy - it seems like I've triple-checked everything. Obviously I could hide that editor with an array of post_ID's that use that template, but that won't work for future pages that use that template.


title: How to map my php files as the files for pages

text: How do I map my php files (like a file that is supposed to be the page "blog" and it contains all the html and php) to the actual page the html is supposed to be marking up many thanks note: I would prefer to do this using page name instead of I.D.


title: wordfence scan warning on W3 Total Cache

text: I use Wordfence plugin which scans server side plugins with original plugin files to see if anything was modified by hacker/cracker. Today I got a warning and it shows these modifications on /w3-total-cache/lib/W3/Cache/File.php ![enter image description here](http://i.stack.imgur.com/mIQ5E.png) should I be worried? Last time I read there is a W3 exploit going around.


title: Custom Posttype and menu classes

text: I'm working on a custom theme for a website, and this website has a custom posttype 'Recipes'. I added custom menu support and made a menu item which points to www.websitename.com/recipes And everything works fine. But now I have the following problem with the 'active' classes for the menu. When you're on the custom posttype archive page of single page. The 'default' blog page gets the active class (current_page_parent) Does anyone know how to fix this?


title: How do I generate a alphanumeric hash for a custom post type in wordpress?

text: I have a wordpress website that uses a custom post type, video. I want my permalink for the video posts to generate unique alphanumeric ID like this,               http://example.com/video/ha3unq04X      similar to youtube permalinks. I tried WP Hashed IDs plugin, which works, but only on standard posts, not on custom post types. I am Looking for someone to guide me in the right direction. Please help and help me improve the question if you can.


title: Log in link not showing, Comment Issue

text:
We want user to register and then comment. So we,   * Checked the option of "Anyone can register" as true.   * Checked the option of "Users must be registered and logged in to comment" as true. Now, the problem is nothing shows up in a single post page below "Speak your Mind". Here is the snapshot of problem -> ![enter image description here](http://i.stack.imgur.com/Ld4oG.png) Here is the comment.php of the parent file.                   <?php     /*      WARNING: This file is part of the core Genesis framework. DO NOT edit      this file under any circumstances. Please do all modifications      in the form of a child theme.      */          /**      * Handles the comment structure.      *      * This file is a core Genesis file and should not be edited.      *      * @category Genesis      * @package  Templates      * @author   StudioPress      * @license  http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)      * @link     http://www.studiopress.com/themes/genesis      */          if ( ! empty( $_SERVER['SCRIPT_FILENAME'] ) && 'comments.php' == basename( $_SERVER['SCRIPT_FILENAME'] ) )         die ( 'Please do not load this page directly. Thanks!' );          if ( post_password_required() ) {         printf( '
%s
', __( 'This post is password protected. Enter the password to view comments.', 'genesis' ) );         return;     }          do_action( 'genesis_before_comments' );     do_action( 'genesis_comments' );     do_action( 'genesis_after_comments' );          do_action( 'genesis_before_pings' );     do_action( 'genesis_pings' );     do_action( 'genesis_after_pings' );          do_action( 'genesis_before_comment_form' );     do_action( 'genesis_comment_form' );     do_action( 'genesis_after_comment_form' );


title: Wordpress SEO plugin (by Yoast) and BuddyPress

text: I'm using Yoast's Wordpress SEO plugin to generate breadcrumbs for my site. The problem is that when it comes to BuddyPress pages, the breadcrumbs can't see a member's profile page. Right now it shows `"Home > Members"` on the profile page when it should `"Home > Members > Whatever the member's name is"`. Here's a snpashot of what I mean ![enter image description here](http://i.stack.imgur.com/GPmdA.png) Thanks to @brasofilo I was able to get it. Here's my final code               add_filter( 'wpseo_breadcrumb_links', 'fix_bp_prifile_bc', 10, 2 );     function fix_bp_prifile_bc( $links ) {         global $bp;         $user_info = bp_get_user_meta( $bp->displayed_user->id, 'nickname', true );         //check if we are viewing the profile           if($user_info):             $links[] = array( 'url' =>'', 'text' =>$user_info );         endif;         return $links;     }


title: 4th Network Site Database Errors?

text: 4th site created but not available in the admin menu or the my sites screen. So the my sites screen /wp-admin/my-sites.php only shows three, not the 4th. The My Sites menu at the top also only shows 3, not the 4th. If I click to My Sites>Network Admin>Sites then I see all 4 listed on this page wp-admin/network/sites.php and can acces the fourth site. Why doesn't it show up in all the other menus? Can you help me find the root cause of the problem and fix it? I had previously tried to delete the site, and then re-created the site, but the issue remains. I also turned off all plugins, but the issue remains. I'm afraid that there is a deeper problem which is perhaps database related. Can you help me solve it please?


title: Add code into <head> on a per page/post basis

text: Is there plugin (or an easyish way) to add code to the `<head>` section on a per page/post basis? I have a multilingual website and I need to implement the rel="alternate" hreflang markup, so need a way to define `rel="alternate"` individually on each page/post. I have searched the WordPress plugins but haven't found any thing thus far. I'm not really a coder so can't create something myself, unless it was rather easy! **UPDATE** OK, I'm having a go myself trying to create a custom field for this functionality, this is what I have so far:               <link rel="alternate" href="<?php         while (have_posts()) : the_post();             $alternate = get_post_meta($post->ID, 'alternate', false);             if ($alternate) {                 echo $alternate[0];             }         endwhile;     ?>" hreflang="<?php         while (have_posts()) : the_post();             $hreflang = get_post_meta($post->ID, 'hreflang', false);             if ($hreflang) {                 echo $hreflang[0];             }         endwhile;     ?>" />      Now this works fine if I only want to add one alternate page. When I try to add any more, it will only add one instance of `rel="alternate"`, with the last added replacing the original. Also, on any pages that I haven't defined any of these custom fields, I'm getting an empty tag:               <link rel="alternate" href="" hreflang="" />      Can someone please point me in the right direction to correct these issues?


title: remove post edit.php search form and replace with my own

text: I am desperately looking for some way to hook into the post search option on edit.php. I would like to remove this feature and replace it with my own live search options. Does anyone have any help they can provide here?


title: limit to months rather than by number of posts

text: Is there a way to override how wordpress displays a number of posts on a post listing page? I need to limit the number of posts on a page by month instead of limiting it to a number of posts per page, so each previous and next goes back and forth to the previous or next month where there are posts I did try this method, which seemed to be nearly there. Making next_posts_link(); return posts by month But page 2 and onwards returned no results. It also didn't take in to account where you are in the site, such as category/tag etc Thanks


title: Activate Plugin which is in subfolder?

text: I try to activate the plugin inside the plugin folder is possible ? I am adding the absolute path of the plugin as something like I have a folder as main file and subfolder contain another plugin Let consider plugina.php is in main folder and pluginb.php is in sub folder I want to activate the pluginb.php without moving the path any.               <?php     function run_activate_plugin( $plugin ) {         $current = get_option( 'active_plugins' );         $plugin = plugin_basename( trim( $plugin ) );              if ( !in_array( $plugin, $current ) ) {             $current[] = $plugin;             sort( $current );             do_action( 'activate_plugin', trim( $plugin ) );             update_option( 'active_plugins', $current );             do_action( 'activate_' . trim( $plugin ) );             do_action( 'activated_plugin', trim( $plugin) );         }              return null;     }     run_activate_plugin( 'plugin/subfolder/plugin.php');          ?>      When i try the above code `The Plugin has been deactivated due to an error: The plugin does not have a valid header.` This error is appear. I am not sure i am trying the correct way or is there is someother way to activate the plugin from subfolder. **EDIT:** Actually I am trying to add the module in the main plugin for that i try to scan the module folder inside the main plugin file and link that absolute path to the function. But it doesn't work for me return erro as i mentioned above(The Plugin doesn't have valid header information) In the module folder plugin also contain the file header but still it causing the error. :( Not sure Any suggestion would be great Thanks, vicky


title: Is it possible to detect if a POST action is for a "Save Post" before the save_post action?

text: What I need to do is inspect the content of the post and title and based on the inspection, redirect to a different page. To do this, I need to know if a "POST" action is for saving a post. How to detect this?


title: Conditionally process comments while ignoring replies

text: I use a WordPress theme that awards users points (kept track of in user meta- data) for posting comments. However, they are not awarded points for replying to a comment. When I move a comment to the trash, one point is deducted from the comment's author via the following code:               // Remove 1 point if their comment is removed     function deleteAPointFromUser( $comment_id ) {         $comment = get_comment( $comment_id );         $authorid = $comment->user_id;         $currentPointNumber = get_user_meta( $authorid, 'points', true );              // Decrement comment author's "points" by 1         update_user_meta( $authorid, 'points', $currentPointNumber - 1 );      }     add_action( 'trash_comment', 'deleteAPointFromUser' );      The problem is that when I delete replies to a comment, a point is deducted from the reply's author (even though that author never received a point for replying in the first place). I want to remove comment replies without deducting a point from their authoring users.


title: Custom Query for searching through custom fields

text: Just wondered if someone could spare 5 mins to help me understand where I might be going wrong. I have a set of custom fields for jobs - I would like to create two drop down menus as a quick search: Categories for example - IT, Warehousing, Sales... Salary - 20-30k I have cobbled together this query -                $myquery = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value, post_status FROM $wpdb->postmeta, $wpdb->posts WHERE meta_key = %s AND post_status IN ('publish') ", $metakey));      With this query, it does populate a drop down list, however, it's still including 'drafts' - in the drop down. So, how would I exclude 'draft pages' from populating the drop down? Many thanks Andy


title: Different Menus based on Category Page

text: I was trying to set up different menus based on what category "page" you were on using the built in Wordpress menu editor. In my header file I set up:               <?php         if (is_home()) {         $menu = 'home';}              elseif($post->post_name='category-aviation'){         $menu = 'aviation';}                        elseif($post->post_name='category-anti-terrorism'){         $menu = 'anti-terrorism';}             elseif($post->post_name='asbestos'){         $menu = 'asbestos';}             elseif($post->post_name='burn-pits'){         $menu = 'burn-pits';}             elseif($post->post_name='catastropic-injury'){         $menu = 'catastrophic-injury';}             elseif($post->post_name='medical'){         $menu = 'medical';}                  elseif($post->post_name='securities'){         $menu = 'securities';}              //get_category_by_slug('aviation')         ?>      And I was calling the menu like:               <?php wp_nav_menu( array(  'theme_location'  => "$menu" , 'sort_column' => 'menu_order', 'container_class' => 'menu-header' ) ); ?>      I set up the functions.php file with:               function show_posts_nav() {         global $wp_query;         return ($wp_query->max_num_pages > 1);     add_action( 'init', 'register_my_menus' );          }          if ( function_exists( 'register_nav_menus' ) ) {         register_nav_menus(             array(               'home' => 'The Home Menu',               'aviation' => 'Aviation',               'anti-terrorism' => 'Anti-Terrorism',               'asbestos' => 'Asbestos',               'burn-pits' => 'Burn Pits',               'catastrophic-injury' => 'Catastrophic .Injury',               'medical' => 'Medical',               'securities' => 'Securities'                                 )         );     }      None of the menus are showing up however. Am I doing something wrong here? I know the body class is set to "class="archive category category-aviation category-5 logged-in admin-bar" when I am on the aviation page.


title: Looking for a photo gallery plugin

text: I'm hoping someone can help me with this. I have looked all over and can't seem to find what I need. I am looking for a WP plugin that will allow my site users to easily create their own photo galleries, without having to put the photos into a specific blog post first. In other words, they should be able to just create and publish their own photo galleries as desired. I'd like something very user-friendly, that I can customize with specific instructions, etc. I've looked at NextGen and have tested that with some users, but they didn't find it to be very intuitive. (Maybe that's on them, but nevertheless...) Thanks to anyone who can help!


title: wpdb query problem to access previous 3 days posts

text: I am trying to get all published posts titles by author id 2 most recent by post date for the last days. Here is my query:               "SELECT post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_author = 2 ORDER BY post_date DESC LIMIT 3 "      This displays most recent 3 posts instead posts of last 3 days. How to get that query right?


title: Using strtotime() and update_post_meta not saving

text: I would like to take a date entered in a meta box field, & convert it into a Unix timestamp (dd/mm/yyyy) and save it in the `wp_postmeta` table. But my code isn't working:               function save_custom_meta($post_id) {              //check permissions         if (!current_user_can('edit_page', $post_id))                 return $post_id;                   // Convert _date to actual date stamp          if($field['type'] == 'eventdate') {          get_post_meta($post->ID, 'custom_eventdate', true)             strtotime('_date');             }               if(get_post_meta($post->ID, $key, FALSE)) { // If the custom field already has a value             update_post_meta($post->ID, $key, $value);         } else { // If the custom field doesn't have a value             add_post_meta($post->ID, $key, $value);         }         if(!$value) delete_post_meta($post->ID, $key); // Delete if blank     }          add_action('save_post', 'save_custom_meta', 1, 2); // save the custom fields      What have I got wrong, please? Thank-you for taking an interest! **UPDATED** How can I save the date in dd/mm/yyyy format, so that I can then sort them by date order asc/desc? UNIX timestamp is not appropriate, apparently.


title: Display category page number links for older posts

text: I was given a task to move the content and certain familiar navigation elements from an old WP-based website to the new one, based on the latest version of WP. The blog page of the old site has the number links to the old posts near the bottom of the page: How can I create the same links in TwentyTwelve category page? Thank you in advance for your help!


title: How to use all tags in post permalinks

text: My site with pictures is set up so that the posts do not have a title and have only tags. I would like to know how to use all tags in permalinks settings?


title: 'Create New Child Post' from Parent Post using a button - not using Attribute drop-down

text: I have a custom post type "my_custom_post_type" which contains posts using a grandparent > parent > child hierarchy. I am currently using the 'Attribute' drop down to assign a new post to a parent post but due to the amount of posts I have this is getting very confusing. I was wondering if it was possible to add a button to a parent post which says 'create new child' from the current parent post. **Example Post Hierarchy**   * Grandparent Country   *     * Parent City   *     *       * Child Suburb When on the Country post page I would like a button that says create new city. When on the City post page I would like a button that says create new suburb. Thank you for your help :)


title: Creating Features List in Wordpress Post

text: I want to create features list in wordpress post. I know how to do in CSS but I was wondering if it can be done by using a short code or a plugin?. Like               [features_list]     Item 1     Item 2     [/features_list]      Example: ![enter image description here](http://i.stack.imgur.com/c6Xvl.png)


title: Pagination for Custom Post Type with Multiple Types

text: The first page shows the first results however, mypages/page2 leads to a 404 error. The following code is inside archives-mypages.php               <?php     $temp = $wp_query;     $wp_query=null;          $args = array(         'post_type' => array ( 'reports', 'results', 'reports-drop','reports-snap'),         'post_status' => 'publish',         'paged' => $paged,     );     $wp_query = new WP_Query( $args );     if ( $wp_query -> have_posts() )     {         while ($wp_query->have_posts()) : $wp_query->the_post();          ?>         <a target="blank" href="<?php the_permalink(); ?>">The Link         <?php         endwhile;     }     else     {         echo 'no files found';     }?>          Page: <?php echo paginate_links(array(               'base' => 'http://mywebsite.com/mypages/%_%',               'format' => 'page/%#%',               'current' => (get_query_var('paged') ? get_query_var('paged') : 1),               'prev_next' => false,               'total' => $wp_query->max_num_pages,               'mid_size' => 2,               'type' => 'plain'         ));?>          <?php         //clear again         $wp_query = null;         //reset         $wp_query = $temp;     ?>


title: How to embed the content of one post into another site

text: I have two websites, and I want to embed the content of one post on one of these sites, into a post in the other site. I have looked at various plugins but can't find anything that works. I can embed the entire page with this code:               <object data=http://www.pg-mysite.com/squares width="650" height="500"> <embed src=http://www.pg-mysite.com/squares width="650" height="500"> </embed></object>      But I only want the content to appear, not the headers, footers, sidebars etc.   Is there a way to get just the post content?


title: Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy

text:
I have registered a custom post type "Animals" and also two custom taxonomies ("Vertebrate" and "Type") assigned to it, which have their own specific terms, for "Vertebrate" it will be "Mammals" and "Reptiles", and for "Type" it will be "water type" and "ground type". By using page.php I would like to display a list of all custom posts (Animals) that are sorted by terms that are assigned to the “Vertebrate” custom taxonomy, in this I succeed by using the below code:               <?php             $post_type = 'animals';             $tax = 'vertebrate';             $tax_terms = get_terms($tax);                  if ($tax_terms) {               foreach ($tax_terms  as $tax_term) {                 $args=array(                   'post_type'       => $post_type,                   "$tax"            => $tax_term->slug,                   'post_status'     => 'publish',                   'posts_per_page'  => -1,                   'caller_get_posts'=> 1,                   'orderby'         => 'title',                   'order'           => 'ASC'                                     );                      $my_query = null;                 $my_query = new WP_Query($args);                      if( $my_query->have_posts() ) {                        echo '
'. $tax_term->name .'
';                        while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
          <?php                        endwhile;                 }                 wp_reset_query();               }             }     ?>      This gives me something like this: ### Mammals:   * Cow   * Dog   * Dolphin   * Orca   * Whale ### Reptiles:   * Lizard   * Sea Turtle However I would also like to display in the foregoing list to which terms of the "Type" taxonomy each post is assigned to (besides terms from the Vertebrate taxonomy) by simply returning their name after the post link. I'm trying to achieve something like this: ### Mammals:   * Cow (ground type)   * Dog (ground type)   * Dolphin (water type)   * Orca (water type)   * Whale (water type) ### Reptiles:   * Lizard (ground type)   * Sea Turtle (water type) I’m completely stuck with this, also my knowledge about WordPress and PHP is virtually null, so I would gladly accept any help in this matter. # UPDATE * * * My friend helped me out with this. It should work with this:                           <?php                  $post_type = 'animals';             $tax = 'vertebrate';             $tax_terms = get_terms($tax);             if ($tax_terms) {               foreach ($tax_terms  as $tax_term) {                 $args=array(                   'post_type' => $post_type,                   "$tax" => $tax_term->slug,                   'post_status' => 'publish',                   'posts_per_page' => -1,                   'caller_get_posts'=> 1,                   'orderby'        => 'title',                   'order'          => 'ASC'                                  );                      $my_query = null;                 $my_query = new WP_Query($args);                 if( $my_query->have_posts() ) {                        echo '
'. $tax_term->name .'
';                   while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>                     <?php                      setup_postdata( $post );                     $terms = wp_get_post_terms( $post->ID, 'type');                     echo ''. ($terms[0]->name) .'
'; ?>                          <?php                   endwhile;                 }                 wp_reset_query();               }             }             ?>


title: How to link the title adding a permalink?

text:
How do I change this code to link each title to the post? Specifically - this line:               $dl .= '
' . $query->post->post_title . '
';      Thanks,               <?php     $args = array(         'post_type' => 'my_glossary_term',         'orderby' => 'title',         'order' => 'ASC',         'posts_per_page' => -1     );          $query = new WP_Query( $args );          $dl = '';     $glossary_letter = '';     $active_letters = array( );          while ( $query->have_posts() ) {         $query->next_post();         $term_letter = strtoupper( substr( $query->post->post_title, 0, 1 ) );         if ( $glossary_letter != $term_letter ) {             $dl .= (count( $active_letters ) ? '
' : '') . '
' . $term_letter . '
';             $glossary_letter = $term_letter;             $active_letters[] = $term_letter;         }         $dl .= '
' . $query->post->post_title . '
';         $dl .= '
' . $query->post->post_content . '
';     }     $dl .= '

';          $ul = '
';     foreach ( array( 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ) as $letter ) {         $ul .= '
' . (in_array( $letter, $active_letters ) ? '' . $letter . '' : $letter) . '
';     }     $ul .= '
';          echo '
' . $ul . '
' . $dl . '

';     ?>


title: my single.php is mixup on some post for no reason

text:
some of my post is shown well(like http://exam.downloadkaran.com/?p=453) but another post is not shown well(like http://exam.downloadkaran.com/?p=258)!!! i don't know exactly what should i have to search for. would u please to help me to find a clue. where to start to find my bug. i compare two file but find no mistake all div and other tag are closed well. in some post the problem is solved when i remove                <?php the_tags(__(' ','dnld'), __(', ','dnld'), __('','dnld')); ?>      but in another one no. it is so complex situation!!! my single.php is here:                               <?php include (TEMPLATEPATH . "/sevenmid.php"); ?>

                         <a  href="<?php the_permalink();?>"><?php the_title();?>

<?php if(function_exists('the_views')) {   the_views(); } ?>

<?php the_category(','); ?>نرم افزار

 <?php if(has_post_thumbnail()){ the_post_thumbnail();} else {?>                     <img  src="<?php bloginfo('template_directory'); ?>/images/Koala.jpg"  alt="<?php the_title();?>" />                   <?php }?>

                     <?php if(get_post_custom_values('sizelabel')) : ?>                         <?php echo get_post_meta($post->ID, 'sizelabel',true); ?> |                         <?php endif; ?>                        <?php if(get_post_custom_values('size')) : ?>                          <?php echo get_post_meta($post->ID, 'size',true); ?>                         <?php endif; ?>

                     <?php the_content(); ?>

<img src="<?php bloginfo('template_directory'); ?>/images/sharep.png" alt="share here." />

<img src="<?php bloginfo('template_directory'); ?>/images/cloob.png" alt="cloob" />

<img src="<?php bloginfo('template_directory'); ?>/images/twitter.png" alt="cloob" />

<img src="<?php bloginfo('template_directory'); ?>/images/facebook.png" alt="cloob" />

<img src="<?php bloginfo('template_directory'); ?>/images/google.png" alt="cloob" />

<img src="<?php bloginfo('template_directory'); ?>/images/technorati.png" alt="cloob" />

<img src="<?php bloginfo('template_directory'); ?>/images/delicious.png" alt="cloob" />

<img src="<?php bloginfo('template_directory'); ?>/images/friendfeed.png" alt="cloob" />

 لینک های دانلود

 راهنمای دانلود

 راهنمای نصب

 مشخصات

 سیستم مورد نیاز

                           <?php if(get_post_custom_values('direct')) : ?>                                           <?php echo get_post_meta($post->ID, 'size',true); ?> |                                       <?php echo get_post_meta($post->ID, 'direct',true); ?>                                <?php endif; ?>                                <?php if(get_post_custom_values('link')) : ?>                                    <?php echo get_post_meta($post->ID, 'linksize',true); ?> |                                       <?php echo get_post_meta($post->ID, 'link',true); ?>                                <?php endif; ?>                                     yes this is

                                    and don't be affriad of them.!!!

                                 <?php if(get_post_custom_values('downguid')) : ?>
 <?php echo get_post_meta($post->ID, 'downguid',true); ?>
                                      <?php endif; ?>yes

                                 <?php if(get_post_custom_values('installguid')) : ?>                                      <?php echo get_post_meta($post->ID, 'installguid',true); ?>                                 <?php endif; ?>

                                 <?php if(get_post_custom_values('properties')) : ?>                                      <?php echo get_post_meta($post->ID, 'properties',true); ?>                                 <?php endif; ?>

                                 <?php if(get_post_custom_values('requiresys')) : ?>                                      <?php echo get_post_meta($post->ID, 'requiresys',true); ?>                                 <?php endif; ?>

رمز کلیه فایل ها wwww.downloadkaran.comمی باشد.

گزارش خرابی لینک

                             برچسب ها:                                                           <?php the_tags(__(' ','dnld'), __(', ','dnld'), __('','dnld')); ?>

<?php the_time(__('j / F / Y','kubrick')) ?>

<?php comments_popup_link(__('بدون نظر'), __('1 نظر'), __('% نظر')); ?>

                               <?php     //for use in the loop, list 5 post titles related to first tag on current post     $tags = wp_get_post_tags($post->ID);     if ($tags) {          $first_tag = $tags[0]->term_id;     $args=array(     'tag__in' => array($first_tag),     'post__not_in' => array($post->ID),     'posts_per_page'=>5,     'caller_get_posts'=>1     );          $my_query = new WP_Query($args);     if( $my_query->have_posts() ) {?>

                         پست های مشابه

<?php     while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to  <?php the_title_attribute(); ?>">
<?php the_title(); ?>

     <?php     endwhile;     }?>

         <?php   wp_reset_query();       }            ?>

                      <?php  $tmp_query = new WP_Query('cat='.get_cat_ID('فروشگاه'));                          while ( $tmp_query->have_posts() ) : $tmp_query->the_post();?>
                                  <?php the_post_thumbnail();?>

                                     <a href="<?php the_permalink();?>"><?php the_title(); ?>

خرید پستی

                          <?php endwhile; wp_reset_query(); ?>

                     <img src="<?php bloginfo('template_directory'); ?>/images/group-poste-sabet.jpg" alt="عضویت در آرمان" />
                         مزیت های عضویت در آرمان دانلود :

 » دریافت آخرین مطالب جذاب منتشر شده در سایت

 » مشاهده آخرین مطالب خواندنی و جذاب منتشر شده در انجمن

» دریافت آخرین عکس های اضافه شده به گالری عکس پس زمینه

 » ارسال مطالب تاثیر گذار و متفاوت از سراسر دنیای وب فارسی و انگلیسی

» هر هفته منتظر طالع خودتان باشید و آن را در ایمیل تان مشاهده کنید

 » اطلاع از جذاب ترین مطالب شبکه های اجتماعی و سایت های خبری

» دریافت آخرین مطالب و عکس های مد و فشن ایرانی و خارجی

» جدیدترین فیلم ها و عکس های منتشر شده در دنیای اینترنت

 » آخرین خبرهای هنری و اقتصادی و تکنولوژی….

» و در انتها پیشنهاد های ویژه ما که فقط مخصوص اعضا می باشد

                     <?php?>
                      <?php include (TEMPLATEPATH . "/comments.php"); ?>
                       <?php include (TEMPLATEPATH . "/sidebar-left.php"); ?>

                 <?php                  wp_footer();                 include(TEMPLATEPATH . "/footer.php");                  ?>


title: Disqus moderation page not working in WordPress admin section

text: If I login to my Admin section and click Comments on the left, the Disqus moderation page does not load. On further inspection this is because it's trying to load the page over http:// and my blog is loaded via https:// so it is being stopped. Everything else loads via https:// but I don't know how/where to change this page to do so. Link to my site if you need it.


title: Disqus resetting comment count to 0

text: For some reason my Disqus comment system seems to resetting the comment counts to 0 on the main page. If you load my site the current blog at the top has 1 comment, you can see it says 1 very briefly then changes to 0. Refresh the page and keep an eye out for it if you miss it. I have no idea why it's doing this. If you click the blog to read it, the comment count correctly displays 1. Also, the 3rd blog down regarding VPNs, reads 0 comments on the main page and 0 comments when you click on it, even though it has a comment. Can anyone suggest a solution? _Edit_ Plugin link.


title: OOP - from plugin add new object and call static method in another file

text: I am trying to create an object from the plugins main file by first requiring a class file in a sub-directory, then creating a new->object, and then calling a method from within the required class file. However, when I activate the plugin the register_activation_hook() throws an error. What am I doing wrong? This is not the actual code I am using rather it's an oversimplification.               ../plugins/my-plugin/my-plugin.php     require_once( 'classes/test.php' );     $test = new test();     register_activation_hook( __FILE__, array( 'test', 'example' ) );          ../plugins/my-plugin/classes/test.php     class test {         static function example() {             echo 'Hello';         }     }


title: Disable/Remove default blog on Multisite Setup

text: I am using a multisite WordPress install to manage several blogs for our different shops, the current set up looks something like this:               http://mydomain.com/blogs/shop1/     http://mydomain.com/blogs/shop2/     http://mydomain.com/blogs/shop3/     ...     http://mydomain.com/blogs/      When setting up WordPress I set the base url to `/blogs/`. The problem is a default site was also created at `/blogs/` which we don't need and would like to remove. Is there anything I can do to remove/disable this site. I just want to make sure the public can't access it. Throwing a 404 or a redirect to another page would be ideal.


title: How return normal search result using wp_ajax action for wordpress

text: I want the normal search result to be available when using the wp_ajax action. Is there a way to do execute the normal WP_Query for the parameters that are available in the current request? This is my current code:               add_action('wp_ajax_nopriv_update_search', 'ajax_update_search');     add_action('wp_ajax_update_search', 'ajax_update_search');     function ajax_update_search() {         global $wp_query;         get_template_part('loop');         exit;     }      My current code doesn't return anything, because $wp_query seems not to be setup. Is it possible to get the default $wp_query for the parameters of the current request? (Note: I don't want to setup the parameters to WP_Query myself. I want the normal main query to fire.) **Update** This seems to be working. But I'm not sure that I'm doing it the right way. Can someone confirm please. I want as little overhead as possible.               add_action('wp_ajax_nopriv_update_search', 'ajax_update_search');     add_action('wp_ajax_update_search', 'ajax_update_search');     function ajax_update_search() {         global $wp_query, $wp;         $wp->init();         $wp->parse_request();         $wp->query_posts();         $wp->register_globals();         get_template_part('loop');         exit;     }      **Update 2** For some reason I get unpublished posts in the result. So my solution above is not complete. But it seems to be close. What could cause unpublished posts to be returned?


title: Possible to register multiple custom taxonomies in one function?

text: I'm registering 7 custom taxonomies in my functions.php. Since each function uses the same labels and arguments and is attached to the same Custom Post Type, I'm wondering if it's possible to register all the taxonomies in 1 function? Here is the code that is repeated 7 times with the `<XXX>` as the only changing parts:               function custom_taxonomy_<XXX> ()  {     $labels = array(         'name'                       => '<XXX>',         'singular_name'              => '<XXX>',         'menu_name'                  => '<XXX>s',         'all_items'                  => 'All <XXX>s',         'parent_item'                => 'Parent <XXX>',         'parent_item_colon'          => 'Parent <XXX>:',         'new_item_name'              => 'New <XXX> Name',         'add_new_item'               => 'Add New <XXX>',         'edit_item'                  => 'Edit <XXX>',         'update_item'                => 'Update <XXX>',         'separate_items_with_commas' => 'Separate <XXX> with commas',         'search_items'               => 'Search <XXX>s',         'add_or_remove_items'        => 'Add or Remove <XXX>s',         'choose_from_most_used'      => 'Choose from the most used <XXX>s',     );     $args = array(         'labels'                     => $labels,         'hierarchical'               => true,         'public'                     => true,         'show_ui'                    => true,         'show_admin_column'          => true,         'show_in_nav_menus'          => true,         'show_tagcloud'              => true,         'query_var'                  => true,                            );     register_taxonomy( '<XXX>', 'custom_post_type', $args );     }     add_action( 'init', 'custom_taxonomy_<XXX>', 0 );


title: loop and in admin header problem

text: I have a WP_Query loop running in a function that's attached to the 'admin_enqueue_scripts' hook               add_action( 'admin_enqueue_scripts', 'rs_get_scripts');      function rs_get_scripts() {         //enqueue js file         ...              $args = array( 'post_type' => 'events', 'posts_per_page' => -1);         $query = new WP_Query($args);                               if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();                  /* bug occurs no matter what code is in here */             //get data about each post             ...              endwhile;endif;wp_reset_query();              //localize the data I got from each events post type into js file          ...          }      What is happening is that running this loop at the time of 'admin_enqueue_scripts' hook seems to screw up the admin. The bug is that when I try to create a new post, page or any other Custom Post Type, Wordpress always redicrects me to to create a post of the post type I am querying in the loop above. In this case it's "events". I tried changing the loop to query_posts and get_posts but with no luck. Any ideas?


title: How to Prevent Browsing to Extra Directories?

text: By "Extra Directories", I mean directories that exist for no apparent reason. For example, here is an article on css-tricks.com:   * http://css-tricks.com/favicon-quiz/ If I append (an extra directory) "/1/" to the url, the article still shows. What I would expect to see instead is a 404.   * http://css-tricks.com/favicon-quiz/1/ The reason that I'm asking is that the sitemap creator I'm using is taking forever to generate a sitemap because it keeps finding and spidering the extra directories. My goal is for the 404 page to appear when the user tries to visit an extra directory.


title: Customized custom content type archive

text: I'm on the archive for a custom content type which currently has four instances of said type. On the main page of the archive I'd like to show some intro text, a search form, etc, and then include a few recent entries at the bottom. I'd then like to page into the rest of the archive using the PageNavi plugin. At a basic level, it's no issue to use the default number of entries (as chosen in the backend settings) and page based on that. However, I'd like to show on the archive main page the three most recent posts, then page through the remainder alphabetically. With just four entries - currently - there should be the three most recent ones on the first page, and the final one on the second page. My archive template outline follows:               <?php     if (!is_paged()):         // intro text         // search form         // taxonomies         // 3 recent entries     else:         // current group of entries     endif;          // paging - only appears if needed     ?>      As per http://billerickson.net/customize-the-wordpress-query/ I've modified the main query on the custom type archive based on whether the current is the first page:               <?php     add_action( 'pre_get_posts', 'inet_change_custom_posts_per_page' );          function inet_change_custom_posts_per_page( $query ) {         if (is_admin() || !$query->is_main_query()) return $query;              if( is_post_type_archive( array('case' ) ) ) {             if( $query->is_paged() ) {                 // modify the main query if it's not the first page of an archive                 $query->query_vars['orderby'] = 'name';                 $query->query_vars['order'] = 'ASC';             } else {                 // modify the main query if it is the first page of an archive                 $query->set( 'posts_per_page', '3' );                 $query->query_vars['orderby'] = 'date';                 $query->query_vars['order'] = 'DESC';             }         }         return $query;      }     ?>      The first page of the archive appears as intended, with the three most recent entries sorted by date, and the paging functionality is there courtesy of PageNavi. However, clicking onto the second page leads to a 404 error, even though there should be one more item listed. The main query is not my strong suit, I've rarely had to fiddle with it like this. Is there a solution to this, or should I do a custom query on the main page for the most recent entries, then somehow page through the lot on following pages?


title: Problem with meta_value order after update

text: I use following array and works fine... sort post by meta_key where value of t_count is a number:               $args = array(      'posts_per_page' => 10,      'meta_key' => 't_count',       'orderby' => 'meta_value',        );           query_posts($args);      I use 3.4.2 but if I upgrade to 3.5 array above do not sort correctly. I've try also meta_value_num but do not works fine. Could you help me? Thanks


title: pagination doesn't show up for custom post type

text: Another user on here suggested that my use of queries was incorrect so I'm changing the code. However, the pagination in the first block of code (below) isn't showing up in the HTML while the second one (my original) shows up fine. This one doesn't work (new code):                                   $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                         $loop = new WP_Query( array(                             'post_type' => 'movies',                             'paged' => $paged,                             'posts_per_page' => 6                         ));                              if($loop->have_posts()){                             while ( $loop->have_posts() ) {                                 $loop->the_post();                                      << LOOP GOES HERE >>                                  <?php                           }                        }                        my_paginate_links();                        wp_reset_postdata();                        ?>      This one works (my original code):                                   $c=0;                         $i=1;                              $temp = $wp_query;                         $wp_query = null;                         $wp_query = new WP_Query();                         $wp_query->query('post_type=movies' . '&paged=' . $paged . '&posts_per_page=6');                              while ( $wp_query->have_posts() ) : $wp_query->the_post(); $c++;                                << LOOP GOES HERE >>                          <?php                         endwhile;                          my_paginate_links();                         $wp_query = null;                         $wp_query = $temp;                         wp_reset_query();                     ?>      How can I get pagination to show up in the first block of code?


title: Rewrite function

text: I have a wordpress blog. I get url in blog like this,                   http://www.domain.com/2013/01/test19/page/2/      But I want my ur like this,                  http://www.domain.com/page/2/      So can we rewrite this url. I am newbie to .htaccess. I search many plugins like "WP htaccess control". But I dont know how to configure it. Kindly help me.. Thanks in advance ..)


title: Stuck with sidebar registering

text:
I tried to add a custom page to my Wordpress template. That part is good. What I´m stuck with is a common sidebar that appears although I registered a custom sidebar for it. I am calling the sidebar...               <?php get_sidebar('dfth'); ?>      And registering sidebar (below there is default sidebars registered also)               function web2feel_widgets_init() {          register_sidebar( array(              'name' => __( 'Sidebar', 'web2feel' ),              'id' => 'sidebar-1',              'before_widget' => '',              'after_widget' => '',              'before_title' => '
',              'after_title' => '
',          ) );              register_sidebar(array(              'name' => 'Footer',              'before_widget' => '
',              'after_widget' => '
',              'before_title' => '
',              'after_title' => '
',          ));                       register_sidebar( array(              'name' => __( 'Throwers ),              'id' => 'dfth',              'before_widget' => '',              'after_widget' => '',              'before_title' => '
',              'after_title' => '
',          ) );                    }              add_action( 'widgets_init', 'web2feel_widgets_init' );      I just don´t get what´s happening, everything seems to be okay but sidebar still doesn´t come up. I get an error: `Parse error: syntax error, unexpected T_REQUIRE_ONCE in /data01/virt30509/domeenid/www.throwholics.com/htdocs/wp- content/themes/Underfire/functions.php on line 1`Any ideas?


title: wp_enqueue_style url is trimmed somehow

text: I am using a plugin that adds a style with `wp_enqueue_style()`. When I look at the page source I find this line:               <link rel='stylesheet' id='ai1ec_style-css'  href='http://heseg.com/' type='text/css' media='all' />      After looking at the plugin code I found the `wp_enqueue_style` method and printed the values that it sends and I find that the URL is:               http://heseg.com/?ai1ec_render_css=1376759122ai1ec_style      It looks like the URL is trimmed to `'http://heseg.com/'` What can cause this?


title: Allow User to Edit Page Based on their Email

text: # Quick Info I am using the Posts 2 Posts plugin in order to create a relation between Teachers and the Classes they teach.   * The teacher's page is a **custom post type** of `faculty` in which teachers are added to.   * A `faculty` post has a **custom meta field** labeled `email_address`.   * The classes page is a **custom post type** of `class` in which classes are added to. The Posts 2 Posts plugin allows me to connect the two post types, `class` and `faculty` together. By doing so, I can grab a teacher's `email_address` and `title` and display it on the `class` page, and I can display a link to the `class` page on the teachers page. Outside of this... Teachers will be able to create accounts using their school email. That same email address should match the `email_address` that was entered by an admin on the `faculty` post. * * * # The Goal I want to allow teachers to log in and only be able to edit the `class` page that is associated with the `faculty` page that has a **custom meta field** `email_address` that matches their user email address. I know this is possible, as the Role Scoper plugin allows you to do just that. The only difference is that in the Role Scoper plugin, you have to manually go into the settings, show all the pages associated with `class` post type, select a user by username (not email), and add them to that page. It is cumbersome and a pain for a non-technical user to go about doing it this way. My way would allow you to create a `faculty` with a specific `email_address` and link it to a `class` page. Once a user logs in with a matched email address, they would see that `class` page to edit. Hopefully all this makes sense, I'm not really sure where to begin and I've spent half the day looking for answers... all which lead back to Role Scoper (which I do not want to do). * * * # The Question How do I allow a user to edit a single page, that is related to another page, which has a custom meta field that contains an email address that matches theirs? Boy does that sound complicated... Much thanks and appreciation in advance for any and all help! * * * # Process Walkthrough   1. User logs in   2. Grab user's email address   3. Match `faculty` post where custom meta field of `email_address` matches user's email   4. Get that `faculty` post ID   5. Find `class` post(s) that is/are linked (via Posts 2 Posts) to that `faculty` ID.   6. Give user permission to edit `class` post(s). While the process seems pretty straight forward, I have no idea how to actually give a user permission to edit a specific custom post type page. Again, Role Scoper is capable of doing it, the next question is how.


title: Where to add the code for an outer container in a theme?

text:
I have a Wordpress theme installed (SimplePress) and I would like to add an outer container to it, and I don't know exactly in which file should I add the code. This is the code I tried to use:

      This is an example of how I would like it to look: http://www.harpersbazaar.com I tried adding the code to some of the files, like `scripts.php` or other files from the theme, but I don't know if I have to change a file from the theme, or a file from WordPress.


title: Ajax requests with different WordPress Address and Site Address setup

text: I have a user using my plugin with the following wp setup               WordPress Address (URL)     http://server1.theirhost.com/~acct/somewebsite.com/wordpress          Site Address (URL)     http://www.somewebsite.com      I am using admin_url( 'admin-ajax.php' ) to pull the ajax url, which returns               http://server1.theirhost.com/~acct/somewebsite.com/wordpress/wp-admin/admin-ajax.php      When doing ajax requests from a page on http://www.somewebsite.com, it looks like the "same origin policy" is in effect and the requests fail. Any suggestions on how to fix this issue?


title: front end radio custom taxonomy with custom post type

text:
Hi my good friends I need your help better than losing my mind, first I have to thank "Stephen Harris" for his good article , -second: After a lot of searching I still don't know how to inject a custom taxonomy to a custom post type Here is my code:                 $post_id = wp_insert_post(array(         'post_author' => $user_id,         'post_title' => $post_title,         'post_content' => $post_content,         'post_category' =>   array($_POST['cat']),  // Usable for custom taxonomies too         'tax_input' => array('offer' => $terms),         'tags_input' => array($tags),         'post_type' => 'classified',         'post_status' => 'publish'             ));          update_post_meta($post_id,'$term->term_id',$taxonomy,true);      and                  <?php         //Set up the taxonomy object and get terms           $taxonomy = 'offer';         $tax = get_taxonomy($taxonomy); //This is the taxonomy object                $name = 'tax_input[' . $taxonomy . ']';              $terms = get_terms($taxonomy, array('hide_empty' => 0));         $postterms = get_the_terms($post->ID, $taxonomy);         $current = ($postterms ? array_pop($postterms) : false);         $current = ($current ? $current->term_id : 0);         ?>                    <div id="<?php echo $taxonomy; ?>-all" class="tabs-panel">               <ul id="<?php echo $taxonomy; ?>checklist" class="list:<?php echo $taxonomy ?> categorychecklist form-no-clear">                   <?php                 foreach ($terms as $term) {                     $id = $taxonomy . '-' . $term->term_id;                     echo "
";                     echo "<input type='radio' id='in-$id' name='{$name}'" . checked($current, $term->term_id, false) . "value='$term->term_id' />$term->name
";                     echo "
";                 }                 ?>

        What do I miss, Thanks for the help.