Excluding custom post types

I'm attempting to develop an `is_blog()` function which returns true if the current view is a single post, blog home, or post archive. I have successfully excluded pages and attachments. My current code is in my theme's `functions.php`, as follows:               function is_blog() {         global $post;         $post_type = get_post_type( $post );              // is_archive() covers is_author(), is_category(), is_date(), is_tag(), and is_tax()         return ( ('page' == $post_type ) && !is_attachment() && ( is_home() || is_archive() || is_single() ) );     }      So far, this works as expected per the above criteria - for this development I call the function from my `footer.php` and display the result. My current difficulty is custom types. I have one custom type currently, and the function returns `true`, even though the custom type view is certainly not blog-related. I'm aware of checking for the post type, as evidenced by the code (oddly, a single post has a type of 'page'), but how can I exclude as yet-unknown custom types? Sure, I have just one now, but I'd like to be able to prevent ANY custom type from causing a `true` result. Is there any way to catch ANY type that is not built-in to WordPress?


What are the performance hiccups when building plugins?

Im very interested in plugin development for wordpress. But I need to get a better understanding as to what parts of a plugins functionality is causing more or less harm to the performance of wordpress. Im especially interested in the following questions:   * lets say we're registering 3 post types: is it worse for performance to do this in 3 different plugins (one for each post type), than registering all 3 in one plugin? in other words, is using an extra plugin adding to the load time, even if it doesn't do anything?   * if I use wordpress' functions to look up the value for 2 different options, is that then considered 2 mySQL queries?   * What parts of a plugin is likely to cause additional load times to normal non-logged in users loading the theme?    * What are the most important do's and don'ts when it comes to performance in plugin development   * How does language translation with get text influence performance? Any insights and/or links to resources on these topic are of big interest!


Show only public custom posts in home page

Hi i am working on custom post types in wordpress presently we are using below code to dispaly all custom posts in home page                    <?php     $args = array(        'public'   => true,        '_builtin' => false     );          $output = 'names'; // names or objects, note names is the default     $operator = 'and'; // 'and' or 'or'          $post_types = get_post_types( $args, $output, $operator );           foreach ( $post_types  as $post_type ) {        echo $post_type;     }          ?>          <?php query_posts('post_type=$post_type'); ?>                  <?php if(have_posts()) : while(have_posts()) : the_post(); ?>                      <?php get_template_part( 'content', get_post_format() ); ?>                  <?php endwhile; ?>                  <?php else : ?>
                     <h1 style="font-family: <?php echo $options['heading_choise']; ?>"><?php _e('No items found', 'persona') ?>

                  <?php endif; ?>      Am I missing anything because my home page shows " NO ITEMS FOUND " . ## edit 2 here is my present code                   <?php                $query = new WP_Query('post_type=any');           if($query->have_posts()) :          while($query->have_posts()) : $query->the_post();                   get_template_part( 'content', get_post_format() );               endwhile;               wp_reset_postdata();          else :      ?>
         <h1 style="font-family: <?php echo $options['heading_choise']; ?>"><?php _e('No items found', 'persona') ?>

          <?php      endif;      ?>      how to limit the output posts to public posts


Title don't function as link

I know there is no link tag around title, but I don't know where to put it, please help me :) This is code               if ($columns->have_posts()) :         $count = 0;             while ($columns->have_posts()) : $columns->the_post();             $count++;     ?>

                     <a href="<?php the_permalink(); ?>">                         <div style="width:190px;height:190px;background:url('<?php                           $img = get_the_post_thumbnail();                         eregi("src=\"([^\"]+)\"", $img, $arr);                              echo $arr[1]; ?>');">

                     <?php                              $long_title = strip_tags(htmlspecialchars(get_the_title($post->ID)));                         $short_title = substr($long_title,0,55);                              if (strlen($long_title) !== strlen($short_title)) {                             echo $short_title . "... ";                         } else {                             echo $short_title;                         }                         ?>

                     <?php $more_comments = get_comments_number() . '  Komentar(a)'; ?>                     <?php comments_number( "0 Komentar(a)", "1  Komentar(a)", $more_comments ); ?>

                         <?php                          if(function_exists('the_excerpt_max_charlength')) {                                 the_excerpt_max_charlength(300);                              } else {                                 the_excerpt();                              }                         ?>

     <?php         endwhile;     endif;     ?>
     <?php     if($count > 1) :     ?>             <button class="slide_prev">Previous</button>             <button class="slide_next">Next</button>     <?php     endif;     ?>


"is_new_day()" alternative for years?

I don't believe there's a `is_new_year()` function in WordPress, as an alternative for `is_new_day()`. I'm trying to display the year only once for each set of posts, what would be the best way to do this? Should I just check the date manually with PHP in the loop or are there any better ways?


Force resize for all video content

I'm looking for a way to force all video content on my site to scale to 100% width and I'm hoping to avoid using any additional javascript. Is there a filter or function that I can use to accomplish this? If so how is it used? And I do not want a plugin!


Limit to number of users connected?

ls there a limit to number of users connected to a wordpress blog at the same time? I am having a problem with users( authors) not able to log on. After about 5 or 6 are online everyone else gets hung up. Log in is not refused but the dashboard never loads for the other users.


Writing a link cloaking plugin

I do not want to use any existing plugin. For WordPress-less projects, I would specify a PHP file in `href`               Click here      `FileOnMySite.php` will be like               header('Location: http://www.MyaffiliateLink.com')      But I'll definitely get `header already sent` in WordPress.   * Is it possible to avoid `header already sent`?   * Any other cloaking method that you know will work best with WordPress? Thanks!


Fetch data from a WP page with same name as current username

Ok, so this sounds a little complex, but in theory should be easy. What I'm trying to achieve: ACF data is pulled from a WP page which has the same name as the current logged in user. Basically I will have a WP page set up for each company. I will create a login for each company with an appropriate username. The name of the company page will be the exact same name as the username I create. It will have Advanced Custom Fields entered with data. I want to dynamically pull in the ACF data from the company page based on the current user logged in into my page template. So if company A are logged in, I want them to view the custom fields from company A's page. Company B log in and view the custom fields from the company B page. So far, I have this:                   <?php           global $user_login;           get_currentuserinfo();           $username = $current_user->user_login;           $other_page = $username;         ?>
<?php the_field('my_custom_field', $other_page); ?>
      Which in theory should work, but it just doesn't. I can check the current username of the logged in user and echo it which returns the correct username just fine on the page. I can also add a page ID by adding the page ID like this: `$other_page = 890;` and it pulls in the custom field data from the correct company page (890 being one of the company pages). So everything works as it should independently, just not when I want to use the logged in username as the name of the page (namely $other_page). I'm baffled with this so any help would be greatly appreciated.


Trying to see if page is category or single and displaying title with appropriate heading tag

I'm using a custom theme from ThemeForest and I'm trying to get the custom post php to check and see if the post is on a category or single post. If it's on category, use `<h2>` for the title (for SEO purposes), if it's on the post's individual/single page, then use `<h1>`. Here is the public function that exists:               public function title() {       echo '
';       echo '';       the_title();       echo '
';     }      I tried this, and no luck:               public function title() {         global $post;       if is_category() {         echo '
';         } else {         echo '
';     };       echo '';       the_title();       if is_category() {           echo '
';         } else {           echo '
';     };     }      Not sure what I'd need to do. I can get the `global $post;` but I'm not sure that will help. Thanks for the hack help! :D **UPDATE: here is the code of the entire`pt_post.php`**               /******************************************************************************/     /*----------------------------------------------------------------------------*/     /* BLOG - FEATURED IMAGE     /*----------------------------------------------------------------------------*/     /******************************************************************************/         public function printBlogFeaturedImage() {             global $post;                  $isVideo = ffWP::getWp('featured isvideo');             if( $isVideo ){                 $videoLink = ffWP::getWp('featured video-link');                 $videoLink = trim($videoLink);                 if( empty($videoLink) ){                     $isVideo = 0;                 }             }                  if( $isVideo ){                 $this->_printBlogFeaturedImageVideo($videoLink);             }else{                 $gallery = ffGalleryCollection::getGallery( $post->ID );                 $this->featuredImage($gallery);             }         }          /*----------------------------------------------------------------------------*/     /* BLOG - VIDEO     /*----------------------------------------------------------------------------*/         protected function _printBlogFeaturedImageVideo( $videoLink ) {             $mediaInserter = new ffMediaInserter();             $videoIframeSrc = $mediaInserter->getIframeSource( $videoLink );                echo  '

';         }     /*----------------------------------------------------------------------------*/     /* TITLE     /*----------------------------------------------------------------------------*/         public function title() {           echo '
';           echo '';           the_title();           echo '
';         }     }          // MY FAILED ATTEMPT BELOW     /*  public function title() {             global $post;           if is_category() {             echo '
';             } else {             echo '
';         };           echo '';           the_title();           if is_category() {               echo '
';             } else {               echo '
';         };         }     }*/


Menu items' links are not working properly and added images

I did a wordpress project localhost using MAMP in Mac os,when I'm import the data to window 7. I have 6 Menu items ![enter image description here](http://i.stack.imgur.com/y0bNJ.png) there are some images and they are not displaying(I'm using revolutio slider) Menu items are also not working properly when i click menu i got this error for about me ![enter image description here](http://i.stack.imgur.com/tYUjP.png) when click weekly-seller-reports ![enter image description here](http://i.stack.imgur.com/N7kOI.png) and other problem is I duplicate same project and database in MAC OS wordpress_test1(original one) and other is wordpress_test2.But in wordpress_test2 project when I click menu items it will redirect to wordpress_test1 project page how can i fix this error?,plz need quick help... thanx


wp_editor is not working in admin_ajax.php

I am currently creating a plugin that have facility to drag and drop textarea and its content. With that i create shortcode for displaying textarea content in popup. I created one custom post type for that. All is working fine but wp_editor is not working with admin_ajax.php. Its simply displaying textarea with two tabs Visual and Text, the switching is also not working as it should. My code looks like:               $content = 'Hello';     $settings =   array(         'wpautop' => false,             'media_buttons' => false,         'textarea_name' => 'editor1',         'textarea_rows' => '10',         'tabindex' => '',         'editor_css' => '',          'editor_class' => '',                 'teeny' => false,          'dfw' => false,         'tinymce' => true,         'quicktags' => false          );          wp_editor('', 'editor1', $settings );


Combining two wordpress queries with pagination is not working

I am trying to combine two WordPress queries but it's not working as well as pagination. I want to display today's all posts sorted by comment count and after that I want to display all posts (excluding today's post) sorted by comment count. I believe these are the two queries to accomplish task separately. But how can I combines these so that new query lists today's posts first sorted by comment count and then rest of the posts sorted by comment count. And also with pagination.               <?php            $today = getdate();            $args1 = array(         'post_type' => 'post',         'orderby' => 'comment_count',         'ignore_sticky_posts' => 1,         'date_query' => array(           array(             'year'  => $today['year'],             'month' => $today['mon'],             'day'   => $today['mday'],           ),         ),         'paged' => $paged,       );            $query1 = new WP_Query( $args1 );            $args2 = array(         'post_type' => 'post',         'orderby' => 'comment_count',         'ignore_sticky_posts' => 1,         'paged' => $paged,       );            $query2 = new WP_Query( $args2 );          ?>      **EDIT: 1** // @birgire, I tried the method you suggested. But got this mysql error.               WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-5,5' at line 1]     SELECT SQL_CALC_FOUND_ROWS * FROM ( (SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND ( ( post_date > '2014-08-27 00:00:00' ) ) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') ORDER BY wp_posts.comment_count DESC LIMIT 1000) UNION ALL (SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND ( ( post_date < '2014-08-27 00:00:00' ) ) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') ORDER BY wp_posts.comment_count DESC LIMIT 1000 ) ) as combined LIMIT -5,5


translation does not work for 'Home'

Using the birdtips theme, translation of messages generally works, with some minor omissions. When I click on a page, a new line appears below the header image saying               Home >> MyPage      Now, "Home" is not translated to the language set in the locale, although the code invokes a translation function:               <?php _e('Home', 'birdtips'); ?>      The file `wp-content/languages/hu_HU.po` does contain the translation of this string:               msgid "Home"     msgstr "Kezdőlap"      Is this a bug in the theme? How can I fix this?


Error with function in functions.php?

I am using the below function in my custom theme to load posts via AJAX. But for some reason it is breaking the WP ADMIN WIdget Drag and Drop and also showing the White Screen of Death when I uploaded the theme to a live server. I can't figure out what is wrong I am doing. I have no white spaces on my fucntions.php               <?php     function mm_get_all_informations() {     ?>

                     Bank Name	                     Nature of Loans & Advances	                     Years	                     Loan Category	                     EMI	                     Total Amount Payable	                     Interest Rate %

                             <?php         /* the query */                   //$current_category = single_cat_title("", false);         $current_category = $_POST['category'];         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $bc_args = array(             // 'offset'=>2,             'post_type' => 'data',             'data-category' => $current_category,                 // 'order' => 'DESC',                 //  'meta_key' => 'interest_rate',                 //  'orderby' => 'meta_value_num',                 //'paged' => $paged,                 //'posts_per_page' => 1,         );                        $sortedPosts = new WP_Query($bc_args);                        $mm_page_no = 1;         $mm_count = 3;         $pagination_no = 1;         $pagination.='

«
';         $pagination.='
' . $pagination_no++ . '
';         ?>                 <?php while ($sortedPosts->have_posts()) : $sortedPosts->the_post(); ?>                          <?php                     $company_name = get_post_meta(get_the_ID(), 'mm_s_bank_name', '$single', true);                     $cat_meta = get_post_meta(get_the_ID(), 'mm_s_category', '$single', true);                     //$condition = get_post_meta(get_the_ID(), 'mm_s_condition', '$single',true);                     $emi = get_post_meta(get_the_ID(), 'mm_s_emi', '$single', true);                     $total_amount_payable = get_post_meta(get_the_ID(), 'mm_s_tap', '$single', true);                     $interest_rate = get_post_meta(get_the_ID(), 'mm_s_i_rate', '$single', true);                               $loan_amount = get_post_meta(get_the_ID(), 'mm_s_loan_amount', '$single', true);                     $loan_amount_max = get_post_meta(get_the_ID(), 'maximum _loan_amount', '$single', true);                               $years = get_post_meta(get_the_ID(), 'mm_s_years', '$single', true);                     $years_max = get_post_meta(get_the_ID(), 'maximum_years', '$single', true);                          //$condition = 'Minimum '.number_format($loan_amount).' BDT to Maximum '. $loan_amount_max.' BDT';                     $condition = number_format($loan_amount) . ' BDT to ' . number_format($loan_amount_max) . ' BDT';                          $year_range = $years . ' to ' . $years_max;                               $default_attr = array(                         'alt' => $company_name,                     );                     $id = get_the_ID();                     $desc = get_the_content();                     $content_array = array(                         'title' => $company_name,                         'Description' => $desc,                         'id' => $id                     );                     $modal_array[] = $content_array;                          $mm_count--;                     if ($mm_count == 0) {                         $mm_page_no++;                         $mm_count = 2;                         $pagination.='
' . $pagination_no++ . '
';                     }                     ?>                     <tr class="<?php echo 'info-' . $mm_page_no ?>">                         <?php the_post_thumbnail('bank-logo', $default_attr); ?>	                         <?php echo $condition; ?>	                         <?php echo $year_range; ?>	                         <?php echo $cat_meta; ?>	                         <?php echo $emi; ?>	                         <?php echo $total_amount_payable; ?>	                     <?php echo $interest_rate; ?>	                                                          <a class="btn-more" data-toggle="modal" data-target="#myModal-<?php echo $id ?>" href="#">More

<?php echo edit_post_link('Edit') ?>

                                     <?php endwhile; ?>                      <?php $pagination.='
»

'; ?>                   <?php wp_reset_query() ?>

                <?php // echo $pagination  ?>         <?php //echo $mm_page_nonation  ?>                                      <?php if ($modal_array != NULL) { ?>             <?php foreach ($modal_array as $modal) { ?>                                       <div class="modal fade" id="myModal-<?php echo $modal['id'] ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

                                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<?php echo $modal['title'] ?>

<?php echo $modal['Description'] ?>

                                 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

                            <?php } ?>              <?php         } else {             ?>

Sorry, no results found. Please try something different

         <?php } ?>                        <?php         die();         }              add_action('wp_ajax_get_data', mm_get_all_informations);         add_action('wp_ajax_nopriv_get_data', mm_get_all_informations);     ?>


Changing image URLs in media library

On a default wordpress install, the media library is located at: `/wp- admin/upload.php`. I am trying to update the image URL to point to my CDN, not my local server. This filter               add_filter('admin_post_thumbnail_html', 'my-function', 1000, 5);      will update the featured image URLs in the admin, but not the images in the media library list table. Is there a filter or action I am missing?


Changing the RSS feed titles not working

I'm trying to change my RSS feed titles to display the post type beforehand but it's not working. Code below. Any ideas? Thanks               function changeRSStitles($content) {          global $post;          if (get_post_type($post) == 'literature') {         $content = 'Literature: '.$content;     } else if (get_post_type($post) == 'recipe') {         $content = 'Recipe: '.$content;     } else if (get_post_type($post) == 'restaurant') {         $content = 'Restaurant: '.$content;     } else if (get_post_type($post) == 'post') {         $content = 'Sugar Street Blog: '.$content;     }else {         $content = $content;     }          return $content;     }          add_filter('the_title_rss', 'changeRSStitles');


Where do you upload images on a wordpress site?

I am very new to wordpress and learning on my own.I have started to create a website where I need to **upload images**. I want to ask if you all usually use the same database to store the image(if so, how?) or use a image uploading site? Thanks


Is there a way to password-protect part of a post?

Is there a way to have a page displayed to the public, but have an extra custom field that doesn't display unless a password is entered? I suppose I could do entirely manually without WordPress functions at all but I'd like to know if there was a WordPress solution.


Plugin html-on-pages: URL not redirecting

We decided to not use the .html on pages http://wordpress.org/extend/plugins/html-on-pages/ because its not supported already. This plugin puts an .html extension to all the pages. But after deactivating it, the URL's are not redirecting to the proper page. Need help? Any idea why this is happening?


Listing current pages subp page in list items in the sidebar

I'm wanting to list my current page's child pages as list items in the sidebar of my wordpress site. So far I've been referencing the http://codex.wordpress.org/Function_Reference/wp_list_pages I'm unsure how to set it to show just my subpages, so far I have this:               <?php $args = array(     'depth'        => 0,     'show_date'    => '',     'date_format'  => get_option('date_format'),     'child_of'     => 0,     'exclude'      => '',     'include'      => '',     'title_li'     => __('Title'),     'echo'         => 1,     'authors'      => '',     'sort_column'  => 'menu_order, post_title',     'link_before'  => '',     'link_after'   => '',     'walker'       => '',     'post_type'    => 'page',         'post_status'  => 'publish'       );            wp_list_pages($args);          ?>      It returns:               Title       Home        Child 1        Child 2       Sample Page      I'm just wanting the child pages (in this case 1 & 2). I don't want to show Home and Sample Page either. Any help greatly appreciated.


Possible to have one template call different sidebars for different pages?

I just learned (with help from Rob Vermeer!) how to use one template and be able to call different top graphics depending on the page and now I want to know if the following is possible: I'm using the page.php (default template) for several pages. Layout for those pages are the same but sidebar content on each page will be different. Rather than having to create separate page templates simply to be able to call different sidebars, can I write a function that would specify "if this page, call this sidebar"? At the codex, on this page http://codex.wordpress.org/Function_Reference/get_sidebar it has a section: Multi Sidebars. I tried adapting that code but it doesn't seem to work. It seems to be what I want, but in the examples it's using stock pages and my pages have custom names -- don't know if that's problem. Also, I'm calling the sidebars after the loop - don't know if that's the problem? My current (not working) code is:               <?php     if ( is_customer() ) :         get_sidebar('customer');     elseif ( is_vendors() ) :         get_sidebar('vendors');     elseif ( is_services() ) :         get_sidebar('services');     else :         get_sidebar();     endif;     ?>      I have sidebars called sidebar-customer, sidebar-vendors, sidebar-services, and pages called customer, vendors, services, etc. I have the code in the page.php template in the place where, if I had one sidebar I would simply have:               <?php get_sidebar(); ?>      Help greatly appreciated! * * * @m0r7if3r I think you're coming the closest to what I'm trying to do but not exactly. The site is not a blog, first of all. It consists of several "static" pages. I have a homepage template just for the home; the page.php (default) template for most of the internal pages, a 404 template and a small one-column template for little pages. The page.php template has 2 columns - a wider area for the main content, and a narrow column to the right. I want to use the right columns as "sidebars" but the content of the sidebars will be different for each page. So, say I have pages like: Customer Service, About Us, Services, and Contact. I want to use the page.php template for all of them, but the sidebar content will be different for each. In the past I would register 4 (or 5 or however many I needed) sidebars, and then create separate templates, the only difference in the templates being that they call different sidebars. I just wondered if there was a neater way of doing this. My idea was that I would have a sidebar that went with each page and basically would do an if/then in the page.php where I would normally call the sidebar: if this is the customer service page, call the customer service sidebar; if this is the about page, call the about sidebar. But I don't know if that's possible and if it is, precisely what the exact steps and wording would be. I don't know if I'd use the page names, ID's, etc. I assume I would need the created pages and the registered sidebars but after that I'm not sure what to do. I thought it was possible because of the "Multi Sidebars" section on the "get sidebar" functions page in the codex but I'm probably misunderstanding it. I have the link in my first entry; scroll down on the page and see Multi Sidebars. ? Thanks!


How to add a notification/inbox to user interface?

I want to notify a user in their user menu/interface when their post has received a comment. As it is now they're only aware of it through a email that my wordpress sends them. So I want to add like an inbox that we have here on stackexchange.


Localization issue. Codestyling localization, incompatible theme

(I modified the question. i .e. I added hyperlink) My website uses Jobroller theme. The problem is that it is not compatible with WPML I am translating themes using codestyling localization [Link to the code. It is compressed][1] Could you give me some instructions on what I need to do from here? Jobroller does not seem to be compatible with codestyling localization. If I am using an incompatible them, is there a way to achieve compatibility? ( I have added some of the source codes) [1]: Code http://cafeattach.naver.net/a732bb081c2c2d9db35c320338dca1da782ad1f4/20130527_261_cafefile/24495556_1369658452761_pDfySc_zip/sample_source.zip?type=attachment


Have Plugin Handle Specific URLs

Does Wordpress have the ability to use the currently defined template to serve up content in the database? For example, I have a database of a bunch of custom content-- the name of an item, the price, etc. I want all requests for http://myshop.com/buy/* to be redirected to the plugin (so that the plugin handles the content generation), where the * is an item number or some other parameter. Can I use the Wordpress template and display my custom content? I would be handling all of the HTML generation for inserting into the template... The best example I can find is the WP Ecommerce plugin here: http://getshopped.org/. Basically, the plugin is handling the checkout page (/checkout in most cases, /icons/checkout on IconDock). How can I do this?


Already have htaccess but permalink settings not working. Getting 404

I have a .htaccess file               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>      the config for the vhost looks like               <VirtualHost *:80>         ServerName elements         DocumentRoot /works/web/elements         <Directory /works/web/elements>             Options Indexes FollowSymLinks MultiViews             AllowOverride All             Order allow,deny             allow from 127.0.0.1         </Directory>     </VirtualHost>      But I am still getting 404 when I view pages, why is that?


widget dropdown menu code

I'm trying to put in a simple dropdown menu in my widget. I copied one out of a previous widget and trying to substitute my own values into it. The submenu shows, but when I click save, it saves only the first selection (design 1). Actually, I echoed the value on the widget and all of the options displayed. What would a simple widget drop down menu look like? As for my code, I think I need to get that "true" out of there and replace it with Design#               <label for="<?php echo $this->get_field_id('fold_design'); ?>"><?php _e('Display style:'); ?></label>              <select id="<?php echo $this->get_field_id('fold_design'); ?>" name="<?php echo $this->get_field_name('fold_design'); ?>" class="widefat" />                 <option <?php selected( 'Design1', $instance['fold_design'], true ); ?>>Design 1</option>                 <option <?php selected( 'Design2', $instance['fold_design'], true ); ?>>Design 2</option>                 <option <?php selected( 'Design3', $instance['fold_design'], true ); ?>>Design 3</option>                 <option <?php selected( 'Design4', $instance['fold_design'], true ); ?>>Design 4</option>                 <option <?php selected( 'Design5', $instance['fold_design'], true ); ?>>Design 5</option>                 <option <?php selected( 'Design6', $instance['fold_design'], true ); ?>>Design 6</option>                 <option <?php selected( 'Design7', $instance['fold_design'], true ); ?>>Design 7</option>             </select>


Test to see if jQuery or Prototype is queued by another plugin?

In my plugin, I want to test to see if jQuery or Prototype (or both) are going to be loaded by another plugin. So, have `wp_enqueue_script('jquery')` or `wp_enqueue_script('prototype')` has already been called. I have code appropriate to my plugin in files `plugin.prototype.js` and `plugin.jquery.js` and if Prototype is queued, my plugin will use `plugin.prototype.js`. This way I avoid loading more than necessary into the site. If neither has loaded, I will queue up whichever is smaller. How can I test to see what has been queued up? How do I make sure my code runs last?


styling the contents

I am newbie to wordpress and just started to play with themes. My problem is I want to change the css of the content part and for that I want to know by default the content comes in the blog page comes from which page. I made echo from many pages but not got any result. Can any one tell me all the contents comes from which page?


Make menu items open in new tab/page

How do I make menu items open in a new tab/page instead of replacing the current page?


Adding existing links to custom navigation menus?

When I visit _Appearance → Menu_ , I can add custom links, but not any links I've already created under _Links_. How can I do this?


Getting a 404 in Debugger for example.com/wp-admin/Array?

For some reason when I go to one of my clients WordPress installations, and I install a plugin that I made which has custom TinyMCE buttons, when they click on one of the buttons the popup appears but there's no text. In the JavaScript console of Google Chrome before I even click the buttons, there is the following: `Failed to load resource: the server responded with a status of 404 (Not Found) - Array - http://mywebsiteurl.com/wp-admin/Array` Could that have something to do with my plugin or their installation of WordPress? Thanks for the help.


Scripts at the end of the page

If I wanted to put the scripts that all my plugins use at the end of the page, where would I do this? Using YSlow/Firebug it recommends this tactic.


OEMBED seems to have stopped working

I had upgraded from 3.0 to 3.1 and oembed worked normally. All of a sudden I've lost embedding when directly pasting video url into the editor. My embed setting is selected under "media". Any ideas what could be going on? I've changed themes, ultimately to the native 2010 and still no function. I've tried turning the embed setting on and off in the admin as well to no avail.


Email notification of new posts that match query

I'm creating a real estate site that will have a search functionality (beds, baths, price range, neighborhood, etc). When presented with the search page, the URL will have a nice long query string to it. I want to allow the site visitor to subscribe, either via RSS or email so that when a new listing that matches that criteria is posted, they get a notification. I _believe_ if they just add "/feed" to the end of the URL, that'll give them an RSS version, so if that's correct, that'll be easy to implement. But I'm not sure how to allow the to subscribe via email. All the solutions I've found so far seem to notify on all posts, a couple will allow you to subscribe via category, but I'm not finding any that do it via search query. If it helps, I have both Gravity Forms and Formidable Pro. Thanks!


Using the ABSPATH constant - What files need to be loaded before use?

I need to make use of the ABSPATH constant but need to know what WP files I need to include so I can make use of it. Thanks a lot!


Plugin to import/export wp_options

I'm considering building a plugin which can export and import a site's custom options settings. On export, it simply pulls all of the custom options from wp_options and create a zip file of them (perhaps as a csv or xml). On import, it would take the zipped data file and extract it into the site's wp_options table. I'm sure this is not as easy as it sounds? What are some of the potential challenges? That's option #1. Option #2 would be quite a bit more controlled in that it would only export those options which were prefixed with "my_" for example. In that way, I'd be only grabbing the options that I know are my custom options. Any ideas or thoughts? The next logical step would be to essentially create a clone file of the site, with all plugins, themes, posts, pages, tags, comments, categories, etc... This clone file could be imported into an empty site, thus creating a baseline site in seconds.


Align thumbnail

I've created my own template yet I can't figure out how to specify CSS attributes to an individual $lcp_display_output option. In this case I'd like to align the thumbnail to none to allow the excerpt to display to the right of the tn. How can I accomplish that?


How do I change the permalink structure without getting 404s?

after updating the permalinks from the default /?p=N to another setting (e.g. /%year%/%monthnum%/%postname%/) all my old links are broken and also the archive, catgories etc. side bars get 404 errors. How can I avoid this (or redirect) without changing the .htaccess (which I can't access using my hosting package)? Any suggestions or plugins that work with my current version (WP 3.1) are welcome! Thorsten


Check for and enforce unique value in user-entered custom meta field in WP Admin

I am trying to figure out how, on a new or edit post screen, to allow the user to enter a custom meta item, BUT force it to be unique. Ideally the process would work like so:   1. Contributor logs into WP Admin and chooses New Post   2. In custom fields area, they choose the key (something like "group-title") and then enter their value   3. some ajaxy thing verifies whether this value exists in the db, and warns them to pick another value if it does   4. Post will not save or update unless value is unique In my search of previous items, I found this post but it doesn't seem to help with the ajaxy checking nor prevent submit in admin.


Custom Post Type as invoice or order template

On homepage I would like to insert form that collects client details and saves it to wordpress backend. I was thinking to use custom_post_type               register_post_type('invoices',             array(                 'labels' => array(                     'name' => __('Invoices'),                     'singular_name' => __('Invoice')                 ),             'public' => true,             'has_archive' => false,             'supports' => array('title')             )         );        1. How I remove ability to publish? and view post / slug forms? This invoices won't be published on homepage. So is there a way to make `post_type` private? I thought `'public' => false` would do the trick, but this hides from dashboard.   2. I would like to add fields, like name/email/type of service. Is the only way to do this by adding add_meta_box?   3. How do I pass data from unauthenticated visitor on homepage to wordpress?


How to prevent spam users registering even with registration disabled

I have Wordpress Multisite with bbPress. I've disabled new user registration from network settings but I still seem to get new registrations regardless. I've read that bbPress is most likely the cause but I don't know how to prevent the registration. I use Wanguard and bbPress moderation plugins so I am preventing them from actually posting anything but is there a way of stopping them from getting in to begin with?


Validating custom meta boxes with jQuery results in posts being saved as draft instead of published post

I have a custom post type with a bunch of custom fields. I want to validate the meta box input with jQuery as soon as you press the Publish button. Here's what I have (I left out all my validation stuff):               $("input#publish").click(function(e){         e.preventDefault();         $("#ajax-loading").show();         $('form#post').submit();     });      As you can see I am only interrupting the form submit at this point, nothing else going on. However, posts are now saved as drafts only and I can not manually set them to published (I have administrator priviliges). As soon as I remove above code, all is back to normal. Is there any way to get this type of client side validation working properly without using plugins? I'm on Wordpress 3.6.1.


Cite-Tag for blockquotes

I want to have a cite underneath my blockquote, that has a certain style.               "Blockquotes are an essential part of a fancy website."                                                     – Cite      The markup should look like this:

Blockquotes are an essential part of a fancy website."
     Cite
      But the WYSIWYG-Editor does not offer me the possibility to define a cite for the blockquote. And I can't force my users to write the HTML by hand. Is there a way to make the WYSIWYG-Editor generate the required markup?


Display all posts that use a custom taxonomy

I'm trying to display all the posts that use a custom taxonomy. I believe the issue is that it is my code is not generating an array of terms.                $clients_terms = get_terms('clients');              $clients_query = new WP_Query( array(           'post_type' => 'work',           'posts_per_page' => 4,           'tax_query' => array(             array(               'taxonomy' => 'clients',               'field' => 'slug',               'terms' => array($clients_terms->slug)             )           )         ) );         if ( $clients_query->have_posts() ): ?>
           <?php while ( $clients_query->have_posts() ) : $clients_querys->the_post(); ?>
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?>
           <?php endwhile; wp_reset_postdata(); ?>
      I'm able to generate posts for individual terms but not for all posts that use the taxonomy .


Plugin for conditional redirect

Lets say, I create page1 and page2 in wordpress, in Page1 there is a hyperlink which takes me to page2. How do I ensure that visitor has clicked that hyperlink and have come to page2 and not directly on page2, by typing page2 url in the address bar. if someone has come directly to page2 I want them to be redirected automatically to page1. In old days I was able to crack this with some javascript and and later also in ASP. If I recollect correctly had used querystring and url redirect. What is easy way in wordpress? unfortunately in wordpress plugin directory all I am getting is plugins for 404 and 301, Please help me here.


Trouble in creating a custom template on twentyeleven theme

I am trying to extend the twentyeleven theme's sidebar template. My custom template (its incomplete) is as follows:               <?php     /**      * Template Name: Quote Request      * Description: A Page Template that is a free quote request form      *      * @package WordPress      * @subpackage Twenty_Eleven (Custom)      * @since Twenty Eleven 1.c      */      get_header(); ?>

                          <?php while ( have_posts() ) : the_post(); ?>                              <?php get_template_part( 'content', 'page' ); ?>                              <?php comments_template( '', true ); ?>                          <?php endwhile; // end of the loop. ?>

          <?php get_sidebar(); ?>     <?php get_footer(); ?>      I just name a copy of sidebar-page.php which I belive is used for creating Sidebar template pages. But I don't get the intended results. Here is what I get: ![My template result](http://i.stack.imgur.com/KkrPf.png) But when I select the sidebar template from the editor, I get: ![Sidebar template](http://i.stack.imgur.com/GYdMb.png) I am trying to acheive this before I add my custom page elements. Can somebody point me to correct direction? I am just starting on wordpress.


Removing the title attribute from links in the post content

When using the WYSIWYG editor to create links, and selecting an existing page or post from the selection list, those links will have a `title` attribute by default. Is there a simple way of turning off this behaviour? I would like turning it off at its root (i.e., in the WYSIWYG editor) rather than hooking into the final result when it is output. Is there any way to do this that doesn't require JavaScript (here is a solution that does) and doesn't require manually parsing the attribute out of the final HTML end result? Googling stuff like `wordpress remove title attribute post content` doesn't seem to yield any helpful information - what they show is mostly removing the attribute from menus and page lists.


wordpress $wpdb works only once

I am working on a plugin that needs to run many different queries. I created a class that has many functions and all these functions runs different queries. A DAL basically. Now when I call these functions in my program, all of them work fine but only one of them runs its query. All other queries in all other function calls don't run. All the functions run their queries fine if I call only one function in the program. I cant figure out what the problem is ? here is some code THE CONTENTS BELOW HAVE BEEN ADDED LATER These are the real functions that are giving me trouble. I call all of them, they all work. But only one of them(the one called last) runs its query. They all run their queries fine if I call only one of them.               class seoklaxxdataAccess{          function addKeyword_start($row_id, $row_keyword, $oldKeyword, $seo_pageContents){              try         {             global $wpdb;                  $seo_tblPosts = $wpdb->prefix."posts";                  // COMMENT: gets the length of old keyword             $org_keywordLength = strlen($oldKeyword);             $keywordLength = $org_keywordLength+3;                  $seo_checkKeyword = substr($seo_pageContents, 0, $org_keywordLength);                  if($oldKeyword){                 if($seo_checkKeyword==$oldKeyword){                          $seo_pageContents = substr($seo_pageContents, $keywordLength);                 }                 $seo_pageContents = $row_keyword.' - '.$seo_pageContents;                  }else{                 $seo_pageContents = $row_keyword.' - '.$seo_pageContents;             }             //echo $seo_pageContents."
";             $wpdb->update($seo_tblPosts, array('post_content'=>$seo_pageContents), array('ID'=>$row_id));         }              catch(Exception $e)         {             return "not working:".$e->getMessage();         }          }          function addKeyword_end($row_id, $row_keyword, $oldKeyword, $seo_pageContents){              global $wpdb;              $seo_tblPosts = $wpdb->prefix."posts";              // COMMENT: gets the length of old keyword         $org_keywordLength = strlen($oldKeyword);         $keywordLength = $org_keywordLength+3;              $seo_checkKeyword_end = substr($seo_pageContents, -$org_keywordLength);              if($oldKeyword){             if($seo_checkKeyword_end==$oldKeyword){                 $seo_pageContents = substr($seo_pageContents,0 , -$keywordLength);             }             $seo_pageContents = $seo_pageContents.' - '.$row_keyword;              }else{             $seo_pageContents = $seo_pageContents.' - '.$row_keyword;         }         $seo_sqlcommand = "UPDATE ".$seo_tblPosts." SET post_content = '".$seo_pageContents."' WHERE ID = '".$row_id."' ;";         //SELECT * FROM wp_seo_keywords WHERE id = ".$row_id.";";         //echo "done".$seo_pageContents."
";         $wpdb->get_var($wpdb->prepare($seo_sqlcommand));     }      } This how I instantiated the class               $seo_dataAccess = new seoklaxxdataAccess();      and this is how I am calling the functions               $seo_dataAccess->addKeyword_start($row_id, $row_keyword, $oldKeyword, $seo_pageContents);          $seo_dataAccess->addKeyword_end($row_id, $row_keyword, $oldKeyword, $seo_pageContents);          $seo_dataAccess->addKeyword_middle_bold_linked($row_id, $row_keyword, $oldKeyword, $seo_pageContents);


Query posts and filter at query time by value of custom meta

I have a wordpress query for a custom post type, but I want to filter the results depending on the value of a custom meta.                   <?php $my_query = new WP_Query('post_type=prizes&showposts=3&orderby=rand');     while ($my_query->have_posts()) : $my_query->the_post();      $do_not_duplicate = $post->ID; $my_meta = get_post_meta($post->ID,'_my_meta',TRUE); ?>          <?php if(($calctotalnew - number_format($cart->total,2)) >= $my_meta['pointsvalue']){ ?>
             <a href="<?php the_permalink();?>"><?php the_title();?>

<?php echo $my_meta['pointsvalue'];?>

                 <a href="<?php the_permalink();?>"><?php the_post_thumbnail('thumb');?>

          <?php }       Thats my code. Bascially the IF statement in the loop filters the results, but I need them filtering as they are queried because it doesnt always show exactly 3 posts (as some posts will have a value above what if filtered in the IF statement. Any thoughts? Thanks


Sending form data via PHPMailer - How to action PHP script from a form

Some easy points on offer... I wish to action a PHP script from a WordPress page but where is the best place to store the script? The script works perfectly fine using a non- WordPress environment in a flat HTML directory structure. and I want to action it from the page using the following code:               <form class="contact_form" form action="phpmailersub.php" method="post" enctype="multipart/form-data" name="contact_form" onsubmit="return validateForm()">      What will then go into form action="file" ? At current the submit action is searching for a page `http://current/route/to/contact-test/phpmailersub.php` but obviously, WordPress cannot find it. Your help would be very much appreciated! If I can do anything to articulate my query or if you need any additional material I will try my best to help. **UPDATE** At current the PHP file (phpmailersub.php) and class.phpmailer.php sits in: http://damtech.it/demo/etap/wp-content/plugins/phpmailersub.php and my current code looks like this:               <form class="contact_form" action="<?php bloginfo('http://damtech.it/demo/etap/wp-content/plugins/'); ?><p>/phpmailersub.php" enctype="multipart/form-data" method="post" name="contact_form" onsubmit="return validateForm()">

     <input type="text" name="cf_mercury" required="" />	        Name*

     <input type="email" name="cf_jupiter" required="" />     Correct format "name@url.com"	        E-mail*

     <textarea name="cf_uranus" required="" rows="6"></textarea>

     <button class="submit" onclick="document.getElementById('contact_form').submit()" type="submit">Send message</button>	     <button class="reset" style="color: #3c4247; letter-spacing: -0.5px;" onclick="document.getElementById('contact_form').reset()" type="reset">reset</button>

     </form>


Approve modified posts

I would to be able to re-approve my contributor's edits to an already published post. I.e, when they edit a post - it gets sent back for approval. Is there a way to do this?


Dynamic Image Replacement through call rail phone call tracking plugins in wordpress

I want to dynamically swap an image that contains a phone number. I followed steps given in http://www.callrail.com/docs/web- integration/dynamic-number-insertion/images/ but images not swapped. I installed plugin _CallRail Phone Call Tracking_ and set the api key through call rail account and paste the javascript code in the footer of the page. I saved the image of destination number tollfree.png in the image folder on the webserver wiith your prescribed naming convention i.e tollfree.8005676745.png Then I saved the tracking numbers images with the same naming convention i.e tollfree.8889975025.png (8889975025 is tracking no. ) in the same image folder on the webserver. Then I replaced the references i.e url("images/TollFreeOverlay.png") to url("images/TollFreeOverlay.8005676745.png") _Earlier code :_

     and *given the reference through css *     #tollfreeoverlay {     background: url("images/TollFreeOverlay.8005676745.png") no-repeat     scroll 0px 0px transparent;     height: 32px;     position: absolute;     right: -120px;     top: -310px;     width: 540px;     z-index: 99;     }      After that I moved it to an inline style inside the body i.e

      other images also saved in the same folder with the same naming convention but still image not swapped.... When i search my website through google search image didn't swap bt in call rail account it maintain the log that i search through google organic. 888-997-49826 minutes agoGoogle Organic I want to swap the images as per callrail logs.So plz suggest the solution for the same


Displaying content to search engines but via navigation only for registered users.

Displaying certain information depending on if a user is registered is quite easy as I have been using this code                  <?php if (current_user_can(‘subscriber’)) { ?>     [content here]     <?php } ?>      However, is there any way that this content is visible if somebody directly comes to the link via a search engine or link but not via the archive pages /site links. Help is appreciated.


Check to check if wp_mail is working properly?

I'm trying to use `wp_mail` (testing on local machine) but no mail is received. The `php.ini` has `smtp_port = 25` set and the php `mail()` is working so far.   * how can I check if wp_mail is working   * what can fail Here is the code of my mail function:               function mv_optin_mail($id, $data){              $url = $id."-".mv_mail_token($id, $data['token']);              add_filter( 'wp_mail_content_type', 'set_html_content_type' );         add_filter( 'wp_mail_charset', 'utf8' );              $headers[] = 'From: '.sender_signature.' <'.noreply_address.'>';                  ob_start();         include("optin-mail.php");         $html_mail = ob_get_contents();         ob_end_clean();              wp_mail( $data['email'], 'Some Subject', $html_mail, $headers );         remove_filter( 'wp_mail_content_type', 'set_html_content_type' );         remove_filter( 'wp_mail_charset', 'utf8' );     }      I don't get any errors. Is there a way to toggle error-loggin for wordpress? The `noreply_address` is `noreply@root`


Pagination and multiple loops

Right, so what I currently have is a page split into three using a css grid. The third column is the sidebar, The first two each have a query for posts to display, and create a nice grid of posts (dummy content): http://puu.sh/2Xh9o.jpg Each loop looks like this:                   <?php query_posts('showposts=5'); ?>     <?php $posts = get_posts('numberposts=5&offset=0'); foreach ($posts as $post) : start_wp(); ?>     <?php static $count1 = 0; if ($count1 == "5") { break; } else { ?>     -----Content -----     <?php $count1++; } ?>     <?php endforeach; ?>      This shows five posts in the first column, and the second loop displays five posts _after_ (offset=5) the first five in the second column, totaling ten on the page and read top-bottom left-right. Naturally, this creates a problem with pagination. What I would like to do is have the posts listed from left to right (but retain the fluid look it currently has with different sized posts) across both columns, or a tleast appear to (I can merge the columns into a two third/one third split), and when reaching the bottom, load the next 10 or so posts automatically (ultimately infinite scroll, but pagination first). I'm not a php'er, and to be honest I don't understand most of this code. I've built this with help from the wordpress codex and sites like this, but have come to a stop. Any copy-pastable or easy to understand advice/answers are much appreciated.


How to append new form elements in "Add New" form of Users in Wordpress admin panel?

I'm developing a WordPress plugin and I want to append some extra form fields in add new form of Users section inside admin panel without editing core files. Can somebody help me in achieving this.


How can I add Wordpress Audio Player as featured audio in Audio Blog Posts?

I'm creating a Wordpress blogging theme and have started doing the individual files for each post-format. In doing this I've encountered a problem for the functionality to the audio format. I would like to have whatever audio file the user uploads as a featured audio that will be displayed and playable over the title of the post. I've created somewhat of a fix for the problem using the_content twice in the same loop and removing everything but the audio player using css in the first "the_content". So the basis of my layout looks something like this:               the_post_thumbnail();     the_content(); (this I have given a class and display: none; for everything but the audio player)     the_title();     the_excerpt();     the_content();      This however doesn't work as well, as in some situations the layout breaks, and text from the post appears dependent on when I embed the audio on the page. I'd like to find a more correct solution to this and not be all ghetto in my code. Appreciate all help given :) Michael **EDIT** This code creates a dropdown list of all the media files uploaded that is audio:                   add_action("admin_init", "audio_init");         add_action('save_post', 'save_audio_link');         function audio_init(){                 add_meta_box("mp3-audio", "MP3 AUDIO", "audio_link", "post", "normal", "low");                 }         function audio_link(){                 global $post;                 $custom  = get_post_custom($post->ID);                 $link    = $custom["link"][0];                 $count   = 0;                 echo '
';                 $query_audio_args = array(                         'post_type' => 'attachment',                         'post_mime_type' =>'audio',                         'post_status' => 'inherit',                         'posts_per_page' => -1,                         );                 $query_audio = new WP_Query( $query_audio_args );                 $audio = array();                 echo '<select name="link">';                 echo '<option class="audio_select">SELECT AUDIO FILE</option>';                 foreach ( $query_audio->posts as $file) {                    if($link == $audio[]= $file->guid){                       echo '<option value="'.$audio[]= $file->guid.'" selected="true">'.$audio[]= $file->guid.'</option>';                          }else{                       echo '<option value="'.$audio[]= $file->guid.'">'.$audio[]= $file->guid.'</option>';                          }                         $count++;                 }                 echo '</select>

';                 echo '
Selecting an audio file from the above list to attach to this post.
';                 echo '
Files: '.$count.'
';         }         function save_audio_link(){                 global $post;                 if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE){ return $post->ID; }                 update_post_meta($post->ID, "link", $_POST["link"]);         }         add_action( 'admin_head', 'audio_css' );         function audio_css() {                 echo '';         }         function audio_file_url(){                 global $wp_query;                 $custom = get_post_custom($wp_query->post->ID);                 echo $custom['link'][0];         }      This is the section of my current audio-format template attempting to fetch the audio-url and display it in the built in audio shortcode:
                 <?php the_post_thumbnail(); ?>                 <?php $audio_url = get_post_meta($post->ID, '$key', true); //this is getting your custom field url ?>                 <?php $attr = array(                     'src'      => $audio_url,                     'loop'     => '',                     'autoplay' => '',                     'preload' => 'none'                     );                 echo wp_audio_shortcode( $attr ); ?>                 <?php do_shortcode('[audio URL=". $audio_url ."]') ?>


Add TinyMCE to CPT metaboxes in 3.1?

Been looking around for an alternative to this method: http://allcreatives.net/2011/02/02/using-the-native-wordpress-tinymce-wysiwyg- editor-with-your-custom-post-meta-textareas/ To add the WYSIWYG capability to custom metaboxes. You get so little control with this method, is there any other way?


Invalid post type admin

I've added some custom post types, but for some reason I keep getting this message: 'Invalid post type' whenever i try to search a post in the backend or when I try to do a bulk action. Hope someone can tell me whats wrong. I've disabled the custom post types but that didn't help.


How can I modify the header of RSS feed items?

Specifically I would like to change the value of `<dc:creator>` in the feed items. In order to display the site name instead of the post author. I'm able to hook into `the_title_rss` , `the_excerpt_rss` and `the_content_feed`, but can't find how to change the header elements of a feed item.


wordpress wp_list_pages help

In my wordpress enviroment, I have a number of pages, and I also have a custom post type called casestudy. I have setup a page-clients.php that has some of it's own content on, I then use the `query_posts()` function to pull in all the posts with the post type casestudy. When viewing a single case study I wanting to show a nav, this nav needs to contain the links to pages, clients, and case study and underneath case studies I want to add all the posts that are of the custom post type 'casestudy' so far I have following, `<?php wp_list_pages(array('include' => '154, 136', 'title_li' => '', 'sort_column' => 'ID', 'sort_order' => 'DESC', 'depth' => '1')); ?>` How can I lists all the casestudy posts also, can it be done with `wp_list_pages()`


Wordpress 3.9 Database Update Infinite Loop

I recently updated my blog's Wordpress version to 3.9. After running the update I received this message upon trying to access the admin panel. > Database Update Required > > WordPress has been updated! Before we send you on your way, we have to > update your database to the newest version. > > The update process may take a little while, so please be patient. I am presented then with a button " **Update Wordpress Database** ". When I click the button, after a short pause I am presented with the following message. > Update Complete > > Your WordPress database has been successfully updated! Great. Except that whenever I try to access the admin panel I am re-presented the first message asking me once again to update my database. Does anybody know of a way out of this infinite loop?


wordpress script registration

function script_registration(){     wp_register_script( 'jquery' , get_template_directory_uri() . 'js/jquery.min.js');     wp_enqueue_script('jquery');     }          add_action('init','script_registration');      So that's what I have to load jquery. It's been placed in functions.php. Functions.php is running but upon load jquery isn't being included in the page.


Add filter menu to admin list of posts (of custom type) to filter posts by custom field values

This answer is very close to what I am looking to do, but instead I would like to specify a specific custom field and display a select menu of its available values. Thanks!


Does wordpress allow me to add a php file to the root directory to execute custom scripts? I need functionality similar to functions.php that you put into themes. Are there any work arounds that don't involve modifying the config.php file?


get IDs from links categories

How can I get the IDs of all my links categories? I'm writting a plugin to bookmark more easy using `wp_insert_link()` function. Any ideas?


Keyword search limited to specific post type filtered by multiple custom taxonomies?

Is it possible to limit a search for keywords to a specific post type (say 'news') but filter the results by selected custom taxonomies?   * I have a news section.   * This has the custom post type called 'news'.   * This then has the custom taxonomy 'news-category'.   * There are several custom taxonomy terms that need to be listed with checkboxes next to them. Say for instance someone wants to search for the keyword "Wales" and they check the custom taxonomies "Medical" and "Financial", then it displays the results by those search queries. To sum up, they are only searching within the news post type which is filtered by the custom taxonomies and keyword. Is this possible? If so, how? * * * UPDATE: I have a template called archive-members.php with the following, how can I wrap all this with the necessary code to show a search with keyword+category, just keyword or just category.               <?php     /**      * @package WordPress      * @subpackage Default_Theme      */          get_header();     ?>                                    <div class="post" id="post-<?php the_ID(); ?>">

Search
                             <form id="custom-search" action="<?php bloginfo('url'); ?>/" method="get">                             <?php //Get all (non-empty) terms for taxonomy 'news-category'                             $args = array('orderby' => 'name','order' => 'ASC');                             $categories = get_terms( 'members', $args );                             ?>
Keyword
                             <input type="text" class="keyword" name="s" value="" />

Specialisms
                             <?php //Display checkbox for each term                             $counter = 1;                             foreach ($categories as $category) {                                 echo '<input type="checkbox" id="field-'.$counter.'" class="mycheckbox" name="mw-filter-terms[]" value="'.$category->slug.'">';                                 echo ''.esc_html($category->name).'';                             $counter++;                              } ?>                                                               <input type="hidden" name="post_type" value="members" />

                                                          <button class="blue medium awesome awesomeforward awesomesearch" type="submit">Search</button>                             </form>

Members Directory

                                 <?php the_field('content', 1886); ?>

                                 <a class="blue medium awesome awesomeforward" style="margin-left:193px;margin-bottom:10px;color: white !important; " href="<?php bloginfo('url'); ?>/member-signup/">Become A Member

Search Results

                             <?php $portfolioloop1 = new WP_Query( array( 'paged' => get_query_var('paged'), 'order' => 'ASC', 'orderby' => 'title', 'post_status' => 'publish', 'post_type' => 'members', 'posts_per_page' => 300 ) ); ?>                             <?php while ( $portfolioloop1->have_posts() ) : $portfolioloop1->the_post(); ?>                             <div <?php if (get_field('logo') != "") { ?>style="height:120px;"<?php } ?> class="news-item" onclick="location.href='<?php echo the_permalink(); ?>'">                                 <?php if (get_field('logo') != "") { ?>

                                                                                <img style="margin-right:15px;" src="<?php echo the_field('logo'); ?>" width="150" alt="<?php echo the_title(); ?>" />

                                 <?php } ?>                                 <div <?php if (get_field('logo') != "") { ?>style="float:left;width:379px;"<?php } ?>>
<a style="color:#AA3CA7!important;" href="<?php echo the_permalink(); ?>"><?php echo the_title(); ?>

                                         <?php $description = get_field('description');                                         echo substr($description,0,300) . "..." ?>

                             <?php endwhile; // end of the loop. ?>

              <?php get_footer(); ?>


WordPress Following? Social Users?

I'm building an extensive user backend on a WordPress news website. One of the features I've noticed many major sites have is the ability for logged in users to follow headlines from users or categories they select. Forbes took the technology from TrueSlant in its acquisition and I know as a fact it is WordPress. Is there a similar plugin or tutorial that can help me achieve the same? I've been looking and can't find one. Examples: http://blogs.forbes.com/luisakroll/ http://trueslant.com/level/ Mashable.com (if you login)


Removing jQuery from footer

I am working with HTML5 Blank and I can't seem to get jquery to stop being called in wp_footer(). I have tried adding this to the bottom of my functions file:               function theme_slug_dequeue_footer_jquery() {      wp_dequeue_script( 'jquery' );     }     add_action( 'wp_footer', 'theme_slug_dequeue_footer_jquery', 11 );      with no luck. I also tried:               if( !is_admin()){     wp_deregister_script('jquery');     wp_dequeue_script('jquery');}      but I still end up with `/wp-includes/js/jquery/jquery.js?ver=1.8.3` being called in the footer. What am I doing wrong here?


How to add oEmbed support to my theme?

oEmbed does not seem to work on my theme. I simply see the bare URL. I haven't been able to find instructions on how to implement it. Thanks.


Most efficient way of deleting post

I have a cron job set to remove a (sometimes large) number of posts from my database. Of course, I also need to remove all associated data such as custom fields. This is the function I'm currently running, but it's taking a bit long to delete everything. Would it maybe be more efficient to make a direct SQL query?                   /**      * Delete all items      *       */         function myplugin_delete_all_items() {                 $args = array(                 'post_type' => 'my_post_type',                    'posts_per_page' => -1,          );              $items = new WP_Query( $args );                if ( $items->have_posts() ) :             while ( $items->have_posts() ) : $items->the_post();                 $postid = get_the_ID();                      $purge = wp_delete_post( $postid, true );                             endwhile;         endif;              wp_reset_postdata();     }


WordPress Terminology Options Vs. Settings

What term should be used when defining a page in the admin menu that allows you to change a plugins options?


if else for custom $curauth-> field

So I have a custom field on the author page, where a user uploads a image which will be used as a background image on their author page. I've setup up everything except I'm not sure how to setup a conditional to display a default image when the user hasn't upload his/her own image. The custom $curauth-> field is called user_banner. So basically: [if user_banner] The image would be displayed here. [else] The default image would go here. [end] Any ideas?


Every time I update or install a plugin I get "Error Establishing a Database Connection in WordPress"

At first I thought it was a resource issue because I'm only using the lowest AWS ec2 instance, but now I think it might be something else. I Google'd about a bit as it seems to be a common problem but couldn't find my issue, it only seems to happen when I update or install a plugin. Rebooting my EC2 instance fixes the problem so either I have to upgrade my instance or it's a database issue. Could someone point me in a direction on how to find out if it's a database error?


Add on the fly tabs to plugin options

Hi I am building a plugin options page. What I'd really like to do is implement repeatable tabs (which I know is possible with the Settings API), but with a twist I haven't seen in any options panel till now. I'd like to create new tabs on the fly, exactly like the 'Menus' section in the admin UI works. Is there any standard way to do this?


Removing feeds from header using a function?

I want to remove the default RSS feed, which I can successfully do by adding this in functions.php file.               remove_action( 'wp_head', 'feed_links', 2 );      However, It is important for me to use this in a function instead of using directly. For that purpose, I'm trying following:               function remove_rss() {          remove_action( 'wp_head', 'feed_links', 2 );     }     add_action('wp_head', 'remove_rss');      but that does not work. I think the reason is the wp_head loads after the feeds are loaded in the header. How can I make it load before the header adds the feeds? Thanks.


Problem loading custom post type admin page

I have a custom post type "Properties". I have around 11,000 entries and each property has around 400 ACF custom fields. When I go to the Dashboard Properties page to edit them.. I get a blank screen. I thought maybe it was cause of the ACF fields, but why do the fields need to load on the listing page? I detached the custom fields for testing (I did not delete the custom fields from the database) and it still gave me a blank page. If I reduce the amount of posts in my CPT to just a couple thousand... it works. So what is actually loading when you load the listing page in the dashboard? I assumed it was just the post itself and not the meta data. Is this correct? If it's paginating why would it matter how many posts there are? I assume because there's so many posts with so much postmeta data that it's hitting a memory limit, but even on a dedicated server with 8GB of ram? I'm not really running a ton of plugins, less than 10 and none are heavy duty besides ACF. Thoughts? This is driving me nuts. EDIT: I found out on the listing page it's for sure trying to load all the postmeta for what ever reason even though it doesn't display it here. And that's causing it to use too much memory doing this for that many properties. Any way I can prevent that?


User(s) already exists show error please provide a valid username

I tried to log into WordPress today and instead of the usual wp_admin page, I got 'Welcome to the famous five minute WordPress installation process!'. It asks for a Site Title and email address, and has a spot for username which is pre-filled with 'User(s) already exists'. When I fill in the other details, it refreshes the page and says 'please provide a valid username' but there is no way for me to fill in a username. Any ideas?


How to get all author posts outside of author templates

Currently, I'm trying to display all posts from an author(e.x admin) in a custom page with name that is completely different than these template file listed **here**. So inside this page, I'm using WP query to get posts from admin like this:               $args = array(         'post_type' => 'post',         'posts_per_page' => 10,         'post_status' => 'publish',         'author_name' => 'admin'     );          $author_query = new WP_Query( $args );      It's working fine with 10 posts received, but the problem is with the pagination since I cannot get the correct `max_num_pages` inside my pagination function:               global $wp_query;     echo $pages = $wp_query->max_num_pages; // Always return 0      When I do `print_r($wp_query);` it's always showing `[max_num_pages] => 0` and `[found_posts] => 1` where as the exact same code in `author.php` gave me `[max_num_pages] => 1` and `[found_posts] => 5`. So do I need to pass any other specific parameters to the WP Query or any other way to overcome this problem?


Adding A Option For Client To Change Logo

I would like to know how a developer would add an option on the WP Dashboard to add or change a logo. I have seen themes that have Theme Options under the Dashboard on the main menu where they do this and other fabulous things. I have searched for instructions/tutorials and have not found what I was looking for. Does anyone have this knowledge? Can you direct me to information regarding this so I can learn how to do it myself? Keep in mind what I am looking for are informational/tutorial links, not plugins. **I want to learn how to do this myself** , I do not want to use a plugin. I appreciate any help/direction. **Thank you for your time!**


Save temporary registration data

I am working on a custom signup proces, where user first sign up with their name and email and after that they gonna add their company (a post in post type 'companies'). After they have signed up with their name and e-mail the receive an e-mail with a registration link. I need to save their data temporary, so if they click the link, their name and e-mail be retrieved back from the database. What is the best option to save this data a Wordpress way. Use option table? I cannot save it in Session because some people read their e-mail a week later for example.


Auto-Update Fails

I'm installing my first WP site for a client and I either pulled a recent, but not entirely up to date version or there was a very recent update. I'm being prompted to upgrade, which is fine, but it won't complete with the following:               Downloading update from http://wordpress.org/wordpress-3.4.1-partial-0.zip…          Unpacking the update…               Warning: copy(/opt/home/me/dev/client/www/wp-admin/includes/update-core.php) [function.copy]: failed to open stream: Permission denied in /opt/home/me/dev/client/www/wp-admin/includes/class-wp-filesystem-direct.php on line 200     Could not copy files.          Installation Failed      It feels like a permissions issue, but what I can't find -- other than this -- is a comprehensive list of what the perms should look like (particularly at the directory level). At this point, `wp-content` and all of its content is sitting at 777 (more open than I'd like). I'm trying to use the auto install (presumably running as the apache user) on a code base in my home directory. What am I missing? Thanks.


How can I register a hook for all Custom Post Types that are published?

I'm developing a plugin. I want that when _every_ Custom Post Type is published, a hook is called (where I send an email notification to the administrator). I know I can use:               add_action('publish_{custom_post_type_name}', 'function_to_call');      but I don't know the `custom_post_type_name`s (every site has different Custom Post Types registered). In addition, I can't take for granted that the Custom Post Types will always remain the same (because at any time other plugins or themes may register/deregister Custom Post Types). Any hint?


get_post_meta doesn't work

I created a custom meta box inside a page but I can't display the content!   I'm inside the loop and here there is the code of my functions.php:               $meta_box['portfolio'] = array(         'id' => 'descportfolio',         'title' => 'Description',         'context' => 'normal',         'priority' => 'high',         'fields' => array(             array(                 'name' => 'Short Description',                 'desc' => 'This short desc will appear under the thumbnail with hover effect',                 'id' => 'portfolio_description',                 'type' => 'descport',                 'default' => ''             )        )     );       add_action('admin_menu', 'descportfolio_add_box');      //Add meta boxes to post types     function descportfolio_add_box() {         global $meta_box;              foreach($meta_box as $post_type => $value) {             add_meta_box($value['id'], $value['title'], 'descportfolio_format_box', $post_type, $value['context'], $value['priority']);         }     }     //Format meta boxes     function descportfolio_format_box() {       global $meta_box, $post;            // Use nonce for verification       echo '<input type="hidden" name="descportfolio_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';            echo '
';            foreach ($meta_box[$post->post_type]['fields'] as $field) {           // get current post meta data           $meta = get_post_meta($post->ID, $field['id'], true);                echo '
'.                   ''. $field['name']. '	'.                   '';           switch ($field['type']) {               case 'text':                   echo '<input type="text" name="'. $field['id']. '" id="'. $field['id'] .'" value="'. ($meta ? $meta : $field['default']) . '" size="30" style="width:97%" />'. '
'. $field['desc'];                   break;               case 'descport':                   echo '<input type="textarea" name="'. $field['id']. '" id="'. $field['id'] .'" value="'. ($meta ? $meta : $field['default']) . '" size="30" maxlength="5" style="width:97%" />'. '
'. $field['desc'];                   break;               case 'textarea':                   echo '<textarea name="'. $field['id']. '" id="'. $field['id']. '" cols="60" rows="4" style="width:97%">'. ($meta ? $meta : $field['default']) . '</textarea>'. '
'. $field['desc'];                   break;               case 'select':                   echo '<select name="'. $field['id'] . '" id="'. $field['id'] . '">';                   foreach ($field['options'] as $option) {                       echo '<option '. ( $meta == $option ? ' selected="selected"' : '' ) . '>'. $option . '</option>';                   }                   echo '</select>';                   break;               case 'radio':                   foreach ($field['options'] as $option) {                       echo '<input type="radio" name="' . $field['id'] . '" value="' . $option['value'] . '"' . ( $meta == $option['value'] ? ' checked="checked"' : '' ) . ' />' . $option['name'];                   }                   break;               case 'checkbox':                   echo '<input type="checkbox" name="' . $field['id'] . '" id="' . $field['id'] . '"' . ( $meta ? ' checked="checked"' : '' ) . ' />';                   break;           }           echo     ''.'
';       }            echo '
';          }     // Save data from meta box     function descportfolio_save_data($post_id) {         global $meta_box,  $post;              //Verify nonce         if (!wp_verify_nonce($_POST['descportfolio_meta_box_nonce'], basename(__FILE__))) {             return $post_id;         }              //Check autosave         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {             return $post_id;         }              //Check permissions         if ('page' == $_POST['post_type']) {             if (!current_user_can('edit_page', $post_id)) {                 return $post_id;             }         } elseif (!current_user_can('edit_post', $post_id)) {             return $post_id;         }              foreach ($meta_box[$post->post_type]['fields'] as $field) {             $old = get_post_meta($post_id, $field['id'], true);             $new = $_POST[$field['id']];                  if ($new && $new != $old) {                 update_post_meta($post_id, $field['id'], $new);             } elseif ('' == $new && $old) {                 delete_post_meta($post_id, $field['id'], $old);             }         }     }          add_action('save_post', 'descportfolio_save_data');      And here my code inside the page               <?php echo get_post_meta($post->ID, "descportfolio", true); ?>      I've tried with get_post_ID instead of $post->ID, but nothing changed.   Can anyone see any error?


Make post password required to publish

I am making a site which will only have password protected pages. I would like it so that the password box is open by default, and is a required fields to publish the post. Ideally I would also remove the 'public' and 'private' options. Is this possible?


Using categories on navigation bar instead of pages

Check this url (www.linuxstall.com). The top navigation bar has one page (about us). I want the categories there, not pages. How can I do that?


query_posts doesnt show pages with given ID when post_type => page

At the moment I am working on a WP-site, which on the frontpages has 3 excerpts of other pages on it. The code I am trying to use for this is as following:               <?php query_posts(array('post_type' => 'page',                                 'include' => 5, 7, 52,                                 'showposts' => 3) ); ?>         <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                 <h2 class="icon" id="page-column-id-<?php the_ID(); ?>">                     <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">                         <?php the_title(); ?>
                      <?php the_excerpt(); ?>

              <?php endwhile; else: ?>
Sorry, het bericht is niet gevonden.
Probeer het later nog eens..
         <?php endif; ?>      Sadly, when I use this code I get a query for all the pages I have. Anyone has any idea how to get only the 3 pages on ID using this method? Thnx in advance


Post variables not displaying correctly in custom function

There seems to be something wrong with the simple function below, but I can't figure out what it is. It is displaying as the following and I can't figure out why. I know it has something to do with the functions the_ID(), the_title(), and the_permalink(), but I don't know what it is. Sorry if this sounds like a silly question.               1http://www.example.com/?p=1Hello world!

               function basetheme_nodetitle($before_title="",$after_title="",$link = true) {         /*          * basetheme_nodetitle() can only be called inside the Loop          * $before_title is the initial tag in which to wrap your title, usually
 or similar.          * $after_title is the tag after the title, usually
 or similar. Only works if $before_title is NOT empty          * $link is whether or not the title should be linked. Default is true          */         if(empty($before_title)){$before_title = '
';$after_title = "
";}         if($link == false){$beforelink = '';$afterlink = '';}else{$beforelink = '';$afterlink = '';}         echo $before_title . $beforelink . the_title() . $afterlink . $after_title;     }


Wordpress A-Z Navigation

I want to have a wordpress "A-Z" navigation menu like this site "http://www.sharephp.com/" Are there any plugin or a hack for wordpress to do this ?


How to get category/tag in URL for Pagination links?

I have a custom pagination function in functions.php. If I'm at the URL: http://mysite.com/tag/dogs, the Next link currently just contains /page/2. How can I make it so it will look like /tag/dogs/page/2? Here is the function I am using: (originally posted here)               function pagination( $query, $baseURL = '' ) {         if ( ! $baseURL ) $baseURL = get_bloginfo( 'url' );         $page = $query->query_vars["paged"];         if ( !$page ) $page = 1;         $qs = $_SERVER["QUERY_STRING"] ? "?".$_SERVER["QUERY_STRING"] : "";         // Only necessary if there's more posts than posts-per-page         if ( $query->found_posts > $query->query_vars["posts_per_page"] ) {             echo '
';             // Previous link?             if ( $page > 1 ) {                 echo '
« previous
';             }             // Loop through pages             for ( $i=1; $i <= $query->max_num_pages; $i++ ) {                 // Current page or linked page?                 if ( $i == $page ) {                     echo '
'.$i.'
';                 } else {                     echo '
'.$i.'
';                 }             }             // Next link?             if ( $page < $query->max_num_pages ) {                 echo '
next »
';             }             echo '
';         }     }      Any help would be greatly appreciated. Thanks!


How can I edit a post from the frontend?

I have learned how to create a post from the frontend but how about editing it ? This is the code I am trying to create a simple frontend form for posting. Thank you


Advanced Permalinks plugin breaks RSS

The plugin Advanced Permalinks breaks the RSS feed since Wordpress version 3.1. The developer has stopped working on the plugin, and I haven't seen any solution for it. Since my site is dependent on the plugin I can't just disable it either. Does anyone know of a way to either generate a feed differently, or of a similar plugin which could replace it?


Wordpress ignoring specified template for front page. Why?

I'm using the Roots theme which with custom css. I'm using the page "Home" as the front page the page "Blog" as the blog page (in WP reading settings) I'm trying to set the front page "Home" to use the template "full-width", but instead Wordpress ignores this and uses the "front page" template. This only happens on the front page, I can set any other page to use the "full width" template. Any ideas as to why this is happening and how I can resolve this? I can post some more information if this is helpful. Just let me know what. Thanks.


wp_head() remove redundant scripts?

hey guys, quick question. I'm using jquery for my current project (the latest release). A few plugins I'm using are using jquery as well and they are inserted through wp_head(). Since I want my website to ber fairly slim and fast this redundant scripts should be removed. is there any way I can filter for the string "jquery.js" in wp_head() and remove the tag that embeds the script? As you can see in the following screenshot jquery.js wouldn't be needed. Can I remove that with a hook? ![enter image description here](http://i.stack.imgur.com/KbzBR.png)


list child-pages as normal pages?

wp_list_pages('title_li=&depth=&exclude=');       lists all pages of my site. If there are childpages of a certain page the output looks like this:
         About

                 Subpage

SubSub

      Is there a simple trick to print childpages without seperate 's so that the output looks like this:
         About

         Subpage

SubSub
      I need that version just for a specific part of my page so it shouldn't be a filter that is added to wp_list_pages(). Any idea how to accomplish that?


Google picasa plugin

Please advice a google picasa plug that will have similar to original look, but with more styles or that will simply look better.


Wordpress not searching texts inside brackets

I have an issue using WordPress default search. Consider,there is a post with the title `"(TITLE)"`. When I search for `"TITLE"`,it is showing up in the search results. When I search for `"(TITLE)"`, then the search result yield nothing. How can I fix this?


Make Post Editor Select Number of Columns To 1 By Default

I want to make the Number of Columns in screen options for a custom post type is selected to 1 by default, instead of 2, which means full screen. How this can be done?


How do I add my own custom php page?

I'm making a plugin and I need to include my own public custom page in it. The user must not be able to edit this page and that's why I don't want this to be a regular WordPress post of type 'page' but my own custom php file. I want a link to it to show up in my navigation just like the other WordPress pages. Also, I don't want the page to appear just by itself but rather use the WordPress 'master page' and appear just like the regular WordPress pages do. To sum it up: I just need a way to include my own non-user-editable page that will look just like a regular WordPress page.


Internal Server Error every time I push up my Wordpress Project to Heroku

We use Heroku to deploy our Wordpress project. However, everytime we push up it seems that all of the links bring the user to an Internal Server Error page. The homepage works. Updating the permalinks (using the pretty permalinks for %postname%) solves this issue. What we believe to be happening is that when a user hits: www.example.com/menu the permalinks haven't been updated yet, so the user sees an Internal Server Error. If you go to www.example.com/?p=2 you get redirected to www.example.com/menu but the page shows an Internal Server Error again. Right now we have to update the permalinks **every time** we push up a new version of the site. Anyone else have this problem and what did you do to solve it? Much appreciation.


WordPress MS wp-admin/includes/post.php error with shortcode generator

I'm having a serious issue with Wordpress 3.1 with Multi Site enabled and my themes custom shortcode generator. For some reason, I'm getting the following error whenever I create a new page/post/custom post type page, etc. It is specifically an issue with radio buttons and the 'name' tag. When its removed, everything works fine. When it is set to a variable, I get the error. However, setting the variable to a constant (such as text) causes it to work again. This is the error I am getting; I have no clue what it means and what is causing it: `Warning: Invalid argument supplied for foreach() in /home/matthew/public_html/wp-admin/includes/post.php on line 197 Warning: Cannot modify header information - headers already sent by (output started at /home/matthew/public_html/wp-admin/includes/post.php:197) in /home/matthew/public_html/wp-includes/pluggable.php on line 897` Here is the PHP code (check line 892): http://pastebin.com/BNK7wE2W I'm a bit skeptical about releasing too much information before the theme is released, but if access to the admin panel is required then if possible get in touch with me. Thanks in advance, Matthew.


Why doesnt this query work? (Custom Taxonomy)

My Query               $my_query = array(                     'posts_per_page' => 10,                     'tax_query' => array(                             array(                                 'taxonomy' => 'country',                                 'field' => 'id',                                                             'terms' => array(4)                             )                     ));      ## Added Custom Taxonomy Using               function taxonomy_init() {         // create a new taxonomy              register_taxonomy(             'country',             'post',                 array(                     'label' => __('Countries (Labels)'),                     'sort' => true,                     'args' => array('orderby' => 'term_order'),                     'rewrite' => array('slug' => 'location')                 )         );               }     add_action( 'init', 'taxonomy_init' );      Whats wrong with it? I have 2 posts using that taxonomy.


How to find hooks as per Just-In-Time approach?

How can I follow `Just-In-Time` approach in hooking up my function to an action? I mean everybody just attach the functions to a very early stage like `init` which leaves the scope of optimisation. I saw in a Wordcamp presentation once that JIT will yield some performance and I totally agree with it but how do I find out what's the last hook I can hook to? Anything which can help in understanding the WP code execution flow too?


wp_insert_post does not write my post_name

i tried to generate a page via wp_insert_post. That works fine except that the post_name is always written with the same value as the post_title. Here comes the code snippet:               // Create homesite if not exists          $ins_home = array(         'post_title' => 'Home',         'post_name' => 'my-home-site',         'post_status' => 'publish',         'post_type' => 'page',         'comment_status' => 'closed',         'ping_status' => 'closed'     );          $result = $wpdb->query("SELECT wpost.post_name FROM $wpdb->posts wpost WHERE wpost.post_name = 'my-home-site'");          if($result < 1){// Insert the post into the database         $page_id = wp_insert_post( $ins_home );     }      Any help is very appreciated. Thanks a lot, Joe


Remove "Parent" Selection When Adding/Editing Categories?

I've been trying to find a way to hide/deactivate the Parent dropdown menu from the Posts -> Categories screen.   `http://example.com/wp-admin/edit-tags.php?taxonomy=category` I was able to hide the "Slug" option through this function here:               // Admin - Global Terms Enabled     function disable_global_terms($enablefalse) {        return 1;     }     add_filter( 'global_terms_enabled', 'disable_global_terms' );      Is there a way I can do the same for the Parent Drop Down menu without deleting that code from the main WP files so I would have to do this each time with each update?


remove everything from wp_nav_menu

My theme has three 3 menus: two that are dropdown menus and one that is different. I want to remove the div, class, etc. from the menu that is different. For Example: I have three menus   1. topnav ( drop down )   2. mainmenu ( drop down)   3. mymenu ( normal ) My current code:

who we are

management team

award

career

contact us

      I want to remove everything from mymenu, just want to want `<li>menu name </li>`. Additionally, I want `active` class applied to activated menu item as `<li class="active">menu name </li>`.


Retrieve Path of admin.php

Is there a better way of retrieving the path of admin.php and the url of wp- admin.css? What I can think of is:               $adminphppath = ABSPATH . '\wp-admin\admin.php';     $admincssurl = get_bloginfo('wpurl') . '/wp-admin/css/wp-admin.css";      But, some may be changing the admin path for security. So I need a more reliable way. [Edit] I need the system path for admin.php, not url. Because I need to include it.


Adding Sorting to Website?

I would like to add sorting but don't have any idea how ot go about it. I would like to be able to sort by: > Date, Title, Price (custom field), Comments, Views, ASC + DESC What would be the best way to do something like this?


Best hosting for Wordpress blog(s)?

I'm having pretty heavy (lots of images) Wordpress website with around 20-30k unique users per day (1,000,000 monthly). German hosting that I use works fine in Europe, but many visitors from the USA, Asia and Australia complain about loading times. Do you know any good, affordable hosting companies that provide fast browsing to people from the USA > Australia > the UK > the rest of Europe > the rest of World (in this order) as most of my visitors are from these places? :) My current site "eats around 600 GB bandwidth monthly. I was thinking about MediaTemple, but I have mixed feelings, many people say it totally sucks and even more love it. I'd love the ability to buy additional bandwidth and using a few different WP blogs using one account.


Autogenerated Thumbnail compression depending on size

This is a follow up to this question, in witch the jpg compression is altered depending on what WP's built-in image resulting image size returns. While it may work for most of the people, i'm looking for a more discrete and automatic approach. And that is altering the `wp_create_thumbnail` i think. The point is this: How to alter the JPG compression of autogenerated thumbnails for an uploaded image? For example, images below 400px width at 60%, and between 401px~100px width at 80%.


woocomerce variations

I am using woocommerce plugin for ecommerce site. Problem is that it allows maximum 50 variations for a product, but my client requires around 350 variations with attributes size, color etc. etc. Is there a way to tweak the code or anything else? Thanks, Frank