title: Speed optimization of $wpdb->get_results

text:
I'm using this code to generate all my custom field values from all posts for custom field named "autor".               <?php $autor = $wpdb->get_results("SELECT meta_value AS autor FROM wp_posts, wp_postmeta WHERE post_status = 'publish' AND meta_key = 'autor' GROUP BY meta_value ORDER BY meta_value") ?>
     <?php foreach( $autor as $autori ) : ?>

<a href="http://simplynote.me/?s=<?php echo $autori->autor ?>"><?php echo $autori->autor ?>

     <?php endforeach ?>
      It works okey, but the problem is that it takes a couple of seconds more (like, the page is loading for 5-10 seconds) for server to load that particular page. Is there any way to optimize this request?


title: How to stop fatal error when loading theme template file directly

text: If one tries to load a theme template file directly, the following error message is displayed:               Fatal error: Call to undefined function get_header() in ...      and it goes on to list the full directory path to the wordpress install. This seems undesirable. How can I prevent it? Upon googling I found a suggestion to insert the following into wp-config.php:               error_reporting(0);     @ini_set(‘display_errors’, 0);      Oddly, it did not work when I tested it. Thank you!


title: Permalink changes gives me 404

text: Up til now, I've used `/%postname%/`. Now I have changed this to `/%category%/%postname%/`. I know WP does not recommended to use category / psotname, but it makes a lot more sense for users. Opening pages and posts work fine. What crashes are all my jQuery calls to jQuery.php file. The data is actually returned, but when trying to output the data, I get a 404 error. Data process:               **Fetch data**       Ajax request -> jQuery.php -> some.class.php -> database          **Return data**       database -> some.class.php -> json_encode($result) -> 404 error      Does anyone know how I can fix this problem? Do I have to change my `.htaccess` file? **Update** This is the .htaccess file               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      Error message: > "NetworkError: 404 Not Found - http://mysite.com/wp- > content/themes/mysite/include/jquery.php?instance=search&limit=25&term=ac" Respons tab in Firebug shows this:               [{"id":"221","value":"Acne","url_name":"Acne"},{"id":"7176","value":"Acne Jeans","url_name":"Acne+Jeans"}]      In this case I'm expecting a autosuggest answer. If I paste this URL directly in browser, I get the result on the screen, but i **also** get a 404 error message. This is a typical jQuery request:                     jQuery.ajax({             url: siteURL +"/wp-content/themes/mysite/include/jquery.php",             data: {               instance: 'addPerson',               name: 'Jon Doe',               age: '26'             },             dataType: 'json',             success: (function(data) {               showFeedback(data);             })           });


title: Wordpress stripping out BR tags, need assistance

text:
Im having a problem where WP for some odd reason is stripping out my BR tags. Ive looked online and have read a few solutions that people offered including the installation of TinyMCE advanced plugin and still....the same thing. The problem is that not matter what i do, even if i go to the html tab and manually insert a br tag, it isn't creating **any** space between content. The code im testing now is this below: The code that has this looks like this               this is sentence one
     this is sentence two

     this is sentence three       this is sentence four         which should appear like so               this is sentence one          this is sentence two               this is sentence three                this is sentence four       but when seen on WP front end, it shows like a long sentence. here is the link: http://tightlineinternetmarketing.com/mike- dev/thp2/?page_id=1930 Also on that page, whilst testing, you will see that the same code i put on that post, i hard coded it onto the page.php just to test. and the hard coded part appears as it should whilst the same code but generated from WP does not appear as it should. its driving me nuts. I even installed another version of WP on my local wamp environment and still the same problem. I've also tested code on W3C validator(s) (html/css) and no real errors (except 3 from the nav menu which are minor). Any help is GREATLY appreciated. EDIT* _*_ this is the post loop im using               <?php     if (have_posts()) : while (have_posts()) : the_post(); ?>

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

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

     <?php endwhile; endif; wp_reset_postdata(); rewind_posts(); wp_reset_query();   ?>


title: Receive error exception using xampp with wordpress

text:
I have this php function in xampp server using php 5.5, using a live server with php 5.3 I get no error. The error says > Fatal error: Uncaught exception 'Exception' with message 'String could not > be parsed as XML' in C:\xampp\htdocs\wordpresstest\wp- > content\plugins\Monetizer_Pro_Monetizer\Monetizer.php:910   >  Stack trace:   >  #0 C:\xampp\htdocs\wordpresstest\wp- > content\plugins\Monetizer_Pro_Monetizer\Monetizer.php(910): > SimpleXMLElement->__construct('')   >  #1 [internal function]: Monetizer->Commission_Junction(Array, '', > 'Commission Junc...')   >  #2 C:\xampp\htdocs\wordpresstest\wp-includes\shortcodes.php(273): > call_user_func(Array, Array, '', 'Commission Junc...')   >  #3 [internal function]: do_shortcode_tag(Array)   >  #4 C:\xampp\htdocs\wordpresstest\wp-includes\shortcodes.php(188): > preg_replace_callback('/[([?)(embed|...', 'do_shortcode_ta...', '[Amazon > keyword...')   >  #5 [internal function]: do_shortcode('[Amazon keyword...')   >  #6 C:\xampp\htdocs\wordpresstest\wp-includes\plugin.php(199): > call_user_func_array('do_shortcode', Array)   >  #7 C:\xampp\htdocs\wordpresstest\wp-includes\post-template.php(166): > apply_filters('the_content', '[Amazon keyword...')   >  #8 C:\xampp in C:\xampp\htdocs\wordpresstest\wp- > content\plugins\Monetizer_Pro_Monetizer\Monetizer.php on line 910 The function is               public function Commission_Junction($atts) {                 extract( shortcode_atts( array(                     'keyword' => '',                     'results' => '',                     'context' => '',                 ), $atts ) );                      $params = shortcode_atts(array(                     'keyword' => '',                     'results' => '',                     'context' => '',                 ), $atts);                 if ($params['context'] !== 'yes') {                     $linkcloakeroptions = get_option('LinkCloaker_Settings');                     $linkcloakerpath = $linkcloakeroptions['Main_Path'];                     if (file_exists($_SERVER['DOCUMENT_ROOT'].$linkcloakerpath.'/Monetizer_Pro_LinkCloaker/LinkCloaker.php')) {                         $LinkCloaker = new LinkCloaker();                         $LinkCloakerexist = true;                         $arv = $LinkCloaker->getFirstAvailablePage();                         $linkpage = $arv[0];                         $folder = $arv[1];                          $linkpage = $LinkCloaker->createPage($linkpage, $folder);                     }                 }                 $contextuallinkoptions = get_option('ContextualLink_Settings');                 $contextuallinkpath = $contextuallinkoptions['Main_Path'];                 if (file_exists($_SERVER['DOCUMENT_ROOT'].$contextuallinkpath.'/Monetizer_Pro_ContextualLink/ContextualLink.php')) {                     $ContextualLink = new ContextualLink();                 }                 if ($params['context'] == "yes") {                     return $ContextualLink->start("Commission_Junction", $params['results']);                 }                 else {                     $options = get_option('Monetizer_Settings');                     $monetizerpath = $options['Main_Path'];                     $cloak = $options['Commission_Junction_Link_Check'];                     $cDevKey = $options['Commission_Junction_API_Key'];                     $nWebSiteID = $options['Commission_Junction_Site_ID'];                     $cURL = 'https://product-search.api.cj.com/v2/product-search?';                     $cURL .= 'website-id=' . $nWebSiteID;                     $cURL .= '&keywords=' . $params['keyword'];                     $cURL .= '&records-per-page=' . $params['results'];                     $cURL .= '&page-number=' . '1';                     $cURL .= '&advertiser-ids=' . $options['Commission_Junction_Advertiser_Relationship'] . '&';                     $cURL .= '&serviceable-area=' . $options['Commission_Junction_Country'];                     if ($options['Commission_Junction_Low_Price'] != '') {                         $cURL .= '&low-price=' . $options['Commission_Junction_Low_Price'];                     }                     if ($options['Commission_junction_High_price'] != '') {                        $cURL .= '&high-price=' . $options['Commission_junction_High_price'];                      }                          $ch = curl_init();                     curl_setopt($ch, CURLOPT_URL, $cURL);                     curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                   'Authorization: ' . $cDevKey,                                   'User-Agent: "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 GTB6 (.NET CLR 3.5.30729)"'                                 ));                          curl_setopt($ch, CURLOPT_HEADER, false);                     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                          curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);                     curl_setopt($ch, CURLOPT_TIMEOUT, 10);                          $response = curl_exec($ch);                     curl_close($ch);                           //$xml = simplexml_load_string($response);                     $xml = new SimpleXMLElement($response);                     if ($LinkCloakerexist) {                         $linknumber = 0;                     }                     foreach ($xml->products->product as $item) {                         echo $item;                     }                     if ($xml) {                         if (isset($options['Commission_Junction_Products_Display_Heading'])) {                             $product .= "
".$options['Commission_Junction_Products_Display_Heading']."

";                         }                         $template = $options['Commission_Junction_Post_Template'];                        foreach ($xml->products->product as $item) {                             if ($options['User_Level'] == 'basic') {                                 $this_row = '

%title%
%price% from %merchantname%
%description%

';                             }                             else if ($options['User_Level'] == 'advanced') {                                 $this_row = $template;                             }                                  $link  = $item->xpath('buy-url');                             $link  = (string)$link[0];                             if ($LinkCloakerexist && $cloak == true) {                                 $LinkCloaker = new LinkCloaker();                                 $arv = $LinkCloaker->createCloakedLink($link, $linknumber, $linkpage, $folder, false, $options['Commission_Junction_Auto_Generated']);  // link complete with your aff ID                                      $link = $arv[0];                                 $linknumber = $arv[1];                                 $linknumber++;                             }                             else {                                 $link = $link;                             }                                  $title = $item->xpath('name');                             $title = (string)$title[0];                                  $imgURL = $item->xpath('image-url');                             $imgURL = (string)$imgURL[0];                                  if ($imgURL == '') {                                 $imgURL = $_SERVER['DOCUMENT_ROOT'].$monetizerpath.'/Monetizer_Pro_Monetizer/images/noimage.png';                             }                             else {                                 $imgURL = $imgURL;                             }                                  $price = $item->xpath('price');                             $price = '$'.number_format((float)$price[0],2,'.',',');                                  $merchantname = $item->xpath('advertiser-name');                             $merchantname = (string)$merchantname[0];                                  $description = $item->xpath('description');                             $description = (string)$description[0];                                  $adid = $item->xpath('ad-id');                             $adid = (string)$adid[0];                                  $advertiserid = $item->xpath('advertiser-id');                             $advertiserid = (string)$advertiserid[0];                                  $advertisername = $item->xpath('advertiser-name');                             $advertisername = (string)$advertisername[0];                                  $advertisercategory = $item->xpath('advertiser-category');                             $advertisercategory = (string)$advertisercategory[0];                                  $catalogid = $item->xpath('catalog-id');                             $catalogid = (string)$catalogid[0];                                  $currency = $item->xpath('currency');                             $currency = (string)$currency[0];                                  $instock = $item->xpath('in-stock');                             $instock = (string)$instock[0];                                  $isbn = $item->xpath('isbn');                             $isbn = (string)$isbn[0];                                  $manufacturername = $item->xpath('manufacturer-name');                             $manufacturername = (string)$manufacturername[0];                                  $manufacturersku = $item->xpath('manufacturer-sku');                             $manufacturersku = (string)$manufacturersku[0];                                  $retailprice = $item->xpath('retail-price');                             $retailprice = (string)$retailprice[0];                                  $saleprice = $item->xpath('sale-price');                             $saleprice = (string)$saleprice[0];                                  $sku = $item->xpath('sku');                             $sku = (string)$sku[0];                                  $upc = $item->xpath('upc');                             $upc = (string)$upc[0];                             $replace_array = array(                                     '%link%' => $link,                                     '%title%' => $title,                                     '%imgURL%' => $imgURL,                                     '%price%' => $price,                                     '%merchantname%' => $merchantname,                                     '%description%' => $this->DescriptionLength($description),                                     '%adid%' => $adid,                                     '%advertiserid%' => $advertiserid,                                     '%advertisername%' => $advertisername,                                     '%advertisercategory%' => $advertisercategory,                                     '%catalogid%' => $catalogid,                                     '%currency%' => $currency,                                     '%instock%' => $instock,                                     '%isbn%' => $isbn,                                     '%manufacturername%' => $manufacturername,                                     '%manufacturersku%' => $manufacturersku,                                     '%retailprice%' => $retailprice,                                     '%saleprice%' => $saleprice,                                     '%sku%' => $sku,                                     '%upc%' => $upc,                                 );                                 foreach($replace_array as $search => $replace) {                                     $this_row = str_replace($search, $replace, $this_row);                                 }                                  if($link != "") {                                 $product .= $this_row;                             }                        }                              if ($product == '') {                          }                         if ($cloak == true) {                             $LinkCloaker->createCloakedLink($link, $linknumber, $linkpage, $folder, true, $options['Commission_Junction_Auto_Generated']);                         }                         return $product;                     }                 }             }      Why do I receive this error? And what do I do to fix it. Thanks.


title: contact form 7 :create shortcode usable in email message

text: i have this (test ) function that adds a redirection bouton                 function bouton($atts, $content = null) {          extract(shortcode_atts(array(                  'lien' => '#',                  'couleur' =>'bleu'                  ), $atts));          return '' . do_shortcode($content) . '';         }      this lines below allows the shortcode                     [bouton couleur="orange" lien="http://codex.wordpress.org/Shortcode_API"]L'API Shortcode WordPress[/bouton]      to work in contact form7 editor :                       function shortcodes_in_cf7( $form ) {             $form = do_shortcode( $form );             //place my short code below to work within contact form 7             add_shortcode('bouton', 'bouton');             return $form;         }         //line below to place ds form :         add_filter( 'wpcf7_form_elements', 'shortcodes_in_cf7' );      i have replaced this filters by                           //add_filter( ' wpcf7_mail_components', 'shortcodes_in_cf7' );         //add_filter( ' wpcf7_mail_tag_replaced', 'shortcodes_in_cf7' );         //add_filter( ' wpcf7_display_message', 'shortcodes_in_cf7' );      to try and make it working in the email message with no succes . What would be the filter to use?


title: Issues creating a tinyMCE plugin that creates a custom link

text: I'm working on a plugin that works similar to the "link" button on tinyMCE: The user highlights text -> presses a button -> enters text into a box in a thickbox popup -> submits the form -> the user is then returned to the editor with the highlighted text altered. The highlighted text has a generated url as a link and an added class. I've got the button in tinyMCE and when clicked the thickbox popup shows with my form. However, when submitted, nothing happens. The form submits but the window doesn't close and highlighted text isn't made into the link. I'm looking at wplink.js located in the folder "/wp-includes/js/wplink.js" as a rough basis but it doesn't seem to work. Any help is appreciated. Here is what I have thus far. Note: google.com is used as the test url for this example.               jQuery(document).ready(function($){              (function() {             tinymce.create('tinymce.plugins.addTC', {                      init : function(ed, url){                     ed.addButton('addTC', {                     title : 'Insert Product Link',                     cmd: 'addTC_Link',                     image: "/wp-content/plugins/addtc/img/shopping_basket.png",                     onclick: function() {                             tb_show( 'Insert Product Link', '/wp-content/plugins/addtc/addTC_link.php?&height=300&width=600&TB_iframe=true' );                         }                     });                     $('#addTC_link-submit').click(function(e){                         e.preventDefault();                         var selected_text = ed.selection.getContent();                         alert(selected_text);                         var return_text = '';                         var targetURL = "http://www.google.com";                         return_text = '' + selected_text + '';                         ed.execCommand('mceInsertContent', 0, return_text);                         tb_remove();                     });                 }             });                  tinymce.PluginManager.add('addTC', tinymce.plugins.addTC);              });          });


title: Get categories of queried posts

text: I queried posts from an array of IDs:               $args = array(         'post_type' => 'post',         'post__in' => $ids,         'orderby' => 'id',         'order' => 'DESC'     );      Now I want to display a form with checkboxes for the categories of these queried posts. For example if there are two posts from the category "Drama" I dont want the "Comedy"-Category-Checkbox to be displayed. The problem: As there is no post__in parameter for get_categories, I have no idea, how I can do this.               $catargs = array(         'post__in' => $ids,     );          $categories = get_categories(  $catargs  ); ?>


title: comment_date() & comment_time() not working from functions.php

text:
I use the following function to get the latest comment for each one of my posts and display it on archive and index pages under the post content:               function kv_latest_comment($post){              $args = array(                 'status' => 'approve',                 'number' => '1',                 'post_id' => $post->ID, // use post_id, not post_ID                   );                 $comments = get_comments( $args );             if($comments){             foreach($comments as $comment) :             if($comment->comment_type != 'pingback' and $comment->comment_type != 'trackback') : ?>

<?php echo get_avatar($comment,$size='64'); ?>

                   <a href="<?php echo site_url().'/author/'.get_the_author_meta( 'user_login'); ?>" title=""><?php printf(__('%s'), get_the_author_meta( 'user_login')) ?> on <?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?><?php edit_comment_link(__('(Edit)'),'  ','') ?>

                   <?php echo($comment->comment_content); ?>

     <?php             endif;             endforeach; }     }      I call the function like so in my post template:               <?php kv_latest_comment($post); ?>      When calling the function from functions.php comment_date() and comment_time() return nothing. But if I paste the code from the function into the template it works as expected... Why don't the functions return any values when called from the functions.php?


title: Meta Box by Rilwis, Load metabox on all page templates EXCEPT the homepage

text: Using Rilwis' Meta Box plugin for custom metaboxes, is there a way that I can load a metabox on all page templates _except_ `template-home.php`?               'only_on' => array(         'template' => array( 'template-home.php' ),     ),      I tried adding `!` before it but it didn't work.


title: Adding content to a taxonomy metabox

text: I want to add some custom content to the default metabox for a custom taxonomy. Ideally I'd be able to insert this content above the tag cloud where it says **_Choose from the most used [tag]s_**. Is there a "best practice"-compliant way to do this in Wordpress? For example, is there a way to do this _without_ removing and re-adding a clone of the taxonomy metabox, which is the method I've seen recommended for similar situations on WPSE and elsewhere? That seems like a bit of a blunt approach in this case. I know I can insert the content with javascript, or use a separate metabox, but I'm wondering if there's a hook for this sort of task.


title: Plugin for wikipedia style references in WP?

text: I find inline links offputting to read so want to use wikipedia style foot-of- article references with incremental numeric linking to the external link reference. I can just stick the HTML in but on the off chance is there any plugins on WP for semi-automating the process?


title: Superfish and WordPress: Active Color Problem

text: Take a look at: http://www.themeforward.com/demo2. When I hover over a menu item with a sub-menu, like 'Templates', and mouse over sub-menu items the background color stays the same as it should... but the hover color of the text does not. How do I make the font color remain the same while scrolling through the sub- menu? I've Googled all over for this and can't find a solution. The Superfish site does not provide sample CSS for this issue and provides no answer on the matter. **I usually wouldn't post this as a question here since it is a CSS question, but I believe it may also be related to a WordPress' current category feature.** The background color is achieved with this CSS, but the font color is not behaving in the same manner:               .sf-menu > li:hover, .sf-menu > li.sfHover,     .sf-menu > li a:focus, .sf-menu > li a:hover, .sf-menu > li a:active {         background:     #CFDEFF;         color:          #222;         outline:        0;     }      Below you will find the entire CSS:               .sf-menu {         z-index: 900;         font-size:13px     }     .sf-menu a, .sf-menu a:visited  { /* visited pseudo selector so IE6 applies text colour*/         padding: 5px 10px;         color:          #FFF;         text-decoration:none     }     .sf-menu li {         margin:20px 0 0 20px;         z-index: 900     }     .sf-menu li li {         z-index: 900;         margin:0;         padding:0;         background:#DDD;     }     .sf-menu li li li {         background:     #DDD;         margin:0;         z-index: 900     }     .sf-menu > li:hover, .sf-menu > li.sfHover,     .sf-menu > li a:focus, .sf-menu > li a:hover, .sf-menu > li a:active {         background:     #CFDEFF;         color:          #222;         outline:        0;     }          .sf-menu .current-post-ancestor a, .sf-menu .current-menu parent a, .sf-menu .current-page-ancestor a, .sf-menf .current-category-ancestor a, .sf-menu .active_category a, .sf-menu .current-menu-item a { color:#000 }          ul .sub-menu { border:1px solid #DCDCDC }     ul li .sub-menu a { color:#666!important; font-weight:normal; font-size:11px; padding:5px!important }     .sf-menu > li li:hover, .sf-menu > li li.sfHover,     .sf-menu > li li a:focus, .sf-menu > li li a:hover, .sf-menu > li li a:active {         background: #EEE     }


title: Creating a website with EVENT post type and PAGES as subpages of those EVENTs

text: Basically what I want is to create an EVENT post type. So people can put in a date and time of the event. (I've got this far... this is fine). The bit that I can't seem to figure is now I want to be able to make pages as SUB PAGES of that meeting. I'm not really bothered how I do this to be honest, although I figured the easiest way would be to somehow extend the functionality of the standard wordpress pages to allow for EVENT posts to be their parents. Each event will have the same sub pages, so each one will have "Venue, Travel, Agenda" etc. Is there any way to do what I suggested, or perhaps a better way to get this functionality that I'm missing? Thank you.


title: Post author is changed to admin after his post is modified by admin

text: I am writing a plugin which will enable to write posts from front-end. Those posts have to be checked by admin before published. Now if admin edits the post or publishes the post, the post author is changed from the original author to admin. How can I prevent that?


title: How do I format the date in Event Organizer?

text: I would like to format the dates to be June 17, 2012 11:00am as opposed to the 17 June 2012 11:00am that Event Organizer outputs.


title: get post count for related author

text: I'm trying to use the code below to obtain the number of custom posts the author of a post has published.               function count_user_posts_by_type( $userid, $post_type = 'artistblog' ) {     global $wpdb;          $where = get_posts_by_author_sql( $post_type, true, $userid );          $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );          return apply_filters( 'get_usernumposts', $count, $userid );      For example I'm outputting a loop of custom post types. Next to each post title I'm displaying the author of the post using a similar get_related_author function. I also want to display the number of posts this author has published. I assume I just need to replace $userid with the_author_meta() somehow but haven't managed to get it working. Am I even approaching this in the right way? Thanks D


title: Outputting Canonical Resource URLs Across a Multisite Network?

text: Say a theme _"foo"_ is used on across a network of sites. In each site, all the theme resources (`.css`, `.js`, etc.) will have distinct URLs:   * http://network/siteA/wp-content/themes/foo/style.css   * http://network/siteB/wp-content/themes/foo/style.css   * http://network/siteC/wp-content/themes/foo/style.css I want these to all be:   * http://network/wp-content/themes/foo/style.css What's the best way to do this? I can fix URLs directly output in the theme, but how do I normalize the URLs in enqueued scripts/stylesheets? > _Aside_ : What's the benefit of having expressions like > `get_bloginfo('template_url')` create URLs that differ across sites?


title: How to show taxonomy image instead of taxonomy name on a list

text:
I would like to show in a custom taxomony list icons instead of taxonomy name , but just for the ones with image asociated, where there is no image let show the taxonomy name . i have installed taxonomy-images plugin also , but it only adds the images , does not replace the taxonomy name. tnx this is the code i have in the archive{custom type}.php file               <?php query_posts( array( 'post_type' => 'custom_type','posts_per_page' => 20 ) ); ?>                                  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<article id="post-<?php the_ID(); ?>" <?php post_class( 'clearfix' ); ?> role="article">                                       <?php // end article header ?>     <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">

<?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.       the_post_thumbnail(thumbnail);     }      ?><a href="<?php the_permalink() ?>" class="title2" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>

 <?php // end article section ?>                                           <?php                                         printf( __( ' %4$s', 'bonestheme' ), get_the_time( 'Y-m-j' ), get_the_time( __( 'F jS, Y', 'bonestheme' )), bones_get_the_author_posts_link(), get_the_term_list( get_the_ID(), 'custom_cat', ' ', ' | ', '' ) );                                     ?>                                  <?php // end article footer ?>

 <?php // end article ?>                                  <?php endwhile; ?>


title: How to remove featured images from posts

text: Somehow my theme doesn't recomend featured images. That being said, how can i remove featured images from posts?


title: Edit Comments Form in TwentyEleven

text: Is there a way I can edit / change the layout of the comments form (leave a reply form) in the TwentyEleven theme? I want to put the textarea on top and I can change the styles via css but physically moving the forms is where I'm having trouble. I'm not sure where to find the code for it. tl;dr Where's the comments form code?


title: how to use $wpdb->prepare to update a custom table

text: As a noob I dont understand a lot of SQL injections but I need to be save so I have read that I have to use wpdb->prepare to make sure the data is stored correct. At this moment I use the $wpdb->update() query so I need some help to transform this into an save query with $wpdb->prepare().               $wpdb->update('custom_table',         array(         'option_1' => 'hello',          'option_2' => 2,         'option_3' => 'world'         ),         array('option_name' => 'some name'),         array('%s','d%','%s')     );


title: Memory issues - Fatal error: out of memory - plugins?

text: My problems with my site continue. I got timeout errors initially. The server ground to a halt, very high memory use by Apache. Site came back with no pages. I found that deleting the most recent post in wp_posts brought the site back up. Sysadmin pointed out high cpu use by apache but this may be a red herring, the memory not cpu is an issue. It seems that when user uploads a file, the memory used by Apache goes through the roof eventually bringing the site down. The files aren't that large so it's not php upload_max_filesize causing it. I suspect the problem is being caused by a plug-in. the plug-ins I have are:   * contact form 7   * contact form to db extension   * enable media replace   * health check   * Relevannsi   * Simple expires   * User access manager   * Category posts   * breadcrumb trail   * configure SMTP Does anyone know of any issues with any of these, or does an issue with plug- ins sound like a likely cause? I get Fatal error: out of memory error now. User told me it went when he tried to upload file.


title: Google Maps with categories

text: i'm looking for plugin that could help me make multiple markers on google maps and multiple categories. This plugin would be great but i need better Categories manager. For example   1. |Restaurant   2. |--Vegetarian   3. |--Vegan   4. |Hotels   5. |--5-star   6. |--4-star Also i need ability to chose which categories map will show. Thanks for all answers.


title: Get title of custom fields created by "Types" plugin

text: Dealing with a large website I have more than 10 custom post types, around 400 custom fields for totally dynamic site grouped in 200 categories created with "Types WordPress plugin" But when I am displaying data, i am using,               $custom_fields = get_post_custom();      and by using this i am getting the sulg of custom field and the value. That means if my custom field name is "`Bearing Code`", i am getting '`wpcf- bearing-code`' and the value for it. Is there any function to get the title of custom field created by types plugin, i.e.               function_name(wpcf-bearing-code)      would return me the value "Bearing Code".


title: Showing option when page is frontpage

text: Currently I'm having some difficulties with below snippet. As it currently works it shows `the_excerpt_rss` on a single post and single page. AND it shows the option on `is_home()`. But what if a page (instead of the 'blog') is the frontpage? If possible I'd like to include the option as well. I've tried several versions of including `is_front_page()` but without any luck thus far. The snippet I'm currently using:               <?php if (is_single() OR is_page()): if (have_posts()): while (have_posts()): the_post(); ?>         <meta name="description" content="<?php the_excerpt_rss(); ?>">     <?php endwhile; endif; elseif (is_home()): ?>         <meta name="description" content="<?php $options = get_option('schema_theme_options'); echo $options['metadescription']; ?>">     <?php endif; ?>


title: WP_MAX_MEMORY_LIMIT in wp-config.php seems to be ignored

text: I am using **WordPress v.3.8.1** with WMPL (WordPress Multilingual Plugin) v.3.1.4 and WPML Media Pugin v.2.1.3. In php.ini file I have...               memory_limit = 512M      I already have a info.php file with `<?php phpinfo(); ?>` where I can see that `memory_limit = 512M`. In wp-config.php file I have before wp-settings.php inclusion...               define( 'WP_MAX_MEMORY_LIMIT', '384M' );      When I am trying to use "Media Translation" I get this error after 50/400 media have been processed...               Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 523800 bytes) in /wp-includes/plugin.php on line 1939      Any suggestions?


title: Populating a form with SQL queries

text: Being a 'learning by example' kind of guy, I've populated a form using this code;                   <?php         $meta_key1 = 'area';         $postids = $wpdb->get_col( $wpdb->prepare(       "      SELECT      key1.post_id      FROM        $wpdb->postmeta key1      WHERE       key1.meta_key = %s      ORDER BY    key1.meta_value+(0) ASC      ",          $meta_key1         ) );          ?>              <form action="" method="post" name="advanced-search-form">         Area: (select)         <select name="area">         <option> Select area...</option>         <?          if ( $postids )          {             foreach ( $postids as $id )              {                 $post = get_post( intval( $id ) );                 setup_postdata( $post );                 ?>                 <option><? the_field($meta_key1) ?>                 </option>                 <?php             }         }         ?>         </select>         </form>      to populate one dropdown from a direct SQL query of custom fields. I have several custom fields. I want the dropdowns to only list values that exist. questions;   1. I could repeat this in a brute force kind of way but I am guessing there is a more compact method of extracting the different meta_key arrays   2. The method above is finding posts rather meta_values so I can't get populate than one dropdown using this method. What should I use to get the lists of used values.    3. My ignorance but I don't understand the use of key1 in the code above - as I say I am learning by example


title: Difference between is_user_logged_in and $_session['uname']

text: I am writing a condition to check if a user is logged in, not sure which of the below condition to use :                if(!is_user_logged_in()){         And                if(!isset($_SESSION['uname'])){      Basically need to check if any user is logged in.


title: Custom Post Type Implementation

text: I have been working hard to implement few custom post types for making a job board in hybrid news. So far, I have created custom post type- Jobs, created a page template http://pharmastudent.net/jobs for displaying jobs which is place in the parent theme. If I understand the custom post types correctly, I have to create a single- job.php correct? Rightnow, the singular.php is modified how an individual job should be displayed http://pharmastudent.net/Jobs/manager I was made aware that modifying singular.php is not the correct way, instead a single-job.php should be created.. Could anyone help me create the same and let me know where it has to be filed? Thanks much in anticipation. Naveen


title: How can I add authors in WordPress and assign them a picture?

text: I know that Wordpress allows us to create a new user and the user's avatar is got from Gravatar service base on their email. How can I add authors in WordPress and assign them a picture (without using Gravatar service ) ? Thank you ! P/S: I am sorry for my bad English. :)


title: Need help with adding jQuery script to WP and calling script to page

text: I've written a pretty simple jQuery script, and I don't know how to call it. It's in its own directory. First, how do I register it, and then how do I enqueue it? I assume that's the order it's done in, and that registering it basically means that it's available for use, and that enqueuing it applies it. I know that I have to add code to `functions.php`, but not sure exactly what. I've read a few things that haven't made it any clearer. For instance, WP.org says if I want to use Google's jQuery library, then I should deregister WP's install. Someone on this forum says don't deregister it. Using WP's version is fine, so this is what I have in `functions.php`:               <?php     function my_scripts_method() {         wp_register_script( 'jquery' );         wp_enqueue_script( 'jquery' );     }              add_action('wp_enqueue_scripts', 'my_scripts_method');     ?>      I also don't know how to call it on a page. What code, specifically, would I add to the page's WYSIWYG to get the script to work? Here's what I have on the page now:               <?php wp_register_script( $resize_fade.js, $http://www.mysite.com/subdirectory/wp-content/js/, ); ?>


title: Wordpress database nonsense error

text: I'm very confused. What i did was change my hostfiles so i can access my website on an alternative website and checked it in case i had hardcoded values (i did and they were corrected). I had to use the defines below to get the check to work               define('WP_HOME','http://example.com');     define('WP_SITEURL','http://example.com');      Anyways, after i checked everything i did some select queries in my db (confirmed by looking at history). When i undid the define and change my host files back so my original url isnt poiting to home i tried visiting my wp site and i got "Error establishing a database connection". copied pasted the login data into mysql -u name -p (pass) and i was able to log in... i dont know why wp cant login. I tried reseting my server, mysql server and php-fastcgi. All didnt fix it :(. How do i fix this?


title: nav-menu-template and columns in sub menu

text:
I am trying to use the wordpress menu setup and have a working horizontal menu with a drop down submenu. Unfortunately the sub enu is quite long so I wanted to split it into columns I can do it if I hardcode the menu into header.php but that means I have to add new items rather than letting the client do it. This is a parred down version of what I am trying to achieve

home

About Us

Services

Products

Terms

Privacy Policy

Staff

Vacancies

clients

media centre

contact us

site map

      So what I need to do is to be able to loop through the child items and add in the etc as necessary. Any tips, advice or anyone done this before?? TIA


title: Unable to load stylesheet via wp_enqueue_style

text: I am using this               <?php// Load the theme stylesheets     function theme_styles() {               // Load all of the styles that need to appear on all pages         wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' );          }     add_action('wp_enqueue_scripts', 'theme_styles');     ?>      to add a stylesheet in my theme, but it's not loading the stylesheet


title: Get post id on click of thumbnail

text:
I am a little lost so I apologize if this question is vague and not organized well. I currently have a grid of thumbnails populated via Wordpress. I retrieve them by getting all the posts in a category and getting their thumbnails. I now want it so when you click on the thumbnails it pulls up the body of the post in a text box I have on the same page as the grid. I am looking for someone to point me in a direction as to how I get the post id when I click the post and then how I load the text box with the body text from that id. GRID OF THUMBNAILS:               foreach  ( $categories as $category ) {       $i = -1;       echo '

' . $category->name . '

';       $args = array( 'posts_per_page' => -1, 'cat' => $category->term_id );       $cat_posts = new WP_Query($args);       if ( $cat_posts->have_posts() ) : while ( $cat_posts->have_posts() ) :         $i++;         $cat_posts->the_post();         $face = get_field( 'face' );         $name = get_field( 'fullname' );         if ( $i % 6 == 0 ) echo '
';         echo '
';         echo '
';         echo wp_get_attachment_image($face);         echo '

' . $name . '

';         if ( ($i % 6 == 5) || $i == ($cat_posts->post_count - 1) ) echo '
';       endwhile; endif;     }     wp_reset_postdata();     ?>      _**UPDATED FOR POST BELOW_** //index
this is my bio

                                           <?php the_title(); ?>

                    <?php     $categories = get_categories( 'child_of=2' );           foreach  ( $categories as $category ) {       $i = -1;       echo '

' . $category->name . '

';       $args = array( 'posts_per_page' => -1, 'cat' => $category->term_id );       $cat_posts = new WP_Query($args);       if ( $cat_posts->have_posts() ) : while ( $cat_posts->have_posts() ) :         $i++;         $cat_posts->the_post();         $face = get_field( 'face' );         $name = get_field( 'fullname' );         if ( $i % 6 == 0 ) echo '
';         echo '<div class="obj" data-id="<?php the_ID(); ?>">';         echo '
';         echo wp_get_attachment_image($face);         echo '

' . $name . '

';         if ( ($i % 6 == 5) || $i == ($cat_posts->post_count - 1) ) echo '
';       endwhile; endif;     }     wp_reset_postdata();     ?>

      //functions               add_action('wp_ajax_select_face_post', 'select_face_post');     add_action('wp_ajax_nopriv_select_face_post', 'select_face_post');     add_action('wp_enqueue_scripts', 'faces_posts_scripts');          function select_face_post () {       error_reporting(0);       if ( ! isset($_POST['postid']) || ! intval($_POST['postid']) ) die();       if ( ! isset($_POST['nonce']) || ! wp_verify_nonce($_POST['nonce'],'postface') ) die();       $post = get_post($_POST['postid']);       if ( empty($post) || ! is_object($post) ) die();          header('Cache-Control: no-cache, must-revalidate');       header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');       header('Content-type: application/json');       echo json_encode( $post );       die();     }          function faces_posts_scripts() {       // replace 'all_faces' with the slug of page in which resides the code you posted       if ( is_page('team') ) {          wp_register_script( 'postface', get_template_directory_uri . 'Team/postface.js', array('jquery'), NULL, true );              $url = admin_url('admin-ajax.php');         $nonce = wp_create_nonce('postface');         wp_localize_script( 'postface', 'postface_vars', array('ajaxurl' => $url, 'nonce' => $nonce) );         wp_enqueue_script( 'postface' );       }     }      //js               // postface.js     jQuery(document).ready(function($) {       $(document).on('click', 'div.obj', function() {         var selectedpost = $(this).data('id');         if ( selectedpost > 0) {            $.ajax({             type: "POST",             url: postface_vars.ajaxurl,             dataType: 'json',             data: { action: 'select_face_post', nonce: postface_vars.nonce, postid: selectedpost }            }).done( function(data) {             if (data.post_content) {               // var id =  data.ID;               // var title = data.post_title;               $('#PersonBio').html(data.post_content);             }           });         }       });     });      ![enter image description here](http://i.stack.imgur.com/L3a1E.png)


title: Extending WP_List_Table seems getting wrong with $this->get_columns() - what's wrong?

text: I'm trying to implement an Admin Table for a view page of a plugin of mine by following the following tutorial:   * **Create Native Admin Tables In WordPress The Right Way**      by _Jeremy Desvaux de Marigny_      SmashingMagazine.com Here's how I extended the `WP_List_Table` class for my plugin. (Code at Pastebin) The problem is: it's not showing any Column or Row, only the Table Top and Bottom. I did `var_dump()` steps, and found that in **Line 149** the `var_dump($columns);` is showing empty.      ![Extended List Table](http://i.stack.imgur.com/O3TCv.png) WHAT AM I DOING WRONG ABOUT THIS PORTION?               /* -- Register the Columns -- */     $columns = $this->get_columns();     $_wp_column_headers[$screen->id]=$columns;


title: Child Category Image

text:
I have some code that display's the titles of my child category posts on one of my pages:               <?php         $parent = get_cat_ID("photos");         $cats = get_categories('child_of='.$parent);         foreach ($cats as $cat) {             echo "
";             echo sprintf("
%s
", get_category_link($cat->term_id), apply_filters("get_term", $cat->name));             echo "
";     } ?>      Is there a way to also post a random featured image from the child category posts? I'm pretty sure I can use this existing code, just not sure what to change to make it work. Thanks,   Josh


title: Plugin capabilities

text: I created an interface that allows users to do a certain number of actions, each of them having a capability associated (including accessing the interface). I would like to have a base capability (primitive here?) that is required to have if a user wants to preform all of the other actions: if the user can delete an item, the user must also be able to access the interface. Several plugins allow to add/remove capabilities: I would like to prevent the case when a user can delete but cannot access the interface from happening. I understand that with post types and meta capabilities and map_meta_cap filter - I am having a hard time to apply that to my plugin, though. I could check both all the time, but the permission hierarchy will eventually be more complex (say, 3 levels - user must have the capabilities access_interface, create_item and create_typeX_item to be able to create an item of type X) so it sounds silly to duplicate code all over the place instead of just checking one capability (in my example: create_typeX_item). I am NOT dealing with a custom post type, and it isn't an option, so I don't know if the use map_meta_cap filter is relevant in this case, and if so I don't know how to use it. Any suggestions?


title: wordpress paginate, link to the right page

text: I have posts that I paginate, instead of showing them on their single post page I would like to show them on the archive page. I've built my own archive- page with custom functions. I just added **news-archive.php**               $news_args = array(       'post_type' => 'post',       'post_status' => 'publish',       'posts_per_page' => 5,       'paged' => $paged     );     $news = new WP_Query($news_args);     ...      So I have another page where I show the latest news on, and a snippet of that news. When clicked on the news link I would like it to go to the correct page number on the archive. How can I accomplish this? thanks in advance


title: Posts page template: How can I edit the markup for this?

text: I have in settings->reading changed the front page to display a static page. One for home, one for news with a custom template for each. Home works fine, however News will not change no matter what I change. Can anyone give me clear instructions on how to control/change the 'latest posts page' so I can change the markup. Thanks


title: URL rewrite results in a 404, but everything should work!

text: So I modified this code that I found elsewhere and stuck it in a plugin. The plugin works; I can see the .htaccess file updated when I hit save on the permalinks page.               add_action( 'init', 'wpse26388_rewrites_init' );          function wpse26388_rewrites_init(){         add_rewrite_rule(             'microsoft/mcsa/',             'wp-content/microsoft.php?cert=mcsa',             'top' );     }          add_filter( 'query_vars', 'wpse26388_query_vars' );          function wpse26388_query_vars( $query_vars ){         $query_vars[] = 'cert';         return $query_vars;     }      .htaccess               RewriteEngine On     RewriteBase /training/     RewriteRule ^index\.php$ - [L]     RewriteRule ^microsoft/mcsa/ /training/wp-content/microsoft.php?cert=mcsa [QSA,L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /training/index.php [L]      I can go to /training/wp-content/microsoft.php?cert=mcsa and the page loads. But when I try to access it via /microsoft/mcsa, it does not and gives me a 404. What gives? And is there any way to enable error logging to see where it's trying to go? Enabling debug mode in wp_config didn't seem to do anything.


title: Multisite Widget/Content

text: I'm using WordPress multisite and need to display content across all subsites in the sidebar. This is a network of 50+ sites so updating all 50+ sidebars with this content every few days is not practical. One solution I've found is to simply insert the content I want into sidebar.php in the theme editor, though I don't want my client editing this file, and want them to use TinyMCE editor instead of HTML. Another idea was to embed an iframe into each subsite and have my client update the page that the iframe was referencing. And the final idea I had was to create a plugin with the TinyMCE editor that would inject code into the sidebar.php file when saved, though I don't know if access to editing theme files is available to plugins. Is there a better solution that I'm not thinking of? I tried a few plugins with no success, did I miss one?


title: wordpress php show comments only from user AND replies

text:
I'm trying to add a comment section to a user profile, it'll act as a way of communicating between the user and the admin. In the user section I only want to show comments from the logged in user, and replies from the admin. Here is my code that handles the comments loop:               <?php     if ( is_user_logged_in() ) {     $user_id = get_current_user_id();     $args = array(         'status' => 'approve',         'order' =>  'DESC',         'user_id' => $user_id     );     $comments = get_comments($args);     foreach($comments as $comment) :         echo '
';          echo($comment->comment_author . '
' . $comment->comment_date . '
' . $comment->comment_content);         echo '
';     endforeach;     }     ?>      This currently shows only the logged in users comments - now I need a way to show replies too - any thoughts on how I can do this?


title: Display Image Upload from Contact Form 7 on Redirect Page

text: How would I show an image upload, a photo of someone, in the Thank You page. It's for a competition. NB: The user uploads an image and then that image is shown on the thank you page.   * I need to access the form data array   * find the file uploaded already   * and display this in an img tag on the thank you page   * I already have the redirect in place I'm not very good at all with PHP, but I feel like I've been skirting the solution I just can't see it. This question shows the possibility of using the data from the form but how would I extract the file variable and then use that to show it on the next page. It would need to be a method that can handle numerous people using the form possibly at the same time. There are likely to be hundreds of entries. Thanks in advance!


title: Is it possible to have more than 1 sql databases in my wordpress blog?

text: I m watching video on installing wordpress manually. on first launch wordpress prompts you to input your sql database name, sql password etc. then i can start working from dashboard. is it possible for wordpress blog to have more than one db? if yes, what is the possible example for having 2-3 databases? when would you need more than one db? **or the working rule is: one blog - one db? if you have 2-3 blogs, you can manage them from SAME dashboard!? and each must of course have 1 db?**


title: WP_Customize_Image_Control and selecting from library?

text: I am adding some theme options, one of which is an image option.                $wp_customize->add_control(                 new WP_Customize_Image_Control(                     $wp_customize,                     'theme_ppr_options[portfolio_photo]',                     array(                         'label'      => __( 'Upload a portfolio', 'ppr' ),                         'section'    => 'mytheme_options',                         'settings'   => 'theme_ppr_options[portfolio_photo]',                         'context'    => 'your_setting_context'                      )                 )             );      But i notice i am not able to select an image from the library, how can this be enabled?? regards


title: Pagination Broken on Loop using ACF

text:
http://dthudson.com/ccr/archive-issues/ The paginated pages are being populated by the content as you can see at the bottom (beneath the posts) but when you click on '2' for instance it loads page 2 but it shows the exact same posts. I want to point out that I am using Advanced Custom Fields to retrieve content from the post-type 'issues', I wonder if this is contributing to the problem. Also - I copied the pagination code from my index page and search page and each of those works fine. Any ideas?                                  <?php           $args = array(             'post_type' => 'issues',             'posts_per_page' => '9',             'order' => 'ASC',             'orderby' => 'meta_value_num'     );          $my_query = new WP_Query( $args );               if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();?>

                         <a class="hover-color" href="<?php echo get_permalink(); ?>">
<?php the_field('release_season'); ?> <?php the_field('release_year'); ?>

<?php the_field('issue_number_full_length'); ?>

                         <a href="<?php echo get_permalink(); ?>"><img class="column-nest image-width" src="<?php the_field('issue_image_cropped'); ?>" alt="photo of issue <?php the_field('issue_number'); ?>" />

                <?php the_content(); ?>     <?php endwhile; endif; ?>
                                                                 <?php                                  $total_pages = $my_query->max_num_pages;                                    if ($total_pages > 1){                                      $current_page = max(1, get_query_var('paged'));                                      echo paginate_links(array(                                     'base' => get_pagenum_link(1) . '%_%',                                     'format' => 'page/%#%',                                     'current' => $current_page,                                     'total' => $total_pages,                                    'prev_next'    => False,                                   'type' => 'list',                                  ));                               }                               ?>


title: Changing bloginfo description from a plugin

text: How can I change the site's bloginfo description in runtime from a plugin? I tried these, but none of them work:               add_filter('description', 'ab_arq_generate');     add_filter('blogdescription', 'ab_arq_generate');      My point would be to make a random quote in the place of the description regardless of the actual template.


title: auth_redirect header already sent error

text: I'm a novice to php so please bare with me. I've been pulling my hair out trying to figure out this one. I have a simple if statement in a page template to require viewers to be logged in.               <?php     if (is_user_logged_in()) { ?>              /* Page template code goes here */          <?php } else {         auth_redirect();     } ?>      The problem i run into is that when the viewer is not logged in, it kicks it back with a header error: > Warning: Cannot modify header information - headers already sent by (output > started at /home/xxxxxxxxxxxxx/xxxxxxxx/wp- > content/themes/xxxxxxxxxxx/template-client.php:3) in > /home/xxxxxxxxxxxxx/xxxxxxxx/wp-includes/pluggable.php on line 896 I'm building this theme off of todd motto's html5blank 1.4.2. Could that be whats causing it? http://html5blank.com/ https://github.com/toddmotto/html5blank How can I trigger auth_redirect to run before the headers are sent? Any code example would be very helpful.


title: What method should I use to store my plugin data (multi level menus with options on each item)

text: So the background on my plugin - it generates taxonomy/term filters to give you a filtering system similar to what you'd see on NewEgg where you filter your results by category/manufacturer/other criteria. In the admin area, users will create a filter-set. The filter-set will have various options (display name, type, etc). Within the filter set are the individual taxonomies that the filter-set will be made up of. These can be re- ordered using drag and drop (their order needs to be stored since they will need to be displayed in that order). Each of the taxonomies also has various options like display name, menu type (drop down, radio button, multi select, etc) and various other options. Ultimately it will look something like this (the ordering of the 'taxonomy' nodes must be retained);               <Filterset-01 option1="" option2="">       <taxonomy tax="c"  option1="" option2="" option3="" />       <taxonomy tax="b"  option1="" option2="" option3="" />       <taxonomy tax="a"  option1="" option2="" option3="" />     </filterset-01>          <Filterset-02 option1="" option2="">       <taxonomy tax="d"  option1="" option2="" option3="" />       <taxonomy tax="a" option1="" option2="" option3="" />       <taxonomy tax="e" option1="" option2="" option3="" />     </filterset-02>      So far I set up my own db table but I feel like this might not be the best method. I can probably store the whole thing in a big, complicated array and just save it a single option in wp_options but I don't know if that's a good idea. I was also considering XML since I already visualize the plugin structure in pseudo XML but I don't know if there is any preferred method for storing options in XML or what drawbacks it may have. Basically I just want to know what the ideal method for storing the above data would be.


title: Redirect entire website to a single page

text: I need to redirect a whole WordPress site to a single WordPress page. A sort of maintenance mode, but the redirect has to go to a published WordPress page. Unfortunately, the maintenance page I need to show has to use other WordPress plugins. I am not aware of any Maintenance Mode plugin which lets you do this. At most, they let you write custom HTML/CSS code. I was thinking about a .htaccess mod_rewrite rule. However, I am very weak with mod_rewrite. First, I disabled canonical redirects. Then, I tried to use:               RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_URI} !^/index.php?page_id=813$     RewriteRule ^(.*)$ /index.php?page_id=813 [R=307,L]      However, these rules generate redirect loops. `page_id=813` is the ID of my maintenance page, of course. Is anybody aware of a maintenance mode plugin, which redirects to a published page? Alternatively, can somebody help me to fix the mod_rewrite rules? Extra cheers if we can leave `/wp-admin` out of the redirect rules.


title: Cache all products Woocommerce

text: I have installed a cache program to cache my pages. Ofcource the pages has to visited before it can be cached. Is it possible to run all the product pages at night and how? I hope someone has a idea! Solution: foreach loop = > system("wget -N -O - 'http://domain.com/etc/etc/")


title: Why is this function crashing my wordpress installation?

text: I'm new to wordpress and programming in general. For my first site there is a custom template in which I want to load a javascript library. After registering and enqueueing it in functions.php my site no longer loads properly. I'm sure what it is simple mistake and would really appreciate a little help. For the record, I'm using a child theme of twentytwelve. Here is the code:               <?php      function load_wforms() {           if (is_page(45)) {               wp_register_script('wforms', get_stylesheet_directory_uri().'/js/wforms.js'), false, '2.0');               wp_enqueue_script('wforms');           }       }       add_action('init', 'wforms');       ?>      Thanks!


title: links to posts not working on homepage

text:
I have created a nice homepage where the posts are organized into two columns. Only somehow, in creating this, I must have erased the actual code that tells the posts to link to the corresponding post. So right now, the posts are all showing up on the homepage, but there is no way to go to the post - the post previews are unlinked to the actual posts. I looked around some first, thinking this might be a common issue, but I haven't found the answer yet. If anyone can assist, i would greatly appreciate it! The site is at internalcompass.us/castle. It's a twentytwelve child theme. here is the code i have in content.php                   <?php         /**          * The default template for displaying content. Used for both single and     index/archive/search.      *      * @package WordPress      * @subpackage Twenty_Twelve      * @since Twenty Twelve 1.0      */     ?>                  <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                     <?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
                             <?php _e( 'Featured post', 'twentytwelve' ); ?>
                     <?php endif; ?>                                                  <?php the_post_thumbnail(); ?>                             <?php if ( is_single() ) : ?>
<?php the_title(); ?>
                             <?php else : ?>

<?php the_title(); ?>
<?php the_date('F j, Y'); ?>

                             <?php endif; // is_single() ?>                                                       <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '', '' ); ?>                             <?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>

                                                     <?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentytwelve_author_bio_avatar_size', 68 ) ); ?>

<?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?>

<?php the_author_meta( 'description' ); ?>

                                                             <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">                                                                     <?php printf( __( 'View all posts by %s →', 'twentytwelve' ), get_the_author() ); ?>

                             <?php endif; ?>


title: Pass a comma separated shortcode attribute to a function

text: I've been trying to create a shortcode for the Category Ajax Chain Selects plugin so that I can display the chain selects within a chosen post/page easily, but for now I've only been able to hardcode the attributes into the shortcode:               function cross_ref_lookup_shortcode() {         echo chainselect_getcategories( 'kla-competitor', 2, array('Select Manufacturer', 'Select Product'), array('Manufacturer', 'Product'), 'Find comparable product', '', 0 );     }          add_shortcode( 'cross_ref_lookup', 'cross_ref_lookup_shortcode' );      This works fine and I can display the chain selects where I want, but I want to create a shortcode where I can add the variables as shortcode attributes. The usage of the chainselect_getcategories function looks like this:               <?php chainselect_getcategories( $tax, $level, $titles, $labels, $btn_text, $exclude, $count ) ?>      I got far enough that everything worked except for the labels and titles, because they require an array. I can't figure out how to pass a shortcode attribute as an array to the function so that this will work as intended. In my hardcoded example above, the arrays work, and this is what I need to recreate from the shortcode attribute. Here's as far as I got:               function chain_select_shortcode( $atts ) {         extract( shortcode_atts( array( 'tax' => 'category', 'level' => 1, 'titles' => array( 'Please select…' ), 'labels' => '', 'btn_text' => 'Submit', 'exclude' => '', 'count' => 1 ), $atts ) );              return chainselect_getcategories( $tax, $level, explode( ',', $titles ), explode( ',', $labels ), $btn_text, $exclude, $count );     }          add_shortcode( 'ajax_chain_select', 'chain_select_shortcode' );      Any ideas on how to complete this?


title: How to set individual capabilities on a taxonomy? Or how to re-register an existing taxonomy?

text: The default taxonomy, category. By default, only those with the `edit_posts` capability can assign categories during post creation/editing. I have a role with very limited capabilities. I want to let users in this role be able to assign categories during custom-post-type creation/editing, but I cannot give them the `edit_posts` capability and they should not be able to edit the taxonomy, only assign it. How can I do this? Setting `'assign_terms' => 'read'` is one option, but how can I set that value without having to re-register the taxonomy? Or alternatively, how can I give my low-level role permission to assign the taxonomy?


title: Custom Permalink Structure for Pages & Posts

text: I'd like to create a permalink structure that works in the following way: Pages - http://myurl.com/ _pagename_   Posts - http://myurl.com/news/ _postname_ / How would I do so? Thank you


title: can register_post_type() be safely called before init

text: If I call `register_post_type()` before the `init` action, will my plugin explode in a ball of fire under some circumstances? Codex says: > register_post_type should only be invoked through the 'init' action. It will > not work if called before 'init', and aspects of the newly created or > modified post type will work incorrectly if called later. Codex also says: > Note that you must call register_post_type() before the admin_menu and after > the after_setup_theme action hooks. A good hook to use is the init hook. Given this advice, I've always registered my CPT on the `init` action. That's always worked well for me, until today, when I found a problem. I have a plugin (not yet released anywhere) that logs emails. I use it extensively when testing. It registers a CPT, which it uses to store the email logs. All good so far. Today, testing an Easy Digital Downloads shop, I noticed that I was getting errors logged in debug.log, each time I inserted a new email log post. The error was caused by `get_post_type_object()` not finding my CPT, because EDD is sending emails before the `init` action. So, after verifying that the doco and piles of other references including WPSE concur that "register_post_type should only be invoked through the 'init' action", I went ahead and changed my plugin to register on `plugins_loaded`. Note that this action precedes the `after_theme_setup` action, so I'm violating both of the above Codex excerpts. Am I OK doing this, or will I strike some problem under some circumstances? BTW, when I dump the contents of `$wp_post_types` on `plugins_loaded`, it already has all the standard WordPress post types defined... Edit: OK, I'm dumb, EDD isn't sending emails out before `init`, I just needed to increase my hook's priority to beat it -- now hooking `init` at priority 1. But the question still stands...


title: Widgets menu does not appear under "Appearance" in dashboard

text:
I am developing a WordPress theme, but am stuck on widgetizing my theme. I have followed several tutorials but still cannot get it to work.   My widgets menu does not appear under _Appearance_ in my dashboard. This is my function file and sidebar.   From _function.php_:               function custom_enqueue_scripts() {                  wp_deregister_script( 'jquery' );                  wp_register_script( 'jquery', get_template_directory_uri() . '/bin/js/jquery-1.10.1.min.js', 'jquery', '1.10.1',TRUE);             wp_register_script( 'fittext', get_template_directory_uri() . '/bin/js/jquery.fittext.js', 'jquery', '1.0',TRUE );                  wp_enqueue_script( 'jquery' );             wp_enqueue_script( 'fittext' );          }     add_action( 'wp_enqueue_scripts', 'custom_enqueue_scripts' );          if (function_exists('register_sidebar')) {                  register_sidebar(array(                     'name' => 'Widgetized Area',                     'id'   => 'katuhu',                     'description'   => 'This is a widgetized area.',                     'before_widget' => '
',                     'after_widget'  => '
',                     'before_title'  => '
',                     'after_title'   => '
'             ));          }      From _sidebar.php_:
          <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Widgetized Area')) : else : ?>

Widgetized Area

This panel is active and ready for you to add some widgets via the WP Admin

          <?php endif; ?>      `


title: How to output the menue structured for tabbed navigation?

text:
I've got a design for my webpage that uses tabbed navigation with two levels. In this example 'TAB2' tab is selected and it's children item are desplayed below of it.                                     ˬ               |TAB1|    |TAB2|    |TAB3|                     tab2-item1    tab2-item2    tab2-item3ˬ   tab2-item4 ...      The only webpage I could find that uses something simmilar is really old fashioned but shows what I want in general. sample webpage (not mine) I think that I need the following html structure for this - using bootstrap:                //Bootstrap 2.32 nav tabs

TAB 1

TAB 2

tab1-item1

tab1-item2

tab1-item3

tab2-item1

tab2-item2

tab2-item3

tab2-item4

      What is the best way to print the menue out in this format?


title: How can I Protect my Q/A site from Unexpected /Spam Post?

text: I have a Bengali Q/A site which is created in WordPress. Recently I am getting unexpected post to my site from different users in english which are not any question or answer, just some junk content. I installed WP-reCaptcha plugin to protect spam post. But it can't prevent them. Can anyone help me to get rid of from this problem. This is my site: http://prosnouttar.com/


title: If a hacker changed the blog_charset to UTF-7 does that make WordPress vulnerable to further attacks?

text: I had a client who got hacked recently and I noticed that there were weird characters appearing on her site, like Â and Æ. It turns out that the hackers changed the blog_charset to UTF-7 in the `wp_options` table in the database. I set it back to UTF-8, but I was wondering if during the time it was set to UTF-7, could that create any security vulnerabilities? I did some searching and discovered there used to be a WordPress UTF-7 vulnerability that was fixed in version 2.0.6. We're running the most recent version of WordPress, so they couldn't have used that exploit, but are there any other exploits related to UTF-7? Really, is there any reason the hackers would change the blog_charset other than to be a pain? I've been trying to determine how they got in and I'm wondering if this is connected somehow.


title: How to set "with_front'=>false" to a plugin-generated cpt?

text: I am using an external plugin (not my own CPT) to manage events on a site where the blog permalinks structure is /news/%category%/%postname%/ Normally for CPTs I could set the prepend with front to FALSE when creating the CPT but in this case I don't know how since the plugin controls the definition. The developer sent me the snippet below but it does not work in either correctly changing the slug (actaully breaks event permalinks) or setting with_front to false:               //     //    EVENTON Calendar SLUG correction     //     //             add_filter('eventon_register_post_type_ajde_events', 'fix_event_slug', 10, 1);      function fix_event_slug($array){               $newar = $array;      $newar['rewrite']= array( 'with_front'=>false, 'slug'=>'events' ); //     // print_r($newar); return $newar; // test     }      Any help much appreciated.


title: RW Meta Box ,Problem setting post title

text: I'm using RW_Meta_Box plugin by Rilwis. I'm using a CPT and added a custom meta-box and removed the `title` and `editor`. But I still want to set the title for some obvious reasons. I created the CPT and meta-box and everything worked perfectly including the `all posts` page using `custom column` hooks. As soon as I sat to set post title to one of the fields in the meta-box, I failed to get the desired results.I tried to solutions I picked by searching through this Q&A site. Initially I tried: **SOLUTION1:**               add_action('submitpost_box', 'hidden_type_title');          function hidden_type_title() {         global $current_user, $post, $post_type;         global $prefix;         $md = rwmb_meta($prefix . 'name', array('type' => 'text'), $post->ID);         if ($post->post_type == 'MY_CPT_NAME') {         ?>         <input type="hidden" name="post_title" value="<?php echo esc_attr(htmlspecialchars($md)); ?>" id="title" />         <?php         } else {         return;         }     }      The above code works fine but it has a problem I am unable to detect. which is, I need to update the post twice to set the post title. Therefore I went on to try the `save_post` hook like so: **SOLUTION2:**               add_action('save_post', 'post_updated');          function post_updated($post_id) {         global $current_user, $post;         if ($post->post_type != 'MY_CPT_NAME') {         return;         }              global $prefix;         $md = rwmb_meta($prefix . 'name', array('type' => 'text'), $post_id);         // verify post is not a revision & not an autosave         if (!wp_is_post_revision($post_id) && !(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {         // set the new post title         $post->ID = $post_id;         $post->post_title = $md;              // update the post, removing the action to prevent an infinite loop         remove_action('save_post', 'post_updated');         wp_update_post($post);         add_action('save_post', 'post_updated');         return;         }     }      Now, I'm in a worse situation, the post title is instantly set but my meta-box data is somehow not being saved. What might be wrong with the first solution?


title: WordPress database error on a query working fine in MySQL Workbench

text: On activating my plugin Wordpress adds an entry to the error log...               WordPress database error  for query SELECT * FROM wp_c2pprojects WHERE projectid = 20 made by require_once('C:\\wamp\\www\\csv2post\\wp-admin\\admin.php'), require_once('C:\\wamp\\www\\csv2post\\wp-load.php'), require_once('C:\\wamp\\www\\csv2post\\wp-config.php'), require_once('C:\\wamp\\www\\csv2post\\wp-settings.php'), include_once('C:\\wamp\\www\\csv2post\\wp-content\\plugins\\csv-2-post\\csv-2-post.php'), CSV2POST->debugmode, referer: http://localhost/csv2post/wp-admin/admin.php?page=csv2post      As you can see, a simple query. I copied and paste the query into MySQL workbench to find that it works, returning the project with ID 20. The query runs during the plugins use and so this issue is related to activation somehow. Does anyone have any ideas why? I did try wrapping the '20' and it made no difference. Thank you for any help.


title: Make URL in custom field hyper link

text: In my WordPress site I have created a custom field for author website link. but I don't know how to make it hyperlink, so people can click on it to surf that website. at this moment it only shows raw text. like: `"www.example.com"` my code is:               <?php echo get_post_meta($post->ID, 'Author Website', true); ?>


title: Importing changes to Child Theme

text: I've made numerous changes to my theme via the CSS block in Theme Options. Wondering if there's a seamless method to migrate these changes to a Child Theme. I don't have much coding knowledge but I suspect there must be a way to grab a version of the blog as it is (modified) and save that as the child theme. Maybe?


title: How to Add Image to Wordpress RSS-Feed with no Plug-in?

text: I have searched for adding featuring image to rss feed with no plug-in for WordPress. I have found some examples and applied how it was instructed. But All I have got now is nothing. Still can't reach the image. The last and the best (according to me) solution (as told here) I have found is adding the following code to current theme's `functions.php`               function featured_image_in_feed( $content ) {         global $post;         if( is_feed() ) {             if ( has_post_thumbnail( $post->ID ) ){                 $output = get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'float:right; margin:0 0 10px 10px;' ) );                 $content = $output . $content;             }         }         return $content;     }     add_filter( 'the_content', 'featured_image_in_feed' );      I have not seen any change. Is there something else to be done? What I want to do is adding featuring image as another key in the XML. It would be easier to show it for my slider.


title: Choose To Display Post Views With An Options Panel

text: I have post views enabled and I'm attempting to make **an options panel option to allow users to choose if they would like to display post views in each post**. If they choose 'Yes," then they will be shown post views. If they choose 'No,' then they will not. I'm hoping somebody can help me create the correct get_option to display post views based on what is chosen in the options panel. What I tried to grab my post views, and it did not work:               <?php     if (get_option('to_post_views') != 'No' and function_exists('post_views_count'))         post_views_count(); ?>      Without options enabled, I can grab my post views with the following:               <!-- Remember Post Views -->     <?php setPostViews(get_the_ID()); ?>          <!-- Display Post Views-->     <?php echo getPostViews(get_the_ID()); ?>      My function for post views:               // Post views     function getPostViews($postID){         $count_key = 'post_views_count';         $count = get_post_meta($postID, $count_key, true);         if($count==''){             delete_post_meta($postID, $count_key);             add_post_meta($postID, $count_key, '0');             return "0 View";         }         return $count.' Views';     }     function setPostViews($postID) {         $count_key = 'post_views_count';         $count = get_post_meta($postID, $count_key, true);         if($count==''){             $count = 0;             delete_post_meta($postID, $count_key);             add_post_meta($postID, $count_key, '0');         }else{             $count++;             update_post_meta($postID, $count_key, $count);         }     }          remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);      My array for the options panel:               array( "name" => "Display post views?",         "desc" => "Choose whether or not to display post views.",         "id" => $shortname."_post_views",         "type" => "select",         "options" => array("Yes", "No"),         "std" => "Yes"),


title: Show posts without content in RSS 2 FEED

text: Those posts that do not have a content, do not show up inside my feed via the URL. I want all of them to show up, even the ones without content. How ?


title: lost css when overriding themes templates

text:
i have copied and modified the template file :                 header.php      in my theme child and i kept the same path. here is the full file                <?php      /**     * Your Inspiration Themes      *       * @package WordPress     * @subpackage Your Inspiration Themes      * @author Your Inspiration Themes Team <info@yithemes.com>      *      * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)      * that is bundled with this package in the file LICENSE.txt.      * It is also available through the world-wide-web at this URL:      * http://www.gnu.org/licenses/gpl-3.0.txt      */           global $yit_is_header;     $yit_is_header = true;           do_action( 'yit_before_logo' ) ?>

             <?php             /**              * @see yit_logo              */             do_action( 'yit_logo' ) ?>
                  <?php do_action( 'yit_after_logo' ) ?>

         <?php               do_action( 'yit_main_navigation');                     get_sidebar('product-menu');                   ?>

           <?php $yit_is_header = false; ?>      I have lost the CSS, why?


title: <?php wp_list_comments(); ?> is it possible to have the full code instead in the comments.php page

text: I strongly need to edit some parts of the comments left by the users, I want to add a link to the commenter's author.php page if he/she is a registered user by placing a text link somewhere next to his/her name. I've this code `<?php wp_list_comments(); ?>` but I wonder if it's possible to have the full code instead to replace it in comments.php Thanks!


title: Click Swatch, Change Image

text:
I'm using the Advanced Custom Fields plugin and am trying to get a series of images to change when their corresponding Swatch Colour is clicked. Here's what I've got so far for my images loop:               <?php if(get_field('images')) { ?>
             <?php while(has_sub_field('images')) {                 $attachment_id = get_sub_field('image');                 $size = "thumbnail";                 $image = wp_get_attachment_image_src( $attachment_id, $size );             ?>
                     <img src="<?php echo $image[0]; ?>" class="<?php the_sub_field('swatch_number'); ?>" />
             <?php } ?>
     <?php } ?>      And this generates the series of swatches attached to each image:               <?php if(get_field('images')) { ?>

                 <?php while(has_sub_field('images')) { ?>                         <li class="swatch <?php the_sub_field('swatch_number'); ?>"><?php the_sub_field('swatch_name'); ?>
                 <?php } ?>

     <?php } ?>      I believe I'm getting hung up on the Javascript, because I need to find a way to: when a swatch colour is clicked (i.e. `.swatch.14`), show the image that has a class of `img.14`. Do I need to mix PHP and JS, and is something like this possible. Any help on this is appreciated. Thanks in advance!


title: What is the issue with our links? It creates a loop

text: On behalf of the university's radio station, I am trying to solve the issue with our links. When you go to our site http://brookesradio.com, if you click one of the nav bar or header, twice or go to the front page the link becomes 'http://brookesradio.com/#http://brookesradio.com/' and then if it is a category or page the page title. What is causing this issue, I tried a few things like manual links and looking through the theme's setting but nothing was jumping out at me. Thanks for reading Mike.


title: Functions.php in Child Theme - load JS

text: My theme uses this function to load Javascript and CSS               function aitEnqueueScriptsAndStyles()     {         // just shortcuts         $s = THEME_CSS_URL;         $j = THEME_JS_URL;              aitAddStyles(array(             'ait-jquery-prettyPhoto'  => array('file' => "$s/prettyPhoto.css"),             'ait-jquery-fancybox'     => array('file' => "$s/fancybox/jquery.fancybox-1.3.4.css"),             'ait-jquery-hover-zoom'   => array('file' => "$s/hoverZoom.css"),             'ait-jquery-fancycheckbox'=> array('file' => "$s/jquery.fancycheckbox.min.css"),             'jquery-ui-css'           => array('file' => "$s/jquery-ui-1.10.1.custom.min.css"),         ));              aitAddScripts(array(             'jquery-ui-tabs'              => true,             'jquery-ui-accordion'         => true,             'jquery-ui-autocomplete'      => true,             'jquery-ui-slider'            => true,             'ait-jquery-fancycheckbox'    => array('file' => "$j/libs/jquery.fancycheckbox.min.js", 'deps' => array('jquery')),             'ait-jquery-html5placeholder' => array('file' => "$j/libs/jquery.simpleplaceholder.js", 'deps' => array('jquery')),             'ait-googlemaps-api'          => array('file' => 'http://maps.google.com/maps/api/js?sensor=false&language=en', 'deps' => array('jquery')),             'ait-jquery-gmap3-label'      => array('file' => "$j/libs/gmap3.infobox.js", 'deps' => array('jquery')),             'ait-jquery-gmap3'            => array('file' => "$j/libs/gmap3.min.js", 'deps' => array('jquery')),             'ait-jquery-infieldlabel'     => array('file' => "$j/libs/jquery.infieldlabel.js", 'deps' => array('jquery')),             'ait-jquery-prettyPhoto'      => array('file' => "$j/libs/jquery.prettyPhoto.js", 'deps' => array('jquery')),             'ait-jquery-fancybox'         => array('file' => "$j/libs/jquery.fancybox-1.3.4.js", 'deps' => array('jquery')),             'ait-jquery-easing'           => array('file' => "$j/libs/jquery.easing-1.3.min.js", 'deps' => array('jquery')),             'ait-jquery-nicescroll'       => array('file' => "$j/libs/jquery.nicescroll.min.js", 'deps' => array('jquery')),             'ait-jquery-quicksand'        => array('file' => "$j/libs/jquery.quicksand.js", 'deps' => array('jquery')),             'ait-jquery-hover-zoom'       => array('file' => "$j/libs/hover.zoom.js", 'deps' => array('jquery')),             'ait-jquery-finished-typing'  => array('file' => "$j/libs/jquery.finishedTyping.js", 'deps' => array('jquery')),             'ait-jquery-jcarousel'        => array('file' => "$j/libs/jquery.jcarousel.min.js", 'deps' => array('jquery')),             'ait-spin-ajax-loader'        => array('file' => "$j/libs/spin.min.js"),             'ait-modernizr-touch'         => array('file' => "$j/libs/modernizr.touch.js"),             'ait-gridgallery'             => array('file' => "$j/gridgallery.js", 'deps' => array('jquery')),             'ait-rating'                  => array('file' => "$j/rating.js", 'deps' => array('jquery')),             'ait-script'                  => array('file' => "$j/script.js", 'deps' => array('jquery')),              ));              wp_localize_script( 'ait-script', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'ajaxnonce' => wp_create_nonce('ajax-nonce') ) );     }     add_action('wp_enqueue_scripts', 'aitEnqueueScriptsAndStyles');      I am using a child theme and I was wondering how can I load additional Javascript in the functions.php inside the child theme. The reason for using this is that any changes i make to the code above will be overwritten in the next update.


title: Specify strict 'order by' in WordPress query

text: I have a custom post type called `Employees` where an employee's name is the `post_title` of each post. I am trying to figure out how I would sort the `post_title` column by last name. So for instance, if we have the following post entries: `1. Justin Bieber 2. Selena Gomez 3. Jessica Alba 4. Nicholas Cage` The query would contain the entire list of employees sorted by last name, so: `1. Jessica Alba 2. Justin Bieber 3. Nicholas Cage 4. Selena Gomez` Anybody? Thanks.


title: Password-protected page redirecting to frontpage when I enter the password

text: I've enabled built-in password protection on one of my pages. The password form shows up, I enter a password, press _Submit_ button and I'm redirected to my front page. Now if I revisit the protected page, it will be unlocked (if the password was correct). But I think after I enter the password, I should land directly on the page I'm trying to access, right? I'm using Wordpress 3.5.2 with a custom theme. What I've tried:   * tested it on another blog with WP 3.5.2   * switched theme to unmodified Twenty Twelve   * disabled all plugins   * clean WP install on a local server No luck with any of these, still the same problem - I'm redirected to the server's root (i.e. `example.com/`, not `example.com/wordpress` or `example.com/wordpress/passpage`). Is it a bug or intended behavior? Is there any workaround I could use?


title: Modify query after meta value

text: I would like to change the calendar so it will display some posts based on a custom date field. For now i am interested to modify this query:               $wpdb->get_results("SELECT ID, post_title, DAYOFMONTH(post_date) as dom "         ."FROM $wpdb->posts "         ."WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' "         ."AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' "         ."AND post_type = 'post' AND post_status = 'publish'"     );      to something like this:               $wpdb->get_results("SELECT a.ID, a.post_title, DAYOFMONTH(b.meta_value) as dom "         ."FROM $wpdb->posts a, $wpdb->postmeta b "         ."WHERE b.meta_value >= '{$thisyear}-{$thismonth}-01 00:00:00' "         ."AND b.meta_value <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' "         ."AND a.post_type = 'post' AND a.post_status = 'publish' AND a.ID = b.postid AND b.meta_key='Event Date'"     );      I did try the above query but it does not work, it returns an empty array. How can I change that the calendar will look after the meta value instead of post_date ? Thank you.


title: How can I revert to showing cached pages when no database connection is available?

text: I don't know much about how super cache works, but I see that at the very least, I can find most of the pages of my site in the wp- content/cache/supercache folder. Now, if WordPress cannot connect to the database due to the MySQL server being down (as is the case right now), should it be showing an error message or should it be showing the cached pages? I would think that it should work regardless of whether the connection can be made or not. Is there an option or a flag that I am missing? Also, it looks like the main page of the site is _not_ cached, while everything else is. Is there any way to deal with that? Obviously I can't do anything about that right now, since the database is down, but for the future?


title: How to query the content of a specific custom post type?

text: I have created a custom post type called "Single Neighborhood" in it i have 5 custom fields:   1. Background Color (color picker)   2. Background Image (image upload)   3. Latest news (WYSIWYG editor to list external links to news)   4. Local Events (WYSIWYG to display other RSS feeds)   5. Listings (WYSIWYG to write out a custom paragraph)   6. Taxonomy menu (to select a custom neighborhood like "Adams Morgan") All of these fields will be in different divs throughout the template page so would it be best to just insert all the divs within the "while" loop and just use on loop or would multiple loops be better? Finally how do i reference a taxonomy in the query? I mean i'm using the same Single-neighborhood template for 27 neighborhoods but i can't reference just one taxonomy within the template because then it would just pull the content for that one neighborhood, is there a dynamic way for WordPress to know what content from which neighborhood to pull by use of what link the user came in from? I've been dealing with this issue for 4 days now and i can't seem to understand the best approach to take. Will accomplishing something like this require custom functions, conditions within the loop to work it out? If anyone has for example made a real estate site or a site with hierarchical structure of Neighborhoods > Neighborhood > Places > Place > Sub pages of that place that required custom content for (in the same location of each page) specific pages please advise. Thanks.


title: How do I turn off local pickup for a specific shipping category?

text: Can anybody provide me with some code that would help? I need to be able to offer flat rate shipping AND local pickup for all product categories apart from 2, which I have assigned to a separate shipping class. I thought Local Pickup Plus would enable me to do this, but I was wrong. Please help. I am going around in circles. I thought something like this would work, but it doesn't:               // Hide standard local pick-up when shipping class is Pillivuyt     add_filter( 'woocommerce_available_shipping_methods',                  'hide_local_pickup_when_shipping_class_is_Pillivuyt' , 10, 1 );          /**      *  Hide Local Pickup option when shipping class is Pillivuyt      *       * @param array $available_methods      */     function hide_local_pickup_when_shipping_class_is_Pillivuyt( $available_methods ) {     if( isset( $product_shipping_class['pillivuyt'] )          AND isset( $available_methods['local_pickup'] ) ) {         // remove local pickup option         unset( $available_methods['local_pickup'] );     }     return $available_methods;     }


title: Order by custom field attribute

text:
I'm try to get the output of this post type to order by the staff name alphabetically and I can't seem to figure out if needs to be within the beginning `array()` or if I been do something within the `foreach()` loop. Here's my constructed loop:                <?php      $mypost = array('post_type' => 'staff', 'posts_per_page' => 20, 'orderby' => 'staff-name',         'order' => 'ASC' );      $loop = new WP_Query( $mypost );           ?>
          <?php while ( $loop->have_posts() ) : $loop->the_post();?>           <?php $items = get_post_meta( $post->ID, 'elements', true );       foreach( $items as $i){          echo'
         ' . $i['staff-name'] . '
         ';     }     ?>            <?php endwhile; wp_reset_query(); ?>      The `staff-name` field hold the first and last name of the staff member, but for some reason it doesn't look like it's sorting them alphabetically correctly. I do notice that if I change it from `ASC` to `DESC` it does change the order of the output, but it's not alphabetized. It's almost like it's ignoring the field `staff-name` and ordering it by the post ID instead.


title: Order custom taxonomy by date

text: I have custom taxonomy called series. I want to have a page where it lists all the Series with latest on the top. Series   * Series about fish     * Post 1     * Post 2   * Series about dog     * Post 1     * Post 2 I created a taxonomy-series.php which list the individual series, but I go to http://example.com/series. I get a 404. Do I need to create a separate page on the theme? to list al the series arranged by date?


title: W3 Total Cache, CDN and Custom Post Types

text: I have W3 Total Cache installed so that I can serve images from my live website to a local development version. Everything seems to be working as expected, apart from the URL rewrite doesn't seem to happen on a custom post types pages. I don't have the caching switched on, and the CDN hostname replacement is working very well on every other page. Any ideas?