title: Listing custom post types on archive page with array

text:
I'm just starting to wrap my head around custom post types and for some reason can't get any of the custom post types to display in the loop. I've found some queries online but none of them are in closed php statements and I'm not sure how to integrate them. Here's what I have:               // add custom post type     add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'band_artists',             array(                 'labels' => array(                     'name' => __( 'Artists' ),                     'singular_name' => __( 'Artist' )                 ),             'public' => true,             'has_archive' => true,             'supports' => array( 'title', 'editor', 'comments', 'excerpt', 'custom-fields', 'thumbnail' ),             'rewrite' => array('slug' => 'artists'),             'taxonomies' => array('category', 'post_tag')             )         );     }      and query with a randomizer... This was working when these were just plain ol' posts (minus the `'post_type'` obviously).               <?php query_posts(array(         'post_type' => 'band_artists',         'showposts' => 1,         'orderby' => 'rand',         'category' => '5'         ));         if ( have_posts() ) : while ( have_posts() ) : the_post();      ?>          <div id="post-<?php the_ID(); ?>" class="artistSingle">              <?php if (has_post_thumbnail( $post->ID ) ): ?>
<?php the_post_thumbnail('medium'); ?>
         <?php endif; ?>
<?php the_title(); ?>

             <?php if(get_post_meta($post->ID, 'band', true)): ?>                 Band: <?php echo get_post_meta($post->ID, 'band', true); ?>
               <?php endif; ?>             <?php if(get_post_meta($post->ID, 'gear', true)): ?>                 Gear: <?php echo get_post_meta($post->ID, 'gear', true); ?>
             <?php endif; ?>              <?php if(get_post_meta($post->ID, 'website', true)): ?>                 Website: <a href="http://<?php echo get_post_meta($post->ID, 'website', true); ?>" target="_blank"><?php echo get_post_meta($post->ID, 'website', true); ?>             <?php endif; ?>
         <?php the_content(); ?>
             <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', '2012' ) . '', 'after' => '
' ) ); ?>

          <?php endwhile; // end of featured large loop ?>     <?php else : ?>     <?php endif; ?>


title: Publish page by invoking submit via jQuery

text: I'm looking for a solution to a bug that occured in an answer to an earlier question. The general idea is that I want to invoke submit on the post form and have the page published. What happens now is that the page reloads and the message "Page updated" appears, however the page is not published and not even drafted.      I've created a small demo to drop into your `functions.php` to test it out. In the demo I've created a secondary publish button that you can use to experience the problem, this is merely for illustration purposes, in the real case submit is invoked via ajax.                    add_action('add_meta_boxes', 'add_metaboxes_pages', 10, 2);     function add_metaboxes_pages($post_type, $post)     {         add_meta_box('pagesubmitdiv', 'WPSE_DEMO_META_BOX', 'page_submit_meta_box', 'page', 'advanced', 'low');     }          function page_submit_meta_box($post)      {?>         Secondary Publish<?php     }          add_action( 'admin_head-post.php', 'wpse_publish_admin_hook' );     add_action( 'admin_head-post-new.php', 'wpse_publish_admin_hook' );     function wpse_publish_admin_hook()     {         global $current_screen;         if( 'page' != $current_screen->post_type )             return;              ?>                  <?php     }


title: I have a problem with my WordPress DB after I tried to install multi-site

text: I tried to install WordPress Multi-Site. But I ran into some problems with the DB.               wp_1_posts: Table 'studioc_editionspanda.wp_1_posts' doesn't exist     wp_1_comments: Table 'studioc_editionspanda.wp_1_comments' doesn't exist     wp_1_links: Table 'studioc_editionspanda.wp_1_links' doesn't exist     wp_1_options: Table 'studioc_editionspanda.wp_1_options' doesn't exist     wp_1_postmeta: Table 'studioc_editionspanda.wp_1_postmeta' doesn't exist     wp_1_terms: Table 'studioc_editionspanda.wp_1_terms' doesn't exist     wp_1_term_taxonomy: Table 'studioc_editionspanda.wp_1_term_taxonomy' doesn't exist     wp_1_term_relationships: Table 'studioc_editionspanda.wp_1_term_relationships' doesn't exist     wp_1_commentmeta: Table 'studioc_editionspanda.wp_1_commentmeta' doesn't exist      What do I do?


title: Wordpress admin toolbar not loading styles after migration

text: I am really stumped by this one, have looked at various solutions online but nothing seems to work and I have the feeling I am missing something very basic. Essentially, I used manageWP to clone my site to a new server, everything works great except the frontend admin bar/toolbar does not load any css styles (shows up as a simple list at the bottom fo the page). The ID #wpadminbar does not appear link to the relevant css file. Again, this is the only such issue and it is not related to plugins and themes as the problem persists even when changing themes or deactivating all plugins. The only thing I can think of is that since the source wordpress installation was setup as subfolder (like so http://mymaindomain.com/newsite) and the new one is on the domain root (like so http://newsite.com) that there is some relative path somewhere that isn't working properly, but I have no idea where to even look or how to fix it. Any help would be greatly appreciated.


title: Problems with a custom meta_box

text:
I got some information on here which I am using for an Events site I am developing. How to add option box in "Edit Post" plugin API? However, I have changed the checkboxes for text inputs and when saving the post the values disappear. Question 1: How can I get the values to save for each post? Question 2: How do I pass this data to the post page? Here is the function I am using, and here is an image of the problem. http://i.stack.imgur.com/Epg90.png               // POST PAGE EVENTS BOX          // register the meta box     add_action( 'add_meta_boxes', 'event_details' );     function event_details() {         add_meta_box(             'event_details',             'Event Details',             'event_details_content',             'post',             'normal',             'high'         );     }          // display the metabox     function event_details_content( $post_id ) {         // nonce field for security check, you can have the same         // nonce field for all your meta boxes of same plugin         wp_nonce_field( plugin_basename( __FILE__ ), 'myplugin_nonce' );              echo '
Fill in the following details for the event listings page.
';              echo '
<input type="text" style="padding:10px;" name="event-date" value="';         echo date('d-m-y');         echo '" /> Date - What date does the event start? Please type in dd-mm-yy format with dashes included
';         echo '
<input type="text" style="padding:10px;" name="event-time" value="';         echo date('H:i');         echo '"/> Time - What time is the event starting? Please type in 24 hour format with separator colon included
';         echo '
<input type="text" style="padding:10px;" name="event-subtitle"/> Subtitle - Is there an additional subtitle for the event?
' ;         echo '
<input type="text" style="padding:10px;" name="event-guests"/> Special Guests - Is there any additional guests at the event?
' ;         echo '
<input type="text" style="padding:10px;" name="event-venue"/> Venue - What venue is the event at?
';             echo '
<input type="text" style="padding:10px;" name="event-city"/> City - What city or town is the event in?
';         echo '
<input type="text" style="padding:10px;" name="event-link"/> Purchase Link - Type the URL link for TicketABC
';     }          // save data from checkboxes     add_action( 'save_post', 'event_details_data' );     function event_details_data() {              // check if this isn't an auto save         if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )             return;              // security check         if ( !wp_verify_nonce( $_POST['mypluing_nonce'], plugin_basename( __FILE__ ) ) )             return;              // further checks if you like,          // for example particular user, role or maybe post type in case of custom post types              // now store data in custom fields based on checkboxes selected         if ( isset( $_POST['event-date'] ) )             update_post_meta( $post_id, 'event-date', 1 );         else             update_post_meta( $post_id, 'event-date', 0 );              if ( isset( $_POST['event-time'] ) )             update_post_meta( $post_id, 'event-time', 1 );         else             update_post_meta( $post_id, 'event-time', 0 );              if ( isset( $_POST['event-subtitle'] ) )             update_post_meta( $post_id, 'event-subtitle', 1 );         else             update_post_meta( $post_id, 'event-subtitle', 0 );              if ( isset( $_POST['event-guests'] ) )             update_post_meta( $post_id, 'event-guests', 1 );         else             update_post_meta( $post_id, 'event-guests', 0 );              if ( isset( $_POST['event-venue'] ) )             update_post_meta( $post_id, 'event-venue', 1 );         else             update_post_meta( $post_id, 'event-venue', 0 );              if ( isset( $_POST['event-city'] ) )             update_post_meta( $post_id, 'event-city', 1 );         else             update_post_meta( $post_id, 'event-city', 0 );              if ( isset( $_POST['event-link'] ) )             update_post_meta( $post_id, 'event-link', 1 );         else             update_post_meta( $post_id, 'event-link', 0 );     }               ;?>


title: How to change post template

text: I have a post featuring a product that I've created using advanced custom fields. I would like to have a link on the post that opens in a new window and displays the same product, just with a different look and info. (Note: I'm specifically looking to use a second template and not a different CSS because different info will be displayed on each template.) I've tried using the code below, but my custom template just returns a blank page. Can anyone suggest a fix? Here's the link I'm using on the original template.               <a href="<?php the_permalink(); ?>?custom-template=1">Link      Here's the code that I'm putting at the top of the custom template.               if ($_GET['custom-template'] == 1) { include custom-template.php; return; }      Thanks, John


title: Advanced Custom Fields - category image

text: I'm trying to get an image for I previously assigned to a category using ACF. here's what I'm doing:               $category_image = the_field('cat_small', $linkedcat);      where $linkedcat is something like category_280 When I echo $category_image, i see an array, like so:               261, , catsmall, , , http://localhost/current/dpf/wp-content/uploads/2012/12/catsmall.jpg, Array      Any idea what I'm doing wrong? Many thx! Alex


title: Detect error 404 page to find out the issue

text: I have a wordpress website, which when I visit > www.mywordpress.com/test/setup it throws an error 404 page. Which class in wordpress handles the request dispatching?


title: Why the_excerpt() function returns excerpt on the Home page and trimmed content in sidebar?

text:
I have this code to display 4 posts of type "testimonial" on the Home page:               <?php                 $custom_posts = get_posts([                     'numberposts' => 4,                     'post_type' => 'testimonial'                 ]);                 ?>                      <?php foreach ($custom_posts as $post) : setup_postdata($post); ?>
                         <?php the_excerpt(); ?>                              <a href="<?php the_permalink(); ?>">Continue reading
<?php echo get_post_meta($post->ID, 'pacient', TRUE); ?>

                      <?php endforeach; ?>      This works as expected. Excerpts are shown. Sunshine rainbows. Unfortunately if I move exactly the same code to the sidebar on other side no excerpts are shown. There is content trimmed down for each post instead. In other words: This exact same code (copy/pasted) on home page produces excerpts. In the sidebar on other page it produces trimmed content with "[...]" at the end. I have no clue why. Can the problem be related to where the get_post function is called (after Query or something). Why this function behaves differently in both cases? How do I force it to show excerpt only and not the post content. Am I missing something?


title: How can I only show one responsive menu on mobile devices?

text: Here's my site: http://dev.shoeporn.com/ I'm running WP 3.5 and using this plugin: http://wordpress.org/support/plugin/responsive-select-menu It is supposed to allow you to select which menus you want to be responsive, but it doesn't seem to work. I only want the `<div id="header-bar">` menu to be displayed to mobile devices, but currently `<div id="header-nav">` is also shown. I tried messing around with CSS but I think the "Responsive Select Menu" plugin javascript is overriding it when the page loads. Any ideas?


title: How to redirect WP post with a specific word in the URL

text: I've changed the URL structure of my WordPress post (not page) from:               example.com/archive/post-id      to:               example.com/post-name      I'd like to redirect the old structure `/post/` to the new one via `.htaccess`, or plugin.


title: Navigate with one button through a responsive wordpress page

text: You can take a look at Tessellate a HTML5 responsive template to see what I'm trying to accomplish. I love this theme and I'm especcialy interested in the way you can navigate with one button to different parts of the page and I would like to do this with a wordpress website. Does anyone know how I can integrate this effect in an existing theme or do you know a theme with this kind of navigation? Thanks in advance


title: Global localized sort order

text: WP tables were created on import from another server, and most columns got the utf8_general_ci collation. The problem I'm having is that menus are sorted in the wrong order for the language of the multisite site (Swedish). Existing and new posts should be sorted according a site's language. I've tried changing the collation for the table, database, and connection to utf8_swedish_ci in phpMyAdmin, and also to set DB_COLLATE in wp-config.php to the same value. No change in menus or in wp-admin post listings. What are the steps required?


title: Nonce best practices: hidden input vs. wp_localize_script?

text: I noticed while looking at the HTML of an edit page that WordPress uses a lot of hidden input elements for storing nonces. Is there a significant advantage to using either this style of storing nonces for AJAX use or using those stored via the `wp_localize_script` style?


title: Problem Display Custom Post On Page

text: i am new in wordpress and first time i make plugin with help of tutorial i make custom post i need when i add data in custom post display on page but i still didn't find the mistake please suggest, i mention my two files code below for reference. [File 1]:   [File 2]:


title: Populate Array with values from another arrray

text: I have retrieved WP_Post object and i stored it in a variable.               Array     (     [0] => WP_Post Object         (             [ID] => 45             [post_author] => 1             [post_date] => 2014-03-10 14:22:01             [post_date_gmt] => 2014-03-10 14:22:01             [post_content] =>              [post_title] => sddddddddddd             [post_excerpt] =>              [post_status] => publish             [comment_status] => closed             [ping_status] => closed             [post_password] =>              [post_name] => sddddddddddd             [to_ping] =>              [pinged] =>              [post_modified] => 2014-03-10 14:23:57             [post_modified_gmt] => 2014-03-10 14:23:57             [post_content_filtered] =>              [post_parent] => 0             [guid] => http://localhost/bitbucket/?post_type=advertisement&p=45             [menu_order] => 0             [post_type] => advertisement             [post_mime_type] =>              [comment_count] => 0             [filter] => raw         )          [1] => WP_Post Object         (             [ID] => 40             [post_author] => 1             [post_date] => 2014-03-10 11:00:28             [post_date_gmt] => 2014-03-10 11:00:28             [post_content] =>              [post_title] => 123             [post_excerpt] =>              [post_status] => publish             [comment_status] => closed             [ping_status] => closed             [post_password] =>              [post_name] => 123             [to_ping] =>              [pinged] =>              [post_modified] => 2014-03-10 12:49:24             [post_modified_gmt] => 2014-03-10 12:49:24             [post_content_filtered] =>              [post_parent] => 0             [guid] => http://localhost/bitbucket/?post_type=advertisement&p=40             [menu_order] => 0             [post_type] => advertisement             [post_mime_type] =>              [comment_count] => 0             [filter] => raw         )          [2] => WP_Post Object         (             [ID] => 37             [post_author] => 1             [post_date] => 2014-03-05 13:56:15             [post_date_gmt] => 2014-03-05 13:56:15             [post_content] =>              [post_title] => asd             [post_excerpt] =>              [post_status] => publish             [comment_status] => closed             [ping_status] => closed             [post_password] =>              [post_name] => asd             [to_ping] =>              [pinged] =>              [post_modified] => 2014-03-10 14:26:23             [post_modified_gmt] => 2014-03-10 14:26:23             [post_content_filtered] =>              [post_parent] => 0             [guid] => http://bitbucket/?post_type=advertisement&p=37             [menu_order] => 0             [post_type] => advertisement             [post_mime_type] =>              [comment_count] => 0             [filter] => raw         )      ) Well the above is my object. Now i need to store some values from it in a custom array which would look like:               $my_array = array (                    ID => post_title                 );      and ID and post_title should be from the object above. How can i accomplish this?


title: Subdomain is not working

text: I just finished setting up my multisite. However the subdomain is not working. I believe I followed every step necessary to create a subdomain network for wordpress multiste. I also have created a wildcard subdomain               *.yofnel.com      That points to /public_html I dont know what to do now. Please help.


How do I add a favicon that only shows during viewing of my plugin's admin panel? I mean, what event do I intercept?


title: add_feed and flush_rewrite_rules

text: There seems to be quite a controversial opinion on the WordPress `flush_rewrite_rules()` function. According to the Codex, it is highly discouraged to use this function on the `init` action hook. **However:** In a plugin I am working on, I am using `add_feed()` to, well, add a feed. The Codex says that this should be run on `init` and requires a one-time use of `flush_rewrite_rules()`. See my dilemma ? I need `add_feed()` on `init`, which requires `flush_rewrite_rules()`. Hence, `flush_rewrite_rules()` on `init`, which is breaking all custom post type rewrite rules and permalinks, resulting in 404 pages. **So my question is:** how should this be done ? This is what I currently have on `init`, that is related to the issue:               add_action( 'init', 'my_foobar' );     function my_foobar() {         // getting some settings         add_feed( $url, $callback );         flush_rewrite_rules();     }      Any help would be greatly appreciated. thanks :)


title: How to add ASCII symbol after each recent post

text:
How do I add an ASCII code after each recent post list item?               <?php         $args = array( 'numberposts' => '2' );         $recent_posts = wp_get_recent_posts( $args );         foreach( $recent_posts as $recent ){             echo '
' .   $recent["post_title"].'
 ';}         ?>      So that the output would be Recent post 1 >   Recent post 2 > EDIT1: If i just put &agt; after `</a>`, the symbol it wil be part of the hyperlink. I just want it to be apart from the link.
     <?php         $args = array( 'numberposts' => '2' );         $recent_posts = wp_get_recent_posts( $args );         foreach( $recent_posts as $recent ){             echo '
' .   $recent["post_title"].'>
 ';}         ?>


title: Compare string with post id in wpdb and do stuff when match is found

text: I'm looking for some help tying in with the wpdb to compare and change certain values. I'm very novice with mysql handling so I really appreciate any help on this matter! What I want to do is to go through the wp db looking for a post same id as `$page_id`. When the post is found it should check the `menu_order` value and compare it to `$page_order`. If they're the same, then do nothing, but if they don't match it should set `menu_order` to the value of `$page_order`. Here's some pseudo code:               $page_id = 45;     $page_order = 1;          if(post_id == $page_id) {         if(menu_order != $page_order) {             set menu_order to $page_order                  switch($page_order) {             case "1":                 set post meta "color_dropdown" as "pink"                     if have child pages set post meta "color_dropdown" as "pink" to them aswell                 break;             }         }     }      All help appreciated! Thanks


title: Attaching multiple custom taxonomies to one CPT?

text: So I've been developing a complex CPT lately and something came up that made me realize I need a second custom Taxonomy on the CPT. Is this impossible? Also I'm currently using tags as well, so the second taxonomy can't be subbed out for tags. Any advice is greatly appreciated.


title: Remove a menu item in menu

text: I know this has been asked many times. But from what i got after searching, i could not understand much. I have used `wp_update_nav_menu_item` to add menu items programatically. But i don't know how to remove a specific menu item. In one of the forums, it has been told to unset the array element (forum). But i did not understand it. Can anybody explain how to do it?


title: In my plugin when i call select page is blank

text: i have problem: In my plugin directory I have two files:   * `gen.php`   * `open.php` When I redirect from `gen.php` to `open.php` and I use select in `open.php`               $myrows = $wpdb->get_results("SELECT * FROM wp_ogloszenia_kupione");      My file won't open I use:               $fp = fopen(trim(trim($id)),"wb");          fwrite($fp,$content);     fwrite($fp, pack("CCC",0xef,0xbb,0xbf));     fopen(trim(trim($id)),"r");     fclose($fp);     //End 4     //5 - Otwarcie pliku                    if (file_exists(trim($id))) {         header('Content-Description: File Transfer');         header('Content-Type: application/octet-stream');         header('Content-Disposition: attachment; filename='.basename(trim($id)));         header('Content-Transfer-Encoding: binary');         header('Expires: 0');         header('Cache-Control: must-revalidate');         header('Pragma: public');         header('Content-Length: ' . filesize(trim($id)));         ob_clean();         flush();         readfile(trim($id));         exit;     }       But when I delete select everything work Good. So why does select cause this mess?


title: solution to prevent specific admins from altering site contents

text: I wonder if there is a solution already present that will restrict even the top level admins that I select from doing things such as installing plugins, disabling plugins, etc. that an admin normally has access to. I want to ensure that my team doesn't ever try to do anything on our testing or production environments that they should only be doing on a dev environment. Is there anything like this?


title: Adding an orderby filter, casting postmeta with multiple keys

text: I am using this filter to sort my query by a date field stored as text (legacy data)               add_filter( 'posts_orderby', 'my_posts_orderby_date', 10, 2 );     function my_posts_orderby_date( $orderby, $query ) {         global $wpdb;         return " CAST( $wpdb->postmeta.meta_value AS DATE ) " . $query->get( 'order' );     }      I need to tell this filter which meta_key to use, because it currently grabs the wrong meta key ($state_key) to sort on. How would I adjust this filter to do so? i.e. I need to add this to the filter, somehow               $wpdb->postmeta.meta_key = 'tf_events_startdate'      Here is the original set of args, if it helps. Thank you!               $args = array(                 'post_type' => 'tf_events',                          'meta_key' => $state_key,                 'meta_value' => $state_meta_value,                 'meta_query' => array( $relation, $date_query, $date_query2 ),                 'posts_per_page' => $limit,                  'tax_query' => array( 'relation' => 'AND', $type_query, $host_query ),                               'order' => 'ASC'             );


title: slide change on hover with nextgen scrollgallery

text: My jquery skill is pretty bad, so I can not seem to achieve this. I have a nextgen gallery album that has a scroll gallery showing the images in a slideshow. I want to change the slides on hover rather than on click. I know it is pretty simple, but I have no idea how to actually do it.


title: Get url/link to latest comments in a post

text: I have a post list in `Wordpress` where people can see the `most recently commented posts`. They will appear above the list. That's fine, but now, I have 300 comments on the same posts and I don't want the people to go `scroll` fully down when they want to read the `newest` `comments`.... Therefore I am asking if it's possible to get the url to the most recent commented posts on a particular day? For instance, my post list is updated if there is made a comment. On a day, they comment 30 times.... I want a `link` to the **first** of this 30 comments, so that they can read from there, instead of scrolling down 270 other comments. Is this possible? If so, how? Can someone help me?


title: Fancy-box Esay wordpress plugin fails to work on Multilingual site

text: I have a multi lingual site. On the site I want to display youtube movies using fancybox (or any other equivalent solution) The plugin is installed and set. When checked on the He version - all works well. On En on the other side, it redirects to youtube. EN: http://www.mtbsuisse.com/en/category/videos/ HE: http://www.mtbsuisse.com/category/videos/ Any idea why this happens ? I am using qtranslate for the multilingual support *Changed site default to HE for now


title: Loading wordpress menu in an external server

text: The scenario is like, I have two servers:   * Server A : Hosts WordPress   * Server B : Hosts Some PHP Scripts Now, I want to load the wordpress menu on **server B**. Is there any way to achieve this? Couldn't find anything helpful. I have a plan like this, so far:   * Save the complete output of `wp_nav_menu()` in the wordpress **option table**   * From Server B, connect to wordpress database **remotely** and get the value of the menu from option table, and print that on the PHP page, wrapping with css from the wordpress theme. Is there any good approach than what I have planned?


title: is_plugin_active() returning false on active plugin

text: So I have the following in an include in my theme file:               include_once( ABSPATH . 'wp-admin/includes/plugin.php' );     if ( is_plugin_active( WP_PLUGIN_DIR . '/woocommerce/woocommerce.php' ) ) {       $shop_id = woocommerce_get_page_id( 'shop' );       $shop_page = get_page( $shop_id );     }      but `is_plugin_active( WP_PLUGIN_DIR . '/woocommerce/woocommerce.php')` is returning false, despite the fact that the plugin is active. I'm wondering if `is_plugin_active()` might be tripped up by the theme customizer, because the fact that I'm doing this while hooked to `customize_preview_init` is the only gotcha that I can imagine would be causing issue. Any insights?


title: What is the beste practice to check for pretty permalinks?

text: I develop a plugin and therefore I add new RSS feeds. One feed might look like `http://local.wordpress.dev/?post_type=custom-post-type&custom- taxonomy=tax-1&feed=custom-feed` This works pretty good. But if pretty permalinks are enabled also this url works which will be redirect to the same feed `http://local.wordpress.dev/custom-taxonomy/tax-1/feed/custom-feed`. So far so good. My plugin will list all available feeds for the user. My question what is the best practice to check if pretty permalinks are active and which url version should be displayed? My idea is to look at `$wp_rewrite` which `permalink_structure` is set and decide which version to show. Is there a better way to do it?


title: Using Hooks. Thematic

text: I've added some custom fields to pages and trying to figure out the best way to display them. I was thinking I could use the get_field() option and hook into a sidebar, but am not really sure how to do this. EDIT--- Ok sorry folk, I apologize for not being specific. I am adding custom field options to each page in my theme using this plugin http://www.advancedcustomfields.com/ I was using short-codes previously to add the content into a specific page, but know I need it globally. I figured the easiest way to do this would be to hook into the side bar but an more sure exactly how to do this. The other option is to go into the loop, but I would rather leave that alone if I can. So my question is, how do you hook into a sidebar widget using functions.php?


title: Why is this Ajax not working?

text: I'm not sure if I am abusing WordPress and Ajax by doing it this way but WP and Ajax Codex a well as Plugin Development with Ajax do not seem to be very helpful. I have created the following Ajax situation:               (function($){            $(document).ready(function(){             $('a').click(function(e){               var el = $(this).prev('input[type="checkbox"]');               if(el.is(':checked')){                    el.prop('checked',false);                  }               $.ajax({                   url  : "<?php echo CORETHEME_ADMIN_TEMPLATE_HELPER_URL . 'UncheckPackageThemeHelper.php'; ?>",                   type : 'POST',                   data : { 'element_name' : el.prop('name') },                         success: function(result){                     console.log(result);                   },                   error: function(jqXHR, textStatus, errorThrown ){                     console.log(jqXHR, textStatus, errorThrown);                   }                });               e.preventDefault();             });         });       })(jQuery);      Which states that: _When a link is clicked, we unchecked the check box and pass that element name to a class._ Everything works until you see the `unset_package` method in my class               class CoreTheme_AdminPanel_Template_Helper_UncheckPackageThemeHelper{              private $_element_name = null;              public function __construct(){             if(isset($_POST["element_name"])){                 $this->_element_name = $_POST["element_name"];                 $this->unset_package();             }         }              public function unset_package(){             $option = get_option($this->_element_name);             if(isset($option)){                 $option = '';             }         }     }          new CoreTheme_AdminPanel_Template_Helper_UncheckPackageThemeHelper();      Everything works until the `get_option` - I get 500 errors. meaning that the get_option() method doesnt exist - in this instance. **I think** If I take out the `get_option` and the rest of it and replace the contents of `unset_package` with `echo json_encode($this->_element_name);` everything works and I get the element name given back. Can some one explain why this isn't working and maybe show me the proper WordPress way? The Documentation was very confusing to say the least.


title: Canonicalization + Custom Post Types not working as expected

text: I have an issue with Canonicalization where on Custom Post Types say for example: /custom-post-type/{post_id}/fake-post-name/ is loading up but not redirecting to : /custom-post-type/{post_id}/real-post-name/ It basically is allowing anything to be after post id and load that URL instead of redirecting to the correct one. Ive got my CPTs setup with custom rewrite rules using 'add_rewrite_rule' and associated my custom post links with 'post_type_link'. Have I missed a step somewhere? Many thanks. Just add to this the actual Canonical tag displays the correct url it should redirecting to. Will I need to add a filter to canonical_redirect and check the post_name of the CPT and see if it matches for the given post id and pass it back perhaps? Im not sure if this is needed/or way to fix it given the canonical in the is correct?


title: Separate tags with semicolon

text: Does anyone know if there is a way to change the callback function for a tag- like custom taxonomy so that it breaks terms after a semicolon instead of a comma? I realize I can rewrite the whole meta box, but I'd rather not if there's an easier way.


title: Reverse order of events on homepage

text:
I'm having problems reversing the order of events that are appearing on my homepage. I want them to appear with the next event at the top. I have tried modifying the code in index.php right before the `have_posts()` function as some tutorials suggest, but it doesn't seem to work the same with events as it does posts. The plugin I'm using for the events is The Events Calendar. I've included the code in case someone needs it. I'm on the latest version of the plugin, and the latest of wordpress. The theme is built on "Point"                   <?php $mts_options = get_option('point'); ?>         <?php get_header(); ?>

                             <?php _e('Upcoming events',"mythemeshop"); ?>

         <?php   $j=0; $i =0;    if (have_posts()) : while (have_posts()) : the_post();?>                     <article class="<?php echo 'pexcerpt'.$i++?> post excerpt <?php echo (++$j % 2 == 0) ? 'last' : ''; ?>">         <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="nofollow" id="featured-thumbnail">                             <?php if ( has_post_thumbnail() ) { ?>                                  <?php echo '
'; the_post_thumbnail('featured',array('title' => '')); echo '
'; ?>                             <?php } else { ?>
                                     <img src="<?php echo get_template_directory_uri(); ?>/images/nothumb.png" class="attachment-featured wp-post-image" alt="<?php the_title(); ?>">
                             <?php } ?>
<?php $category = get_the_category(); echo $category[0]->cat_name; ?>

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

                                 <?php echo mts_excerpt(29);?>                                 <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="nofollow"><?php _e('Read More','mythemeshop'); ?>

                 <?php endwhile; else: ?>

<?php _e('No results found. We apologize for any inconvenience, please hit back on your browser or use the search form below.', 'mythemeshop'); ?>
                         <?php get_search_form(); ?>
                 <?php endif; ?>                                  <?php if ( isset($mts_options['mts_pagenavigation']) && $mts_options['mts_pagenavigation'] == '1' ) { ?>                     <?php  $additional_loop = 0; global $additional_loop; mts_pagination($additional_loop['max_num_pages']); ?>                            <?php } else { ?>

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

<?php previous_posts_link( __( 'Newer posts'.' →', 'mythemeshop' ) ); ?>

                 <?php } wp_reset_query(); ?>
             <?php get_sidebar(); ?>     <?php get_footer(); ?>


title: Redirecting non www to www ONLY for domain, subdomain without www

text: How to set htaccess to such examples in a Wordpress Multisite:   * domain.com - redirect to - www.domain.com   * sudomain.domain.com - no redirect I have a `Error 310 (net::ERR_TOO_MANY_REDIRECTS)` when my `.htaccess` file looks like this:               RewriteEngine On      RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{HTTP_HOST} !^www.     RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]          # add a trailing slash to /wp-admin     RewriteRule ^wp-admin$ wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^(wp-(content|admin|includes).*) wp/$1 [L]     RewriteRule ^(.*\.php)$ wp/$1 [L]     RewriteRule . index.php [L]


title: Downgrade from latest nightly build to latest stable version

text: I'm currently running `3.6-alpha-23495` and want to go back to the latest stable (currently `3.5.1`). The site is now up and running. The reason that I'm going to downgrade is that the following error is appearing:               Fatal error: Allowed memory size of 33554432 bytes exhausted     (tried to allocate 311296 bytes) in     /home/USERNAME/public_html/wp-includes/SimplePie/Misc.php     on line 843      I have added `ini_set('memory_limit', '64M');` to `wp-config.php` to execute the command everywhere, and also added the code at the top of `/wp- includes/SimplePie/Misc.php`, but still no luck. Anyway I think that the best way to avoid facing with these errors is downgrading to the latest stable version. Ant ideas? Thank you


title: How can I create a data entry form that has Master Detail ability?

text: I have a patron and books for a library (in this example). One person/patron, many books. I have the two tables. I believe I could use either tablepress or roll my owne output via a custom plugin and view a report. But I'm stuck on where to get started for data entry. How can I have a form where I create the person and the books they check out all on one page? It would just add another row for each extra book for that checkout date. I have used something similar in Drupal, creating forms, but I cannot find it in WordPress.


title: Changing the URL Structure of a Paginated Custom Post

text: I have a custom post type for slideshows that creates a paginated post and each slide is a separate page. The data for each slide is saved in the custom fields and each slide has a title set saved in the custom field with key `slide{$i}-title` (`$i` being the slide number, for example `slide1-title`). Currently the url of each subsequent page is the number appended to the post permalink (which is the standard way paginated page urls are formatted) like this: http://example.com/post-title/2/ for page/slide 2 and http://example.com/post-title/3/ for page/slide 3. **How can I change this so that each page's url is appended with the slide title instead of the incremental number?** For example: http://example.com/post-title/slide-2-title/ for page/slide 2 and http://example.com/post-title/slide-3-title/ for page/slide 3.


title: Query 2 meta key values and a category

text: I have a wp query that works great - it returns a list of featured posts. WP_Query("category_name=office&meta_key=featured_post&meta_value=Yes&posts_per_page=3"); However I want to add a 2nd custom key to the query (a custom order field) then order by the numerical value of the meta value of this key.. is it possible to use 2 meta_key values in a WP_Query? If not is it possible using an SQL query statement?


title: Pass variable to nested shortcode

text: I'm setting up a plugin with a nested shortcode, i.e.               [ct_training_group]         [ct_training]     [/ct_training_group]      Here's the catch: I use the `[ct_training]` code outside of the parent as well as within it, and want to output something slightly different in each case. When it is inside a group, I need to omit the `<ul>` and `</ul>` that I would wrap the `[ct_training]` shortcode in when it is called on its own. I figure the easiest way to do this would be to pass a variable from the parent to the child. Is there any graceful way to do this where I wouldn't need to mess with globals or such? Thanks.


title: Multiple Custom Metabox Help

text: I have been trying to get this worked out for over a year and have tried numerous ways and have not been able to get it to work. I'd really appreciate it if someone could help me with this. Here's what I'm trying to do... I need to create 15 custom metaboxes for the Write screen on my custom post type for Slideshows (lom_slideshow). Each metabox will be the same except for the number of slide (Eg, Slide 1, Slide 2...). I would like the metaboxes to save each field into the seperate Custom Field. Here are the fields that need to be in each metabox:   * **Number/Text Field**     * Title: Slide Number     * Custom Field Key: slide1-number   * **Checkbox**     * Title: Hide This Slide     * Custom Field Key: slide1-hide   * **Radio toggle**     * Title: Slide Type     * Custom Field Key: slide1-slidetype     * Values: Image Slide or Video Slide   * **Text Field**       * Title: Slide Title     * Custom Field Key: slide1-title   * **Image** (this one could work several ways and I don't really care how it works as long as it does)      * Title: Slide Image     * Custom Field Key: slide1-image     * How it will function: as long as it does one of the following things I'll be happy...     * **A)** A dropdown list of all the image attachment associated with the post.      * **B)** A list of thumbnails for all the attached images associated with the post.      * **C)** An image upload field to upload an image and attach it to the post.    * **WYSIWYG**     * Title: Slide Description     * Custom Field Key: slide1-desc     * Type: wysiwyg   * **Textarea**     * Title: Video Embed Code     * Custom Field Key: slide1-embed _Slide 2 will be the same but the all the Custom Field Values will be appended with "slide2-" instead of "slide1-"_ The only other consideration is that I'd like them to be in the main content column and only visible on my Slideshow custom post type (lom_slideshow). Like I said I have tried this numerous time and never got it right. I have gotten close in the past and have gotten the whole thing working except I couldn't get multiple instances of the WYSIWYG to show up on the page. I no longer have that code because I have changed it numerous times since then. I ultimately decided on using the More Fields Plugin to do this instead of my own code and tested it with 5 meta boxes for development, but then when I tried to implement it with the 15 boxes I needed the plugin wreaked havoc on my database tables. I really don't want another plugin. I'm actually looking for someone to just tell me how to code it. I don't need links to tutorials because I am confident that I have tried them all unless it was published in the last hour or so. For some background here was what I was originally trying to do: Help Creating a Slideshow Custom Post Type with Custom Meta Boxes? EAMann provided me with a very comprehensive answer however it was outside my skill set and I couldn't implement it. I have simplified my request down to this question here in hopes of finally being done with this.


title: Remove/Unregister or hide a widget added by a plugin

text: I'm trying to figure out how to remove wordpress widgets added by plugins. I know there are a couple of plugins that do this, like https://wordpress.org/plugins/wp-remove-widgets/ and https://wordpress.org/plugins/post-lists-view-custom/, however I'd rather not use a seperate plugin for something that seems like such a small task. Specifically, I'm trying to unregister the wordpress engine powered by widget that http://wpengine.com/ loads on the widgets page. I searched the source code and found the id of the widget is `wpe_widget_powered_by` However, this does not work...               function my_widgets_init() {         unregister_widget( 'wpe_widget_powered_by' );     }     add_action('widgets_init', 'my_widgets_init');        So far the only thing I've been able to do effectively is use a combination of css/js to hide then remove the widget. I use css to hide it on page load and then remove it with jquery so there's not a blank gap where the widget is suppose to go.               function remove_wpe_powered_by_widget() {     ?>     <style type="text/css">         [id*="wpe_widget_powered_by"] {     display: none;     }     </style>     <script type="text/javascript">         jQuery(document).ready(function($) {         $("div[id$='wpe_widget_powered_by']").remove();         });     </script>     <?php     }     add_action( 'admin_head', 'remove_wpe_powered_by_widget' );      While the above works, I know it's not the correct way to do things and I'm wondering why the first function doesn't work. The codex says to do the following.               <?php unregister_widget( $widget_class ) ?>      Maybe I'm not understanding what exactly $widget_class is. Is there a way to find the widget class without searching through the plugins code? Or do I already have the correct class and it's not working for another reason (perhaps a late hook or something). I looked all through stackexchange and the internet and could only find ways to remove default widgets, but no one tells you how to remove widgets added by plugins. Sorry if I'm missing something and this is an obvious question.


title: Taxonomy and Date in same query?

text: Is is possible to combine a tax_query with a date_query in the most recent Wordpress? Here's my attempt to do so:               $args = array(      'post_type' => 'job',     'tax_query' => array(              array(               'taxonomy' => 'location',             'terms' => 'dallas',             'field' => 'slug',            )        ),      'date_query' => array(         array(             'year' => '2014',             'month' => '12',         ),       )     );     $jobs = new WP_Query($args);      However, it is ignoring the date query and only the taxonomy query works. When I remove the taxonomy query portion, the date query suddenly works. Any ideas on this?


title: How can I achieve this, using shortcodes

text: I have a plugin that restricts contents for registered users only, on the other hand I have created a shortcode for showing a chat and I want to hide it using the restrictive shortcode; [upme_private][chat][/upme_private] But it doesnt work, what would be the best aproach? The function to "Hide" restricted content uses;               function upme_private($atts, $content = null) {             global $upme;             return $upme->hidden_content($atts, $content);         }      and the shortcode that i created is > add_shortcode( 'barchat', 'barc_chat_script' ); Essentially what I want is to be able to hide the barchat shortcode from users by; > [upme_private][chat][/upme_private] But I dont know how to modify the return of the upme_private function to include do_shortcode() since its already returning another function (hidden_content)


title: Required Field for Comment parent only?

text: I am trying to make the rating required for a comment but not required when it is a reply. Its not working, can you please help.               function custom_validate_comment() {         //validate rating         if( $comment->comment_parent==0) {          if( empty( $_POST['rating'])  )                 wp_die( __('Error: Please Include Your Rating (0 to 5 Stars)')    );         }     }          add_action('pre_comment_on_post', 'custom_validate_comment');


title: How to add 3 weeks to the_time() function

text:
I have a WordPress blog where I need to display an image on each post only for 3 weeks. This means that after 3 weeks have passed, since each post was published, the image will disappear. First, I made sure that the image appears each time a new post is published. This was easy. Then I needed to get the date when each posts was published and I used `the_time();` function. The problem I'm having right now is that I don't know how to use `the_time();` function to do anything (compare it with current time, adding 3 weeks etc). I tried to do this with javascript using this code which works, it outputs the current date and the date after 3 weeks.               now = new Date();     threeweeksfromnow = new Date(now.getTime() + (21 * 24 * 60 * 60 * 1000));     months = new Array("January ","February ","March ","April ","May ","June ","July ","August ","September ","October ","November ","December ");          document.write("Today's date is: " + months[now.getMonth()] + now.getDate() + "
");          document.write("Three weeks from today is: " + months[threeweeksfromnow.getMonth()] + threeweeksfromnow.getDate() + "
");       I tried to tie this code to `the_time();` function in wordpress but it didn't worked. Does anyone have any idea how I might solve this problem?


title: How do I attach images to a post without inserting them?

text: I'm developing a theme with an built-in gallery outside of the post content. So what I want to do is to allow editors to attach images to a page/post without inserting them. Kind of like the featured image, but with any number of images. Just a nice UI for uploading, and leave it to the theme to render it. I looked at some plugins, especially NextGen Gallery, but so far they all work by inserting a shortcode in the post body.


title: Sorting past events by month

text: I have a site that lists upcoming events and past events. In my category-past-event.php template, this is how I've gotten past events appear in descending order (from most recent to oldest):                   <?php                     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                     $args = array(                       'posts_per_page' => 100,                       'paged' => $paged,                       'cat' => 3709,                       'orderby' => 'meta_value',                       'meta_key' => 'Deadline', //formatted YYYYMMDD                       'order' => 'desc'                     );                          query_posts($args);                  ?>      This setup successfully lists events in the order they appeared, e.g.   * Event 6    * Event 5    * Event 4   * Event 3   * Event 2   * Event 1 How can I get it so that the past events are broken up by month? E.g. December 2012   - Event 6    - Event 5    - Event 4   November 2012   - Event 3   - Event 2   - Event 1 **Update:** I have set up pre_get_posts in functions.php as @s_ha_dum suggests and this is working. @KrzysiekDróżdż, the problem I have is that the Deadline might not correspond to get_the_time('F Y'). This is because I might create a post with the Deadline = 20131212 (i.e. taking place in December 2013), but the time of that post might be different. I.e. it is June, and I create an upcoming event for December, the time of that post is June because I created it in June. Currently using this on a production site (though I am testing locally with MAMP). The workflow for creating events is that posts are categorized as Events, and then the Post Expirator plugin switches their category to Past- Event once the date of the event has passed. Deadline exists so the posts can be sorted in ascending or descending order. Still trying to wrap my head around how in the loop in category-past-event.php I would use that Deadline to sort them by month


title: NGINX conf on WP Multisite enabled -- subdirectory -- images fail to load after updates

text: A server with nginx and WP 3.9.1 was working properly. The nginx helper plugin was updated two days ago and now no images or zip files in the uploads directory are available in the browser or the media library. Now, if I edit the image in the media library then it shows but 'disappears' upon updating. In looking at browser urls this is what WP is serving but fails `domain.com/chemistry/files/year/month/image.png` This url shows the image if put in manually to the browser `domain.com/chemistry/wp-content/uploads/sites/#_of_site/year/month/image.png` I've looked at the map feature of the plugin, tried to read the documents, but cannot figure out what happened and what was changed so I can fix it to get images to load properly. Can someone point me in the correct direction? -- disabled nginx helper plugin -- restart nginx -- reinstalled nginx helper plugin -- enabled map feature of nginx helper plugin


title: Documentation for IDE's

text: I'm using IntelliJ but this question could apply to PhpStorm, Visual Studio, etc... Is there a good way to make the IDE aware of the Javascript functions that WordPress provides? Are there any Javascript stubs available like these Google Maps stubs? I'd like to have auto-completion available, parameter info, etc...


title: Display featured products by category

text: I have this code in my themes' shortcode to display featured product rating product like this. But I need to get product by category show. Which code do I have to add. Any suggestions?               if($type == 'featured'){                  /**********QUERY FOR FEATURED PRODUCT**********/                  $query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product' );                            $query_args['meta_query'] = array();                            $query_args['meta_query'][] = array(                      'key' => '_featured',                      'value' => 'yes'                  );                  $query_args['meta_query'][] = $woocommerce->query->stock_status_meta_query();                  $query_args['meta_query'][] = $woocommerce->query->visibility_meta_query();                  /**********END QUERY FOR FEATURED PRODUCT**********/              }elseif($type == 'top-rated'){                  /**********QUERY FOR TOP-RATED PRODUCT**********/                  add_filter( 'posts_clauses',  array( $woocommerce->query, 'order_by_rating_post_clauses' ) );                            $query_args = array('posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product' );                            $query_args['meta_query'] = array();                            $query_args['meta_query'][] = $woocommerce->query->stock_status_meta_query();                  $query_args['meta_query'][] = $woocommerce->query->visibility_meta_query();                  /**********END QUERY FOR TOP-RATED PRODUCT**********/


title: Update postmeta after theme switch

text: I am trying to update the postmeta table when I switch themes. I am updating the metavalue to be template-name.themename.php. However, this only works with the default themes in wordpress. If I go to add a new theme, and activate that, it does not work. The metavalue updates correctly, but the new theme is overriding the custom template. Here is the code I have.                   <?php         add_action('after_switch_theme', 'update_templates');              function update_templates() {              global $wpdb;         $new_template = "pl-template.". strtolower(trim(get_current_theme())) .".php";         $pl_pages = $wpdb->get_results(" SELECT * FROM {$wpdb->prefix}posts WHERE pevo_page = 1");                   foreach ( $pl_pages as $pages) {                  $post_id = $pages->ID;                  $wpdb->query(                   "                     UPDATE {$wpdb->prefix}postmeta                     SET meta_value = '$new_template'                     WHERE post_id = $post_id                                          "              );              }     }         ?>      The custom template, is just blank right now and just displays the page title                   <?php         /*          Template Name: Template Name         */                   $the_title = get_the_title();              echo $the_title;        ?>      working code thanks to the answers, I used an array because this is within my plugin class.                   add_filter( 'template_include', array($this, 'plugin_page_templates'));                          function plugin_page_templates() {         global $wpdb;         $pagename = get_the_title();         $ispluginpage = $wpdb->get_var("SELECT plugin_page FROM {$wpdb->prefix}posts WHERE post_title = '$pagename'");              if ($ispluginpage == 1) {             return plugin_dir_path( __FILE__ ) . 'includes/plugin-template.php';         }              return $template;               }


title: Get section of input passed to the sanitize_callback

text: How can I find out what section each input is in when viewing the `$input` array passed to the sanitize_callback function defined in `register_setting()`? I suppose one option is to include the section as part of the field name and can then extract it. E.g. `name="section^field"` and then in the sanitize_callback:               foreach($input as $name => $val) {         $parts = explode('^', $name);         $section = $parts[0];         $field = $parts[1];         // do more stuff here     }      But this feels a little hacky. Is there a better way?


title: How to add different CSS for galleries

text: I use jetpack carousel for all of my galleries , even for my featured image, my question is, how do I style my [gallery] outcome to use different CSS for the featured image so I can manipulate it a little bit but not mess with the regular default galleries outcome?


title: Page that 'subscribes' to multiple categories

text: I'm creating a website where I need to 'subscribe' client Pages to certain categories. For example: On example.com/client/johnson-co/ show all posts in the categories 'GST', 'Estate' and 'Tax General'. On example.com/client/smith-co/ show all posts in the categories 'GST', 'Insurance' and 'Personal'. I'm not at all attached to using Pages if there's a better way :) I do however need the categories 'subscribed' to to be editable using WordPress admin; not hard-coded into the theme. * * * I've researched and experimented with the following methods to no avail:   * Giving a category multiple parents (currently not possible in WP) - this would let me give category gst a parent of johnson-co and smith-co   * Using query_posts() and including cat=x (as per the codex) - this works but is hard coded and doesn't let someone subscribe a page to categories in the admin.   * Using custom post type (set up using CCTM plugin) so /client/johnson-co/ has checkbox meta fields of GST, Estate, Insurance, Personal etc. This is the closest but I couldn't get the link between what was checked and the categories showing working, and it feels like a bit of an ugly hack. Would hugely really appreciate any ideas!


title: Pass custom fields values to Google Maps

text: I am using this script on display google maps on my wordpress site:               <head>         <script>         function initialize()         {           var mapProp = {             center:new google.maps.LatLng(51.508742,-0.120850),             zoom:5,             mapTypeId:google.maps.MapTypeId.ROADMAP           };           var map=new google.maps.Map(document.getElementById("googleMap",mapProp);         }         </script>               </head>      I have set up two custom fields "fl_long" , "fl"lat" for the longitute and latitude. How do I modify the code above so that the values are taken from the custom fields instead of being hardcoded numbers?               google.maps.event.addDomListener(window, 'load', initialize);


title: Adding attachment file name to email link

text: I'm doing up a photography site where each post is a photo project, and each post attachment will be displayed on its own attachment page (linked to from the main post page). On the attachment page, I want to give an email link, below the image. At the moment, the code is something like this: `<a href="mailto:me@whatever.com?Subject=Image: <?php the_title(); ?> \- [FILE NAME HERE]">Get in touch about this image</a>` I want the subject of the email to include the _file name_ of the attachment (not title, not meta info, not attachment page URL). Is this possible? If so, how would I do it? Thanks.


title: Redirect from subdomain

text: I'm moving a Tumblr site to WP and need to deal with a redirect. I'm using the Redirection plugin. So, I need to redirect from http://blog.example.com > http://example.com To achieve this, do I need to actually host the site at blog.example.com and redirect from there? Or do I need to setup a dummy site at blog.example.com? Really have no idea how to tackle this at all. Suggestions very welcome! Update: Can this be achieved by adding a new vhost entry?


title: is_page() and is_page_template() not being differentiated

text:
I need to rearrange how my comments are displayed depending on the page template. My posts and standard pages are displayed in in the middle of the screen, and thus need to share the same comment layout. I then have a right sidebar page layout and so I need the comments pages with that template to be aligned to the left of the page. I am attempting to this like so               <?php if( is_single() || is_page()): ?>

     <?php else: ?>     <?php if(is_page_template('right-sidebar.php')) ?>

     <?php endif; ?>      However, my single stadard pages are taking the layout of the `html` under the second if condition. What am I misunderstanding about this?


title: How to make subcategory for custom post and and display?

text:
I've created a custom post with categories like books, foods, and make some sub-categories like in foods cat, pizza, fastfood. But when I display them in my side bar, it's showing same as sub category. Just like: > .books > > .foods > > .pizza > > .fastfood I want them to display like this: > .books > > .foods > > -pizza > > -fastfood Here is my code of functions.php               add_action('init', 'products_register');          function products_register() {         $labels = array(             'name' => _x('products', 'post type general name'),             'singular_name' => _x('Products Item', 'post type singular name'),             'add_new' => _x('Add New', 'products item'),             'add_new_item' => __('Add New products Item'),             'edit_item' => __('Edit products Item'),             'new_item' => __('New products Item'),             'view_item' => __('View products Item'),             'search_items' => __('Search products'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             //'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','thumbnail')         );               register_post_type( 'products' , $args );              register_taxonomy("productcategory", array("products"), array("hierarchical" => true, "label" => "Product Category", "singular_label" => "Product Category", "rewrite" => true));          }      Here is my code to display the category on my sidebar:               <?php          $taxonomy = 'productcategory';     $terms = get_terms($taxonomy); // Get all terms of a taxonomy          if ( $terms && !is_wp_error( $terms ) ) :     ?>
             <?php foreach ( $terms as $term ) { ?>
<a href="<?php echo get_term_link($term->slug, $taxonomy); ?>"><?php echo $term->name; ?>
             <?php } ?>
     <?php endif;?>


title: Creating a relationship between two post types

text: I want to build a TV series database using WordPress. I have followed some tutorials and I have two custom post types: one for `movies`, one for and `series`. I followed this post for the structure. My question is how can I make the relationship between the movies and series post types?


title: Error establishing a database connection - WordPress Multistage in Sub-Folder

text: I have a website running on my production server which I moved to localhost. The folder structure is as follow: localhost/xxx/main - Here are the website files. I have updates the database by changing all the url's to be localhost/xxx/main. My .htaccess looks like this :               RewriteEngine On     RewriteBase /xxx/main/     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]     RewriteRule . index.php [L]      wp-config.php has the following lines added :               /* Multisite */     define('WP_ALLOW_MULTISITE', true);     define('MULTISITE', true);     define('SUBDOMAIN_INSTALL', false);     define('DOMAIN_CURRENT_SITE', 'localhost');     define('PATH_CURRENT_SITE', '/xxx/main/');     define('SITE_ID_CURRENT_SITE', 1);     define('BLOG_ID_CURRENT_SITE', 1);     /* That's all, stop editing! Happy blogging. */      The problem I am having now is that I cant establish the connection to the database. Whenever I set up               define('MULTISITE', false);      the connection with the database is being established just fine. Any ideas please? Thanks Dom


title: Combining wp_current_user() and a variable

text: I want to match a custom field in a user's profile to a particular post the user might be on. So I've got the custom fields for user profiles setup, and they're all numeric. Then, if I'm on a post page, I want to check if that post's ID matches the custom field in their profile. Something like this, where the custom field in the user's profile is `badge-id-2000`               $current_user = wp_get_current_user();     $badge_ID = $post->ID;     if ($badge_ID == $current_user->badge-id-$badge_ID) {         return true;     }      Apparently on line 3 there where I'm using `badge-id-$badge_ID`, the variable doesn't work in that scenario. Is there some other way of doing this or getting the variable to work there?


title: Unable to access WP admin

text: I cannot access admin via: `http://xxxxxx.com/admin` or `http://xxxxxx.com/wp-admin` `Fatal error: Class 'ObjectModel' not found in /home3/xxxxxx/public_html/xxxxxxx.com/wp-includes/class.wp-dependencies.php on line 28` I have had a trojan on my website that will put own htaccess redirect stuff. And what is worse the WordPress version was up to date 3.5.1 and I have almost no plugins installed. File permissions were 644 and directories 755. How can it write to htaccess? What file permission should I set for htaccess? I am on a shared Justhost hosting.


title: Wordpress FTP via admin panel slow

text: I am trying to delete some plugins via the Wordpress admin panel. Sometimes it deletes the plugin quite quickly, but other times it hangs. I have access to my server, is there anything I can do to speed the performance up?


title: Custom forms with HTML

text: Will there be any issues with creating a custom form in the index page? Will I be able to get and post requests? It's a simple email validation form and once validated, the user will be able to download a file. Thanks


title: Shortcode in AJAX popup

text:
I am trying to use a shortcode from Ultimate Facebook plugin to display a FB connect button in an AJAX popup and can't seem to get it work properly. I searched and used the solution given by djb in this question - Why might a plugin's 'do_shortcode' not work in an AJAX request?, but it worked only partially. Ideally, I want a user to be able to sign in using FB and then save the list to her account. I want to use the plugin instead of embedding direct code because creates a new user in wordpress too when someone uses FB connect. Procedure to reproduce issue -   * Go to http://www.ajaymreddy.com/stg/country/india/#   * Click on Start   * Select any of checboxes - take care to not click on the text against the checkboxes    * Click on Save button in the popup If you are not logged in, the fb connect button should show up. However, only the shortcode text is currently showing up. **Code in functions.php** -               //From http://wordpress.stackexchange.com/questions/53309/why-might-a-plugins-do-shortcode-not-work-in-an-ajax-request     add_action( 'init', function() {       ps_register_shortcode_ajax( 'show_fblogin', 'show_fblogin' );     } );          function ps_register_shortcode_ajax( $callable, $action ) {       if ( empty( $_POST['action'] ) || $_POST['action'] != $action )         return;       call_user_func( $callable );     }          function show_fblogin(){             if (!is_user_logged_in())               echo do_shortcode('[wdfb_connect]');             die ();     }     add_action( 'wp_ajax_show_fblogin', 'show_fblogin' );     add_action( 'wp_ajax_nopriv_show_fblogin', 'show_fblogin' );      **Code in ajax file** -               $(document).on( 'click', '#saveBtn', function (){                 if (myAjax.loggedin==1)                 {                         jQuery.ajax({                         type: 'POST',                         url: myAjax.ajaxurl,                              data: {                                 action: 'save_whslist',                                 selected: selected.toString(),                                 whsNonce: myAjax.selectNonce,                         },                         success: function(data, textStatus, XMLHttpRequest){                                 selected = [];                                 modal.close();                                 $("input.whsites").prop('disabled', true);                                 $("input.whsites").prop('checked', false);                         },                         error: function(MLHttpRequest, textStatus, errorThrown){                                 alert(errorThrown+' fail');                         }                         });                 }                 else                 {                         jQuery.ajax({                         type: 'POST',                         url: myAjax.ajaxurl,                              data: {                                 action: 'show_fblogin',                                 selected: selected.toString(),                                 whsNonce: myAjax.selectNonce,                         },                         success: function(data, textStatus, XMLHttpRequest){                                 modal.open({content: "
Please login to save your travel list
No auto posts on your wall!
"+data});                         },                         error: function(MLHttpRequest, textStatus, errorThrown){                                 alert(errorThrown+' fail');                         }                         });                 }         });


title: What is the advantage of the wp_options design pattern?

text: As we all know, a design pattern that is used frequently in Wordpress' DB code is the idea of persisting data for a particular object (blog/post/comment), indexed with a particular name or key. We see this pattern used in the following standard tables:   * wp_options   * wp_commentmeta   * wp_postmeta As far as I can tell, the motivation for this design decision was to enable plugin/theme authors to persist data easily (e.g. by using custom fields) without having to modify the database schema. It would seem to me that there are few other advantages to this approach, since it is significantly slower and makes it harder to implement complex queries. What are the other advantages to this approach, if any? * * * UPDATE: Reading info on the drawbacks of this approach:   * http://stackoverflow.com/questions/126271/key-value-pairs-in-relational-database   * http://geekswithblogs.net/darrengosbell/archive/2006/03/12/KVPsInDatabaseDesign.aspx


title: Custom registration URL lost when user makes signup mistake

text: I've followed instructions found on this site and elsewhere on the internet intended to let me give certain people a registration link that will let them sign up with a specific user role. The user role I want to give to **some** , but not all people, is a custom one called "unmonitored". I have it working by adding this code to my functions.php file:                   // signup stuff         add_action('register_form','show_role_field');         function show_role_field(){ ?>         <input id="role" type="hidden" tabindex="20" size="25" value= "<?php if (isset($_GET['role'])) {echo $_GET['role'];} ?>"  name="role"/>         <?php         }              add_action('user_register', 'register_role');              function register_role($user_id, $password="", $meta=array()) {                 $userdata = array();            $userdata['ID'] = $user_id;            $userdata['role'] = $_POST['role'];                 //only allow if user role is my_role                 if ($userdata['role'] == "unmonitored"){               wp_update_user($userdata);            }         }      This means that if someone registers at **www.[mywebsiteurl].com/wp- login.php?action=register &role=unmonitored** they are given the user role "unmonitored" - which is perfect. But the problem is that if they mess up their registration by entering an email address that has already been taken or mis-typing their invitation code (I'm using a plugin called Easy Invitation Codes http://wordpress.org/plugins/baw-invitation-codes/) they are presented with an error on **www.[mywebsiteurl].com/wp-login.php?action=register** - the crucial **& role=unmonitored** disappears from the URL, the user completes their registration and they get assigned the default user role instead of the "unmonitored" one I need them to have. Can anyone help me stop the error page stripping &role=unmonitored from the URL? Happy to give any code needed, apologies if I've omitted any info - not yet hugely familiar with this side of Wordpress.


title: list first post of Child Category on Category page

text: This may be a bit overcomplicated but this is exactly what my client is asking for and if there is anyway to accomplish this task it would be much appreciated. I've found lots of examples of just listing the name of the subcategory, but we need to be able to actually output the content of the first post in each category. We have several Parent Categories, each with several subCategories. On the parent Category page we would like to list the first post (only) of each subCategory. We would also like to achieve this with some sort of "current category" code to avoid having to create a new template file each time a new category is added. Please let me know if this is not clear enough or if you need more information!


title: Set posts per page for parent category and it's all children

text: I am trying to use the following function to set the number of posts per page for a specific category and all it's children:               function hbg_category_query( $query ) {     if( $query->is_main_query() && $query->is_category()) {         if (is_category( '14' ) || cat_is_ancestor_of( 14, get_query_var('cat'))) {         $query->set( 'posts_per_page', 32 );         }     }     return $query;     }      It works for the parent category and it works if I specify the ID(s) of the child categories, but I am trying to catch all the child categories (even new ones). Can anyone clarify what I am misunderstanding about how this works? Thank you, Greg


title: Default featured image set as background image

text: I'm using the following code to set my post featured image as a `background- image`…               <?php if (has_post_thumbnail( $post->ID ) ):           $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );           endif; ?>      How can I add an else statement so if the post doesn't have a featured image it will use a specific image `/images/featured.jpg` for example.


title: How Can I Automatically Post Wordpress Posts to 2 Domains

text: I am setting up a travel website on both a .com and .uk domain using wordpress. I want to be able to share the posts across two domains, i.e. publish a post on domain.com and have it appear on domain.co.uk. The domains are localised for American and British English. On the American site the category page is for vacation rentals and on the British site (.co.uk) the posts are categorized as holiday rentals. How can I post on one blog and synchronize between the two while still keeping unique categories?


title: Save voting stats with Posts 2 Posts

text: I am working on a website where I make connections from posts to posts with the Wordpress Posts 2 Posts plugin. Now I want my website users can vote whether they think the 2 connected posts are a good combination. Normally I save this data in a custom field. But one post can be connected to several other posts and with all these posts I need to save the vote stats, so I cannot save it in one custom field. Does anyone have an idea how I can tackle this best. Using a custom database table, make a custom field for every connection with one post? Other suggestions? Please let me know. Thanks!


title: Custom query AFTER rss fetch_feed not working

text:
I'm trying to do a custom query after an rss `fetch_feed` but for some reason nothing shows up. The code I'm using to fetch the feed is:               <?php // Get RSS Feed(s)           include_once( ABSPATH . WPINC . '/feed.php' );                // Get a SimplePie feed object from the specified feed source.           $rss = fetch_feed( 'http://seko.se/feed.rss?rssId=97' );                if ( ! is_wp_error( $rss ) ) : // Checks that the object is created correctly                    // Figure out how many total items there are, but limit it to 3.                $maxitems = $rss->get_item_quantity( 3 );                     // Build an array of all the items, starting with element 0 (first element).               $rss_items = $rss->get_items( 0, $maxitems );                endif;         ?>
             <?php if ( $maxitems == 0 ) : ?>
<?php _e( 'No items', 'my-text-domain' ); ?>
             <?php else : ?>                 <?php // Loop through each feed item and display each item as a hyperlink. ?>                 <?php foreach ( $rss_items as $item ) : ?>
                         <a href="<?php echo esc_url( $item->get_permalink() ); ?>"                             title="<?php printf( __( 'Posted %s', 'my-text-domain' ), $item->get_date('j F Y | g:i a') ); ?>">                             <?php echo esc_html( $item->get_title() ); ?>
                           <time datetime="<?php the_date('Y-m-d'); ?>"><?php the_time(get_option('date_format')); ?></time>

                 <?php endforeach; ?>                 <?php wp_reset_query(); ?>             <?php endif; ?>
      And the query I'm trying to do after this is:               <?php       global $post;       $args = array(          'numberposts' => 2,         'post_type' => 'nyheter_cpt',         'category__not_in' => array( 157, 150 ),         );       $myposts = get_posts( $args );       foreach( $myposts as $post ) :  setup_postdata($post);     ?>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
           <?php the_excerpt(); ?>           <a href="<?php the_permalink(); ?>">Läs mer »

<time datetime="<?php the_date('Y-m-d'); ?>"><?php the_time(get_option('date_format')); ?></time>

<?php the_author(); ?>

            <?php endforeach; ?>     <?php wp_reset_query(); ?>      The query works just fine if I place it above the rss fetch_feed request, but as soon as I place it beneath it nothing shows up. Does anyone have a clue why?


title: Upload path/URL weirdness for the main blog of a multisite/network setup

text: We have a WP network (with domain mapping) that was started pre WP 3.5, so it was using `ms-files.php` and `wp-content/blogs.dir/` to store media files. I wanted to remove `ms-files.php` dependency and after doing some research started the process: I first tried not _moving_ any files from `blogs.dir/#/files` to `uploads/sites/#`, but to setup symlinks for that. Then I had some permissions issues so I just copied everything from `blogs.dir/#/files` to `uploads/sites/#`. Then I cleared the values for `upload_path`, `upload_url_path` and `fileupload_url` on each site. And finally updated/inserted `ms_files_rewriting = 0` in the `wp_sitemeta` table. Also added some rewrite rules to the `.htaccess` file to not have to deal with updating all URLs in DB. The main blog id in our setup is 2 and not the default which is 1: `define('BLOG_ID_CURRENT_SITE', 2);` As far as I know, and based on what I see in `wp_upload_dir()`, WP uses the root of the `uploads` folder for the main blog contents and `uploads/sites/#` for other blogs. So I have copied the content from `blogs.dir/2/files` to the root of the `uploads` folder and NOT to `uploads/sites/2`. Now here is the issue for media files on the MAIN BLOG: in the back-end, WP loads files from the `uploads` folder which is fine, but on the front-end it tries to load files from `uploads/sites/2` which doesn't exist and is weird! PS: I can just add another rewrite rule to have this fixed, but I really want to know what the reason is for `/sites/2` being added for the main blog.


title: Custom fields won't display on my blog page

text: I created a custom field called 'Page Description' which I use to create a custom title for each static page of my wordpress site. I use the code:               <?php echo get_post_meta(get_the_ID(),'Page Description',true); ?>      in my header.php. it displays in all of my pages except for my blog page. Can someone please help me figure this out? thanks. you can view the website here if it helps. www.tenspeedgreens.com


title: Post restoration

text: I backed up a version of my wordpress site which contains several posts. Lets call this website website A. I have a different website which also contains several posts. Lets call this one website B. Lets say I have a recent backup of website A, and I restore the contents of website A using a backup of website B. Is it possible to restore the posts contained in the backup of website A to the current state of website A (current state meaning restored with the backup of website B).


title: wordpress permalinks error 404

text:
i am new to word-press, i have made my own theme in wordpress but the problem that i am facing is the permalinks which are not working and showing me error 404 when my permalinks settings are at default it gives "The requested URL /wordpress/wordpress/about/ was not found on this server." else if any other it gives "Page not found. Perhaps try searching?" and with this the Post URL in the address bar is localhost/wordpress/wordpress/about/%E2%80%9Dhttp:/localhost/wordpress/wordpress/2014/07/23/added- second-post/ i have searched a lot on Google searched for different forums but no such help that could be useful kindly help me in solving this issue,               <?php $the_query = new WP_Query( ‘showposts′ ); ?>             <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
             <a href=”<?php the_permalink() ?>”><img src="<?php bloginfo('template_directory'); ?>/img/post-images/Adithi_Dinner_blog.jpg" class="border" alt="image" />
<?php the_title(); ?>

<?php echo substr(strip_tags($post->post_content), 0, 100);?>

             <?php endwhile;?>      this is the code that i am using to retrieve posts, it works fine but the link doesn't when i click on it, it shows page Page not found. Perhaps try searching? and the url in the address bar is localhost/wordpress/wordpress/blog/%E2%80%9Dhttp:/localhost/wordpress/wordpress/added- second-post/%E2%80%9D


title: Custom Link Not Registered as Nav Menu Parent

text: My issue is that I have a horizontal menu, with a few hashed - '#' - custom menu links to prevent users from going to empty pages (the main categories were just made pages for the link structure). Now the issue further is that in my attempt to create a select dropdown menu for mobile, I am using logic to see if a nav item is a child to another nav item, but my custom nav items are not being registered as parents. Is there a work around to this? To be specific: I need to find out which nav items are children and add dashes to them for a better user experience: ex:   parent   - child   -- 2 child


title: How to configure a child-post of a parent-post to have hierarchical sub-posts?

text: **Question** : What plugin or coding configuration needs to be implemented to create this child-post to parent-post hierarchical, many-to-many post relationship? **Goal** : To be able to create sub-posts of a post. To have ability to create child posts of the parent post. This would consist of a non-hierarchical (the parent) post type to hierarchical (child-posts) post types to have multiple parent-to-child relationships. **Concept** : Below is the concept that I am trying to achieve When I create 1 post, I can then attach/link that post to a parent post. Producing the same concept as “Child Pages”.   1. **Parent Post** : theme.dev/parent-post   2. **First Child Post** : theme.dev/parent-post/first-child-post   3. **Second Child Post** : theme.dev/parent-post/second-child-post   4. **Third Child Post** : theme.dev/parent-post/third-child-post **Research** : The following links list my current findings & what I have learned along the way. However, I have yet to find a concrete solution, or definitive answer:   1. **Post relationships** : Parent-to-child: justintadlock.com/archives/2013/10/07/post-relationships-parent-to-child   2. **Post to Post plugin** : wordpress.org/plugins/posts-to-posts/   3. **Custom Post Types as Taxonomies** : wordpress.org/plugins/cpt-onomies/   4. **Advanced Permalink Structures** : wordpress.tv/2013/08/24/matt-boynes-rewrite-recipes-exploring-advanced-permalink-structures-by-example/   5. **Source** : boyn.es/2013/08/10/wcpdx/   6. **Live Concept** : qualityforinnovation.com/    7. **Live Concept** : Many “wall paper” style websites Here’s what I know: List of my findings of what I have found may “seem” like it might work, however, is NOT a solution:   1. Post Connector: yoast.com/new-plugin-post-connector - This is simply a “manual related posts” plugin. The selling of this product seems like it does more than what it really is about.  **Example** : This is an example of the concept I hope to achieve. However, this example was done by customizing the “ **Attachment Page** ”. This site utilizes the original image in the “parent post,” thereby, creating a navigable attachment page as a child post, which is based on the attached image of the parent post.   1. **Home:** qualityforinnovation.com/   2. **Parent Post** : qualityforinnovation.com/small-home-floor-plans   3. **Attachment Page Child Post 1** : qualityforinnovation.com/small-home-floor-plans/small-house-flo or-plans-contemporary-home-designs-61248-4/   4. **Attachment Page Child Post 2** : qualityforinnovation.com/small-home-floor-plans/open-floorplans-large-house-find-plans-90117-4/ I'm looking for actual solutions that can be implemented. If anyone has actually done this successfully would be helpful, or point me to the right direction to be able to implement this solution based on the knowledge they have, combined w/ the information I have already provided. I've already been running in circles for 3 months.


title: Shortcode not showing $content in correct place

text:
I asked this elsewhere but I'm not getting very far with the answers, so thought I'd try here as it's specific to Wordpress. I have this shortcode:               function reytab($atts, $content = null) {         extract(shortcode_atts(array('title' => '#'), $atts));         return '
'.             '
'.                 $title.             '
'.             '
'.                 do_shortcode($content).             '
'.         '
';     }     add_shortcode('reytab', 'reytab');      And I'm calling it in my wysiwyg editor in Wordpress like this: ![Shortcode in wysiwyg editor](http://i.stack.imgur.com/Iqy0x.png) This is the markup that's generated from my shortcode and as you can see the `$content` is being rendered outside of the `.tab-content div`:

Title

     ...content appears here...[\reytab]      You can see that `[/reytab]` is being rendered as part of the `$content`, so I'm assuming my issue is something to do with either the shortcode, a conflict with a plugin (which it's not as I've deactivated all of them to test that) or a conflict in my theme (which I'm also assuming it's not as I tried this with TwentyEleven - although, as I'm using a child theme that relies on TwentyEleven, it's still possible it's a conflict I guess). Can anyone offer some advice on what I can try? I'm really lost as to what I can check. Thanks Osu


title: Do I have to use a Wordpress specific CSS reset, or is a normal, Eric Meyer style CSS reset fine?

text: The great starter theme _S for Wordpress has the following CSS reset included, which works pretty well I find: https://gist.github.com/4173728 But I prefer the Eric Meyer one, which I'm sure you're all familiar with. I find I run into problems with the _S one because I'll be wondering why something isn't reacting as it should do my styling, and I look, and the reset file has a 1.5em adjustment on something, or a float:left on another thing. Dealing with style I didn't input myself is the main reason I use CSS resets in the first place. BUT, my question stems from the fact that the _S reset CSS has these seemingly Wordpress specific aspects to it, like:               #searchsubmit {         display: none;     }      and               .assistive-text {         clip: rect(1px 1px 1px 1px); /* IE6, IE7 */         clip: rect(1px, 1px, 1px, 1px);         position: absolute !important;     }      So am I missing out on things by using on a non-Wordpress-specific CSS reset? Would I be better off just tailoring it to be more close to what I want?


title: Wordpress multisite subdirectory redirect infinite loop issue

text: Any time I create a new site on my multisite install, I get an infinite loop redirect when navigating to that site's admin. I'm using the default htaccess supplied by WP for my subdirectory install. Here's what I have:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) site/$2 [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ site/$2 [L]     RewriteRule . index.php [L]      FYI - My wp install is within a folder named 'site', and the issue is happening both on my local mamp install and on my hosting server. Here's the multisite info from my config file:               define( 'WP_ALLOW_MULTISITE', true );     define('MULTISITE', true);     define('SUBDOMAIN_INSTALL', false);     define('DOMAIN_CURRENT_SITE', APP_URL);     define('PATH_CURRENT_SITE', '/site/');     define('SITE_ID_CURRENT_SITE', 1);     define('BLOG_ID_CURRENT_SITE', 1);      I've spent the past 2 days googling, but to no avail. Here are a couple of solutions I've tried that didn't help:   * http://tommcfarlin.com/resolving-the-wordpress-multisite-redirect-loop/   * http://wordpress.org/support/topic/fresh-install-subfolder-multisite-infinite-redirect-loop-sub-blog-login Any help would be appreciated. I'm starting to get desperate :-/


title: The excerpt suffix won't go away

text: I want to show the post content until the more tag, or if there's no more tag than just first n words. Something really basic, right? Obviously I need to use get_the_excerpt function. But the problem is that this function is behaving strangely. It adds a suffix to the end, that nobody wants. And you can't remove it! You could in the past: http://www.wprecipes.com/how-to-remove-the-from-the- excerpt But this no longer works, because Wordpress decided to give us even more bad time with this by changing [...] to something like […] Now you can't even str_replace or rtrim that […]. Trust me I tried. The solution from here works, but this only cuts text after n words. It ignores the more tag. http://stackoverflow.com/questions/21340007/3-dots-at- the-end-of-the-excerpt-in-wordpress Another way would be to use get_the_content, but that just shows the full post content even if I select Summary in the Settings -> Reading. So please what am I missing here?


title: get_post_meta just returns Array

text: Here's what I am trying to do: I am trying to get one page in wordpress to pull data from custom fields in other pages. So that when a user creates a page and uses a particular custom field (in this case multiedit_Info), it will populate in the "target" page. Here's my code that I am working with:               <?php $item = get_post_meta($post->ID, 'multiedit_Info', false); ?>     <div id="info-col">     <?php echo $item; ?>     </div>      I am currently using a plugin that create content blocks by using custom fields. And I want to get it so that a user can just create a new page with the custom fields and then have it display in an array on another page. Not too sure if I am setting this up correctly or not. This is the first time I've ever used it so any help is appreciated. Thanks!


title: Restrict Capability of Administrator to Create, Edit and Delete Pages in Multisite

text: In my multisite installation, I need to restrict administrators from being able to create, edit, and delete pages. That is, I need all pages to be created/edited/deleted by superadmins while administrators continue to have all other default administrator capabilities except those three. The plugin User Role Scoper is not working for me and while I have seen this Q&A about removing an administrator capability, I am too new to coding to know how to modify this advice for this situation. Any guidance about how to proceed here would be most appreciated!


title: How to make nested custom post type slugs work

text: I'll try to explain how I want this to work, rather than what I've done so far, as nothing seems to work. I want 3 custom post types:   * Products   * Consumables   * Accessories with the following slugs:   * example.com/products/post-name   * example.com/products/consumables/post-name   * example.com/products/accessories/post-name Each of the post types will need a custom archive page, ie. actual page that can be edited by the user. Both accessories and consumables would need to be hierarhial, as I have sub- categories for both. I have considered using taxonomies for this, but that presents the same problem: I need an overview page that can be edited by the user (in the WYSIWYG editor), on the apropriate URL. I have currently done the overview pages as such example.com/products - is a regular page with name and slug: "products" example.com/products/consumables - is a product with name and slug: "consumables" ie. every overview page is situated in the root just above the appropriate post type, which is just so counterintuitive. To edit the consumables page, you go in to "products", not "consumables". My biggest problem is that if I just define the rewrite slugs as above, only one of the post types will actually work, seemingly a random one, but I guess it has something to do with rewrite priorities. For example, all Products pages will work, but none of the Consumables or Accessories pages will. Here's an example of the CPT code for the Product CPT:               register_post_type('product', array(         'label' => 'Products',         'description' => 'Product',         'public' => true,         'show_ui' => true,         'show_in_menu' => true,         'capability_type' => 'page',         'map_meta_cap' => true,         'hierarchical' => true,         'rewrite' => array('slug' => 'products', 'with_front' => 0),         'query_var' => true,         'supports' => array('title', 'editor', 'custom-fields', 'revisions', 'thumbnail', 'page-attributes'),         'labels' => array(             'name' => 'Products',             'singular_name' => 'Product',             'menu_name' => 'Products',             'add_new' => 'Add Product',             'add_new_item' => 'Add New Product',             'edit' => 'Edit',             'edit_item' => 'Edit Product',             'new_item' => 'New Product',             'view' => 'View Product',             'view_item' => 'View Product',             'search_items' => 'Search Products',             'not_found' => 'No Products Found',             'not_found_in_trash' => 'No Products Found in Trash',             'parent' => 'Parent Product',         )     ));      The two others, Consumables and Accessories, would be similar with the rewrite slug being 'products/consumables', or 'products/accessories' My hope is that I can fix this by making some custom rewrite rules that will override whatever is messing this up, but I have never tried that before, and I'm not sure that would be the solution. Thanks, Infernosaint


title: How to show permalink auto when type text in post tiltle?

text: My website when type text in post title, it's not auto show the permalink. It only show when me publish this post.How to do it ? Thanks everyone ![enter image description here](http://i.stack.imgur.com/idede.jpg) ![enter image description here](http://i.stack.imgur.com/pnC80.jpg)


title: How does WordPress generate URL slugs?

text: Is there a page somewhere that details exactly how WordPress generates slugs for URLs? I'm writing a script that needs to generate URL slugs identical to the ones WordPress generates.


title: Get video src array rtmedia BuddyPress plugin

text: I am using rtmedia plugin to upload media files in my BuddyPress site. I need to get the array of all the video file source in home page. How to achieve this?