title: Echo custom field value

text:
So I am customizing the [CPT Bootstrap Carousel plugin][1] to fit my needs. I have added custom field support to the custom post type, where the custom field is suppose to add a button on the carousel items. I have been able to register the custom field in the backend and the button is showing up on the Carousel items, but the `href` property is empty. I believe that the problem is in the custom loop or in the way I am using `echo`, but I can´t seam to figure it out. The area where I believe the problem in the code is have been market with `<!--Possible problem-->`. Here is updated, functioning code: /PS: but have a look a phils answer, probably a more stable solution.               <?php     /*     Plugin Name: CPT Bootstrap Carousel     Plugin URI: http://www.tallphil.co.uk/bootstrap-carousel     Description: A custom post type for choosing images and content which outputs Bootstrap Carousel from a shortcode. Requires Bootstrap javascript and CSS to be loaded separately.     Version: 1.1     Author: Phil Ewels     Author URI: http://phil.ewels.co.uk     License: GPLv2     */          // Custom Post Type Setup     add_action( 'init', 'cptbc_post_type' );     function cptbc_post_type() {     $labels = array(         'name' => 'Carousel Images',         'singular_name' => 'Carousel Image',         'add_new' => 'Add New',         'add_new_item' => 'Add New Carousel Image',         'edit_item' => 'Edit Carousel Image',         'new_item' => 'New Carousel Image',         'view_item' => 'View Carousel Image',         'search_items' => 'Search Carousel Images',         'not_found' =>  'No Carousel Image',         'not_found_in_trash' => 'No Carousel Images found in Trash',          'parent_item_colon' => '',         'menu_name' => 'Carousel'     );     $args = array(         'labels' => $labels,         'public' => true,         'exclude_from_search' => true,         'publicly_queryable' => false,         'show_ui' => true,          'show_in_menu' => true,         'query_var' => true,         'rewrite' => true,         'capability_type' => 'page',         'has_archive' => true,          'hierarchical' => false,         'menu_position' => 21,         'supports' => array('title','excerpt','thumbnail', 'page-attributes', 'custom-fields')     );      register_post_type('cptbc', $args);     }               // Add theme support for featured images if not already present     // http://wordpress.stackexchange.com/questions/23839/using-add-theme-support-inside-a-plugin     function cptbc_addFeaturedImageSupport() {     $supportedTypes = get_theme_support( 'post-thumbnails' );     if( $supportedTypes === false )         add_theme_support( 'post-thumbnails', array( 'cptbc' ) );                    elseif( is_array( $supportedTypes ) ) {         $supportedTypes[0][] = 'cptbc';         add_theme_support( 'post-thumbnails', $supportedTypes[0] );     }     }     add_action( 'after_setup_theme', 'cptbc_addFeaturedImageSupport');          // FRONT END          // Shortcode     function cptbc_shortcode($atts, $content = null) {     // Set default shortcode attributes     $defaults = array(         'interval' => '5000',         'showcaption' => 'true',         'showcontrols' => 'true'     );          // Parse incomming $atts into an array and merge it with $defaults     $atts = shortcode_atts($defaults, $atts);          return cptbc_frontend($atts);     }     add_shortcode('image-carousel', 'cptbc_shortcode');          // Display latest WftC     function cptbc_frontend($atts){     $id = rand(0, 999); // use a random ID so that the CSS IDs work with multiple on one page     $args = array( 'post_type' => 'cptbc', 'orderby' => 'menu_order', 'order' => 'ASC');     $loop = new WP_Query( $args );     $images = array();     while ( $loop->have_posts() ) {         $loop->the_post();         if ( '' != get_the_post_thumbnail() ) {             $title = get_the_title();             $content = get_the_excerpt();             $image = get_the_post_thumbnail( get_the_ID(), 'full' );             $link = get_post_custom_values('link');             $images[] = array('title' => $title, 'content' => $content, 'image' => $image, 'link' => $link);         }     }     if(count($images) > 0){         ob_start();         ?>         <div id="cptbc_<?php echo $id; ?>" class="carousel slide">
             <?php foreach ($images as $key => $image) { ?>                 <li data-target="#cptbc_<?php echo $id; ?>" data-slide-to="<?php echo $key; ?>" data-interval="<?php echo $atts['interval']; ?>" <?php echo $key == 0 ? 'class="active"' : ''; ?>>
             <?php } ?>

             <?php foreach ($images as $key => $image) { ?>                 <div class="item <?php echo $key == 0 ? 'active' : ''; ?>">                     <?php echo $image['image']; ?>                     <?php if($atts['showcaption'] === 'true') { ?>

<?php echo $image['title']; ?>

<?php echo $image['content']; ?>
                             <?php echo 'Läs mer';?>
                     <?php } ?>
             <?php } ?>
             <?php if($atts['showcontrols'] === 'true') { ?>                 <a class="left carousel-control" href="#cptbc_<?php echo $id; ?>" data-slide="prev">‹                 <a class="right carousel-control" href="#cptbc_<?php echo $id; ?>" data-slide="next">›             <?php } ?>
     <?php }     $output = ob_get_contents();     ob_end_clean();          // Restore original Post Data     wp_reset_postdata();              return $output;     }          // Call the carousel in javascript, else it won't start scrolling on its own     function cptbc_footer_js() {     ?>          <?php     }     add_action('wp_footer', 'cptbc_footer_js');          ?>


title: Restrict WordPress to Private

text: I want to set up a private WordPress site, with only 2 users, all I need is a simple private site functionality, with visitors unable to see anything when trying to login, only being redirected to the login page. RSS should also be blocked. I have found one plugin which does this, but it doesn't seem to be maintained, any others which do the same thing and are maintained? http://wordpress.org/extend/plugins/members-only/


title: page not updating with database

text:
I have code which updates the database fine, but the page doesn't update correctly! I have to refresh the page a second time for it to update correctly. Here is the code below (`funcitons/admin-website-options`). The most important line is the `<input type="radio" ....` line:               <?php     add_action('admin_menu', 'add_website_menu');          function add_website_menu()     {             add_menu_page( 'website Options', 'website Options', 'administrator', 'website_options', 'echo_website_menu');     }          function echo_website_menu()     {             if(isset($_POST['submit-change-front-story']) )             {                        $new_post_id = intval($_POST['front']);                     global $post;                     $args = array('tag' => 'front-page');                     $posts = get_posts($args);                     function get_ids($post) {                             return $post->ID;                     }                        $posts = array_map("get_ids", $posts);                     untag_posts($posts,'front-page');                     wp_add_post_tags($new_post_id, 'front-page');             }                ?>

Manage Stories
                 <form action="<?php echo $_SERVER['REQUIEST_URI']?>" method="POST" class="story-admin-form">

Front Page Stories
                     <?php query_posts('cat=5'); // all posts with category of "story" ?>
                             <?php while ( have_posts() ) :                                     global $post;                                     $post = array();                                     the_post(); ?>                                     <input type="radio" name="front" value="<? echo the_id(); ?>" <? echo has_tag('front-page', get_the_id()) ? "checked":"" ?>/> <? echo the_title(); ?>
                             <?php endwhile;?>
                             <input name="submit-change-front-story" type="submit" id="submit-front-page-story" value="Change Front Page Story" />
                  </form>
              <?php     }     ?>      Every time I change the front-page story, both of the select options are "checked", but I can view the posts in the admin view and only one of them has the 'front-page' story. (???) And when I refresh the page, then the options have only one selected. Does anyone know what's happening?


title: Set custom name for generated thumbnails

text: Is there any filter available to set the naming convention of those auto generated thumbnails? Something like this:   * thumbnail_150x150.jpg -> thumbnail-s.jpg   * thumbnail_300x300.jpg -> thumbnail-m.jpg   * thumbnail_600x600.jpg -> thumbnail-l.jpg


title: qTranslate and forms

text: I am developing a bilingual website and I am using qTranslate that works fine for static pages, but for pages such as login, or submit job, etc it does not keep the chosen language and loads on a default language. Any clue about what can i change to keep the language, any function? I found a few people asking for similar help but I could not figure out how to use that help in my case. Thanks Andre


title: How to hide user posts?

text: I installed 'User Role Editor' plugin in a student journal site where students can submit their assignments and projects. The problem is if someone creates a new user, by default, posts by other users are also showing up in the posts section. Although with the help of the plugin I have made some changes, new users are not be able to edit or delete the posts submitted by other users. I was wondering if there's a solution to hide posts by other members in the dashboard so that the news users are not able to see the posts.


title: Auto 301 to full post permalink? (using /posts/%post_id%/%postname%)

text: I update my permalink structure to /post/%post_id%/%postname%, but if someone uses a URL like /post/1234 instead of the full URL of /post/1234/bingo-rulz, WordPress shows the post without giving a 301 to the full URL. Isn't this poor SEO? Sites like tumblr and stackexchange auto 301 to the full URL. Any hacks/code/plugins/settings/etc to fix this? thanks p.s. /post/1234/blah does get a 301 to /post/1234/bingo-rulz but /post/1234 does not and ends up in two separate URLs to the same content.


title: Dynamic content in a widget

text: I have to make a widget from where the user will be able to add a few images and then I will show only some of them, randomly, and it will be automatically changed on page refresh. The problem is that the number of images is not known, it may be 2, it may be 5. I was thinking of using an "add more" jQuery button but I have problems with working on data from an array. Has somebody done something like this before? If you have another idea about doing this, I'd be glad to hear of it. Note: If you have knowledge about a widget which uses this kind of function do not hesitate to tell me, maybe I can get inspiration from there.


title: WP e-commerce sales-view

text: I'm helping a client out who's running Wordpress E-commerce 3.8.3 on WP 3.2.1 In the "sales" view, (where it shows all orders), you can see ID Date/Time Name Amount Details Status (Delete) and Track-ID My client wants to view the orderers e-mail and phone too. There are fields for this in the checkout, and the confirmation emails do include this information. But how can I make them show in the Sales-view too? WP E-commerce isn't my strongest side. Thanks for help!


title: Best Practice: Remove data on deactivation or uninstall?

text: When is it appropriate to remove a plugin's settings? On deactivation or uninstall?


title: Wordpress Resize Image and show as thumb in post

text: I have set crop in functions.php to resize Images for Posts. Codex from Wordpress: add_image_size, post_thumbnail                 add_theme_support('post-thumbnails');       set_post_thumbnail_size(100, 100, true); //size of thumbs       add_image_size( 'post-thumb', 180, 180, true ); //(cropped)      Usage is like below               <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'post-thumb' ); } ?>      But it will not resize the thumb and shows the original size. What am I doing wrong?


title: stats_get_csv (Wordpress Stats) to only display top posts (not pages)

text:
I'm trying to get the first 10 posts based on page views through Wordpress Stats (now called Jetpack). I managed to get this code to work (approximately..) after digging for hours over the forums (because variables and code changed from time to time):                       <?php             if ( function_exists('stats_get_csv') && $top_posts = stats_get_csv( 'postviews', "days=10&limit=10")) {             echo '
';               foreach ( $top_posts as $post ) {                 if($post['post_id'] && get_post($post['post_id']))                   echo '
' .                        get_the_title( $post['post_id'] ) . ' (' . number_format_i18n( $post['views']) .' visits)
';               }               echo '
';             }             ?>      Now I'd like to exclude pages from this list and only have posts. The problem is that the WordPress.com Stats API does not offer a post_type filter. I should put somewhere this               if ( !isset($post->post_type) || $post->post_type != 'post' )      can you help me pointing out where should I add it? Thanks in advance! :D


title: How to translate multi-line strings?

text: If there is a long string in PHP like this:               <?php     $text = "Some ... very              very...              long string";      Can it be localized by GetText wrapping it in `__()`, e.g.               <?php     $text = __("Some ... very              very...              long string", "domain");      ? I've heard that GetText doesn't support multi-line strings and indeed, when I try to scan such file in poEdit, it doesn't find it. How do you deal with that? WordPress source files seem to use very long lines so is that the way to go? (Obviously apart splitting the strings into multiple smaller strings which I'd rather avoid.) **Edit** : the problem was that I had a variable reference in my string, e.g. `__("string $someVar")` which can't be supported by GetText. My fault.


title: Upload .doc to blog

text: All my blog contents are well prepared in MS Word. Some contents have image flow chart. On copying the contents from Word doc, i am not able to copy the Images. How should i copy both contents and images from word doc to the Blog? Or Is there any way to upload each doc file which will directly extract the contents including images from Word doc to the Wordpress.


title: After updating a page, all pages on the site used the index.php template

text: I am having a strange problem with a site I am currently building. I will try to give as much detail as possible in the hopes that **somebody** is able to figure out what is causing this :) **Overview of the problem** Each time I update a page, all the pages on my site except the homepage, start using the index.php template. Even when pages have a template assigned to them, they still revert to the index.php template. To fix it, I need to change the permalinks to default, save it, and then put them back to my custom setup which is category/postname. Though next time I update a page, it happens again. **Plugins & Post Types** I am using the following plugins, not sure if any of this matters.   * Advanced Custom Fields   * Custom Post Type UI I used Custom Post Type UI to create five custom post types and ten custom taxonomies. For the custom post types, I am using the following settings:   * all names start with ph_ to keep things unique and not cause conflicts   * Public, Show UI, Has Archive, Hierarchical and Rewrite are all set to True The rewrite slugs being used are: **Name/Rewrite Slug** ph_slider/ph_slider (no change) ph_rental/rental-boiler ph_new/new-boiler ph_used/used-boiler ph_services/boiler-service **I also have pages with the following names/slugs** Boiler Services/boiler-services (plural, post type rewrite is singular) New Commercial Boilers/new-commercial-boilers Rental Commercial Boilers/rental-commercial-boilers Used Commercial Boilers/used-commercial-boilers Obviously, some of the names are similar between post types and pages but they are not the same and should not cause a conflict. **Conclusion** Does this make sense to anyone? I can supply access to the WP site if needed. I am stuck and can't figure this out. I have setup a number of sites with custom post types in the past and have never run into this issue. I really appreciate any help that you can give. If you need additional information, let me know and I will be glad to supply it. Thanks! **EDIT - more details** I meant to include, when I deactivate Custom Post Type UI, I can edit a page and the templates stay correct. Once I activate it again though, everything breaks on an update. So I have narrowed it down to definitely being the cause of the problem - but why? **EDIT - figured it out** I had a custom taxonomy with the name "year", after renaming that everything seems to be working. Sorry for not realizing that from the start, but maybe somebody will come across this when they have a problem and know the reason now :)


title: How to customize wordpress login/register pages?

text: My question is how do I customize the default WordPress login and register page without editing WP's core files. I'm thinking more along the lines of a functions.php code. Can anyone help me out by finding a tutorial or something? Remember, I don't want to edit the WP core files. Thanks!


title: Displaying categories in different template problem

text: Greetings! Sorry for the vague title decription - Couldn't word it any different. In my index.php page I have the following code:               <?php  if (is_category('6')) { ?>     <?php include (TEMPLATEPATH . '/blog.php'); ?>     <?php } else { ?>     <?php if ( is_front_page() ) {           $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;           query_posts("cat=5&paged=$paged");} ?>      Now, I'd like to include another category in the 'blog.php' template, but simply adding the cat number in the first line, like:               <?php  if (is_category('6, 7')) { ?>      is not working and simply ignores both. Any idea of what I'm missing here, or perhaps a better way to do it altogether? Thanks


title: how to add custom fields in page

text: I am still new to Wordpress and I want to insert a featured content gallery into a Wordpress page. I tried to do it myself, but it wanted me to use custom fields. Where can I add custom fields, is there any coding required? or do I just enter the value into custom fields text box? I want to add and then use custom fields for images in my featured content gallery, can you please help me?


title: Length of Category Names

text: Based on this post, I'm hoping to create good categories now, that I won't have to change much later.   1. Can you change a category name later, without having to go back and re-categorize all articles?    2. Using the category "Information Technology" as a challenging example, would you call it: a. IT b. I.T. c. InfoTech d. InformationTechnology e. Information Technology (in other words, is shorter better? any downside of long category names? any problem with a space in the category?)


title: Adding Colorpicker Field To Category

text:
I want to add a custom field to my categories where the user can color code them. I've added the field but I want to use built in colorpicker (either tinyMCE or the farbtastic) to give the user an easy way to pick colors. I can't figure out how to add the functionality yet though, here's what I have so far: **Category Field Setup**               /** Add New Field To Category **/     function extra_category_fields( $tag ) {         $t_id = $tag->term_id;         $cat_meta = get_option( "category_$t_id");     ?>
     <?php _e('Category Image Url'); ?>	          <input type="text" name="Cat_meta[bgc]" id="colorinput" size="3" style="width:20%;" value="<?php echo $cat_meta['bgc'] ? $cat_meta['bgc'] : '#fff'; ?>" class="my-color-field" />

                 <?php _e('Can't Think of A Desc Yet, Suggestions?'); ?>

     <?php     }     add_action ( 'category_add_form_fields', 'extra_category_fields');          /** Save Category Meta **/     function save_extra_category_fileds( $term_id ) {         if ( isset( $_POST['Cat_meta'] ) ) {             $t_id = $term_id;             $cat_meta = get_option( "category_$t_id");             $cat_keys = array_keys($_POST['Cat_meta']);                 foreach ($cat_keys as $key){                 if (isset($_POST['Cat_meta'][$key])){                     $cat_meta[$key] = $_POST['Cat_meta'][$key];                 }             }             //save the option array             update_option( "category_$t_id", $cat_meta );         }     }     add_action ( 'edited_category', 'save_extra_category_fileds');      **Colorpicker Script (Farbtastic) - Doesn't Work**               /** Enqueue Color Picker **/     function farbtastic_scripts() {       wp_enqueue_script( 'jQuery' );       wp_enqueue_style( 'farbtastic' );       wp_enqueue_script( 'farbtastic' );            ?>                <?php     }     add_action( 'admin_enqueue_scripts', 'farbtastic_scripts' );      **:: Edit ::** If it makes it any easier, I do have the "Advanced Custom Fields" plugin which has a colorpicker option. I'm looking to see if it would be easier to use that.


title: How properly create a blog template for wordpress?

text:
I imagined that it is pretty easy to do: just take everything what is in index.php. Add               <?php     /*     Template Name: Blog     */     ?>      at the top and you all set, but in my case it is not working. I copied everything what was in my index.php, created template-blog.php and added through new page as "new". And this is the result I get: http://bellated.us.lt/new/ (testing page) It's seems like the blog loop is starting, but it do not go through as it should. Any help will be appreciated. Thanks!               <?php     /*     Template Name: Blog     */     ?>          <?php get_header(); ?>

                              <?php if (have_posts()) : ?>                                          <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>                         <?php /* If this is a category archive */ if (is_category()) { ?>
<?php printf(__('Visi įrašai iš %s', 'framework'), single_cat_title('',false)); ?>
                         <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
<?php printf(__('Įrašų ėymĖs %s', 'framework'), single_tag_title('',false)); ?>
                         <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<?php _e('Archyvas', 'framework') ?> <?php the_time('F jS, Y'); ?>
                          <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<?php _e('Archyvas', 'framework') ?> <?php the_time('F, Y'); ?>
                         <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<?php _e('Archyvas', 'framework') ?> <?php the_time('Y'); ?>
                         <?php /* If this is an author archive */ } elseif (is_author()) { ?>
<?php _e('Visi įrašai pagal', 'framework') ?> <?php echo $curauth->display_name; ?>
                         <?php /* If this is a category archive */} elseif (is_search()) { ?>
<?php _e('Paieškos rezultatai: ', 'framework'); echo '"'.$_GET['s'].'"'; ?>
                          <?php } ?>                              <?php while (have_posts()) : the_post(); ?>                                                               <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'framework'), get_the_title()); ?>"> <?php the_title(); ?>

                                     <?php _e('pagal', 'framework') ?> <?php the_author(); ?> <?php _e('·', 'framework') ?> <?php the_time('Y/m/j  H:i'); ?> <?php _e('·', 'framework') ?> <?php the_category(', ') ?> <?php _e('·', 'framework') ?> <?php comments_popup_link(__('Komentarų nėra', 'framework'), __('1 Komentaras', 'framework'), __('% Komentarai', 'framework')); ?> <?php edit_post_link( __('', 'framework'), '[', ']' ); ?><a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php the_permalink(); ?>" data-text="<?php bloginfo('name'); ?>: <?php the_title(); ?>," data-count="horizontal">Tweet
                                      <?php /* if the post has a WP 2.9+ Thumbnail */                                 if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) : ?>
                                     <a title="<?php printf(__('Permanent Link to %s', 'framework'), get_the_title()); ?>" href="<?php the_permalink(); ?>"><?php the_post_thumbnail('archive-thumb'); /* post thumbnail settings configured in functions.php */ ?>
                                 <?php endif; ?>
                                     <?php the_content(__('Skaityti toliau →', 'framework')); ?>

                                  <?php endwhile; ?>
                             <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
<?php next_posts_link(__('← Senesni įrašai', 'framework')) ?>

<?php previous_posts_link(__('Naujesni įrašai →', 'framework')) ?>
                             <?php } ?>
                              <?php else : ?>                                                       <div id="post-0" <?php post_class(); ?>>
<?php _e('Ups, puslapis nerastas', 'framework') ?>

<?php _e("Atsiprašome, bet puslapis, kurio ieškote nerastas.", "framework") ?>
                                 <?php get_search_form(); ?>

                              <?php endif; ?>

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


title: My custom posts that are assigned to categories, are not called on a category search using a Category Menu

text: I used the Custom Post UI plugin to create a custom post type called 'business_sold'. I assigned each custom post to one of six categories and an additional one called 'All'. I used a standard WP widgetized menu to list the 'Business Sold' categories, but my custom posts are not called on a search of any category. I can see that WP has recognized the category assignment. Single-business_sold.php is working fine, but neither category-business_sold or archive-business_sold are working. I cannot figure out what I'm doing wrong. Can anyone help me please?


title: Posting to loop.php file

text: I am trying to post to the loop.php template file and it is not going through for some reason, usually it should work but it isnt. Is there a alternative way to get this done? This is what I have in the index.php file of the theme.               $('.load_more_cont a').live('click', function(e) {                 leftwrapper = 'THIS IS WORKING';                 $.ajax({                     url: "<?php bloginfo('template_url') ?>/loop.php",                     type:'POST',                     data: "left_wrapper=leftwrapper",                      success: function(data){                         console.log('successful call');                         }                 });         });      This is what I have in the loop.php file.               $left_wrapper = $_POST['left_wrapper'];             $args = array(                'post_type' => 'post',                'posts_per_page' => 15,                'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1)             );             query_posts($args);             $x = 0;                  $leftside = (!isset($left_wrapper) ? '3' : $left_wrapper);                  while (have_posts()) : the_post(); ?>                  <?php the_title(); ?>                  <?php $x++; ?>             <?php endwhile; ?>             <?php wp_reset_query(); ?>


title: Register a title automatically with a relationship field

text: I'm trying to optimize the code of my site . I wanted to know if it was possible to give automatically a title to a new post without having to do it manually. I have a website of video games. Before posting a review, I first need to create the plug of this game with all the information (publisher, developer, pc configuration etc.).. So I have to put twice the same title. I would only select the plug of the game without having to type the title of the game To get the title, I am able to retrieve the ID of the plug. Do you think I can write a function? Thank You Code example for get the title of a game :               <?php foreach(get_field('fiche') as $post_object): ?>     <? echo get_the_title($post_object->ID); ?><br />     <? echo 'Genre' .get_field('genre', $post_object->ID); ?>     <? endforeach; ?>


title: Is there a filter for editor-style.css file?

text: I need to add multiple css files from a css framework to my editor-style.css file. The point is that i don't want to update the editor-style.css file anytime there's a new update from either my theme or the css framework. Is there a filter or hook **to add more than one stylesheet**? (I'm aware of `@import`, but didnt try to use it here.)


title: Filtering posts by WORD in custom field

text: I need to filter my posts in categories pages, by showing only posts that have specific WORD in custom field value. I need php code that i should add in loop for this category. Details: I need loop query that will say - show posts in this category (crocs) only if custom field hey 'brand' contain the same value (crocs). BUT note, in custom field 'brand' i have more brands, for example 'diesel, crocs, fendi'. Now i need post to show if value contains crocs, not if it's equal to crocs (as other brands can be present). Thanks a lot for your help. Maybe this is basic, but I am noob and trying to learn and understand WP :) Cheers, Dean


title: SQL query to return categories and category parents

text: I have some categories which are not correctly defined. I.e. their parents are messed up. How can I select with SQL all categories and their parents?


title: Blackberry specific Mobile Redirect plugin?

text: **Is there a Wordpress plugin out there, that redirects only Blackberry visitors to a very simple basic something of the site?** Currently I have a responsive website, a long vertical one with `smoothscroll.js` (Similar to the Nike one). It responds in iOS, Android, and iPad - and while it displays alright in BB (curve 2009), its very hard to read text. I have to support curve 2009 + BB. _Any suggestions?_


title: Custom Field IF/ELSE PHP

text: Ok so i am trying to use WordPress's custom fields and have them working but now i have some php code i need help with.               <a href="<?php echo get_post_meta( $post->ID, '_ct_text_4dc9e9f74d000', true ); ?>">Go To Store!      The above code is what i have for right now. Is there a way to setup a if and else statement so if there is a value in the custom field then show that but else show N/A if there is no value present


title: Why is styling comments so complex?

text: I've been building a theme completely from scratch and after a straightforward process up to this point, I've reached the comments.php file. Again, nothing too out of the ordinary, until this: > **$callback** (string) (optional) The name of a custom function to use to > open and display each comment. Using this will make your custom function get > called to display each comment, bypassing all internal WordPress > functionality in this respect. Use to customize comments display for extreme > changes to the HTML layout. Note that your callback must include the opening > `<div>`, `<ol>`, or `<ul>` tag (corresponding with the style parameter), but > not the closing tags. WordPress will supply the closing tag automatically, > or you can use end-callback to override this default. The callback is > separate from the end-callback to facilitate hierarchical comments. Use with > caution. Why is this so mad? Why isn't there a way to just have a comment.php template that gets used for each comment? (Or if there is, please do let me know)


title: Making a Wordpress theme based on twentyten

text:
I want to convert a HTML/CSS layout i made into a WordPress Theme, But i don't know any PHP, I have a basic idea of the structure of a WordPress Theme, So i was wondering if i could just slice my HTML template into a header.php, footer.php, sidebar.php and index.php and just copy paste all the php code bits from the default twentyten theme? I've been going through the twentyten theme files and i have come across some bits of code where it says 'twentyten', for example:               // Add a page number if necessary:     if ( $paged >= 2 || $page >= 2 )         echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );      and
<a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to content', 'twentyten' ); ?>
      Can i just replace the text that says 'twentyten' with my theme's name? Or should i just leave it that way?


title: is it possible to translate without using plugins? (two-tree concept for translation)

text: I have seen this question unfortunately it didn't help me through because I am not using any plugin. I tried to use second solution from this article but Unfortunately I couldn't understand what exactly I should have done. for translating I thought maybe I can do something else.In the website I have created pages in two languages and then I created two different menus. one containing english and another one persian. I created two links in header.php. I do not know using server side or client side? in some sense I think maybe javascript onclick function on the other side I should use wp_nav_menu in php. with clicking on persian link It should go to page containing persian menu. I tried get_header(); but I do not know what exactly I should write for creating new page. I studied the codex but I could not understand exactly what to do? Thanks in advance.


title: Multisite: setting theme and options when a new blog is created

text: When a new blog is created in a WP Multisite instance I want to be able to set the default theme and configuration options   * create 2 menus (main and secondary) and associate them with the 2 slots provided by the theme   * set various theme options as defined on the theme option page What's the best way to go about achieving this?   * which hook should i use - I'm going to use this: ('WP_DEFAULT_THEME', 'theme-folder-name' in wp-config.php to set the default theme - unless this prevents a needed hook from firing.   * easiest way to programatically create menus and associate them with existing theme menu 'slots'


title: Featured Image meta box shows at the bottom?

text: After using this code:               //Set custom featured image metabox       function customposttype_image_box() {          remove_meta_box('postimagediv', 'eezzyweb-webfolio', 'side');     add_meta_box('website_grid_view', __('Featured Image for grid view'), 'post_thumbnail_meta_box', 'eezzyweb-webfolio', 'side', 'low');                 }       add_action('do_meta_boxes', 'customposttype_image_box');      and afterwards removing it, the Featured Image metabox is at the bottom, not on the right side anymore... Is there something I need to reset/unregister??? Thank you


title: Import function loses <p> tags

text: I have used the export function to download all my posts from one installation of wordpress, and then imported the file into a second. However the imported posts have been stripped of all paragraph breaks. I looked in the XML export file, and the p tags all seem to be in there. Is there a problem with the import function? And how can I get all the paragraph breaks back again? Any suggestions much appreciated! Thanks! Rob


title: Share one taxonomy across multiple blogs in 3.0

text: > **Possible Duplicate:**   >  WordPress Multisite - global categories I have a series of blogs that will use some, but not all, of the same posts. We have one blog where many of the posts are written, and then shared down to the other blogs, based on topic. We cannot accomplish this properly using categories, though we've thought of that. All the blogs use the same theme, the theme changes slightly based on the blog. I would like to do something like this:               register_taxonomy(         'some_categories',         array('post'),         array ('hierarchical' => true,         'label' => __('Some Awesome Categories'),         'singular_label' => __('Some Awesome Category'),         'query_var' => 'some_categories')         );      We're using a path install so if I got to http://domain.com/blog1/wp-admin/ and add some categories, they do not show up at http://domain.com/blog2/wp- admin/. Is this possible? I know that WP 3.0 has a different set of tables for each blog, so this may not be possible. TIA


title: Sitewide categories for all the blogs in the network

text: > **Possible Duplicate:**   >  WordPress Multisite - global categories I'm trying to do sitewide categories. like when a category is made in the main blog that category is added to all the new blogs created in the network.


title: Loop to populate categories to blogs in multisite taking long time

text: I am trying to populate all categories that is created from main Wordpress multisite to all our 37 blogs. I have written the following function that should add all new categories to all blog-sites, but the problem is that it takes a long time to execute the function. When we have created more than 7 categories it´s so slow that it won´t execute at all because of our script time limit of 20 seconds.               function global_categories( $term_id ) {            global $wpdb;          $bloggs = wp_get_sites();           $wpdb->set_blog_id(1);     $args = array(       'type'                     => 'post',       'taxonomy'                 => 'category',       'hide_empty'              => false     );          $categories2 = get_categories( $args );                foreach($categories2 as $category2) {          $wpdb->set_blog_id(1);              foreach ( $bloggs as $blog ) {              $wpdb->set_blog_id(1);                  $wpdb->set_blog_id( $blog[blog_id] );              wp_insert_term( $category2->name, 'category',  array(                 'slug' => $category2->slug,                 'parent' => 0             ));                   $wpdb->set_blog_id(1);          }          $test = $category2->name;            }     }          add_action( 'created_category', 'global_categories');


title: Change filename during upload

text: I check the below answer to rename files during upload and tries to change it to something like postid_originalfilename.jpg but failed. Any help?               function make_filename_hash($filename) {     $info = pathinfo($filename);     $ext  = empty($info['extension']) ? '' : '.' . $info['extension'];     $name = basename($filename, $ext);     return md5($name) . $ext;     }     add_filter('sanitize_file_name', 'make_filename_hash', 10);      http://stackoverflow.com/questions/11586284/rename-files-on-upload-in- wordpress-3-4-1


title: Problem with menu categories doubling up when updating database?

text: I imported a database from a website to my localhost and the menu categories started doubling up. The wordpress dashboard is also missing my custom post types. How can I solve this?


title: List all blogs a user can admin

text: Which is the best way to list all blogs a user can admin in a wordpress network? Thanks in advance.


title: Disable revisions for a specific post type only?

text: Any way to disable post revision on specific post types only?


title: Move Index to a page

text: From a default WordPress install, I have set a static page as the front page and now I want to have the last posts (what is normally seen when visiting the root of the website) in a "Blog" page. Do I have to create a special template for this page where I must create a new query, save the paged variable for the navigation and so forth, or is it possible somehow to reuse the simple index.php template in this "Blog" page ?


title: How to add 'Views' in the forums page of bbPress (plugin)?

text: I thought 'Views" was a pretty common item in a forum table. Is there a way of enabling this or adding it to Wordpress + the bbpress plugin? ![enter image description here](http://i.stack.imgur.com/Qu2PD.png)


title: Custom Posts Hierarchy? (State/City/Restaurant)

text: **Question:** What is the best way to create a hierarchy structure (also called parent/child relationships) between custom post types? For example, we currently have 3 post types: States, Cities, and Restaurants. Each Restaurant will be in a city, and each city will of course be in a state. So for example, Joe's Crab Shack would be in the city of Orlando, which would be in the state of Florida. I understand taxonomy for the most part, but I'm not sure how to actually "set" the relationship between ex: Joe's Crab Shack/Orlando, and Orlando/Florida. Is this done through taxonomy as well, a custom field type, etc? We also plan on importing these through an Excel document. **Structure Example:**   * URLs: www.site.com/florida/orlando/joes-crab-shack/   * Breadcrumbs: state->city->restaurant **Pages (only need to know how to retrieve the results):**   * State pages should be able to list all of their cities.   * City pages should be able to list all of their restaurants.


title: export csv functionality into my plugin

text: I need to build a "export as .csv" functionality into my plugin. Problem is: i get the header already sent warning, because by the time my "export" function is called, Wordpress has already started rendering. The way i set it up is via a small form in the Settings screen, which action attribute points to a file (download.csv.php) in my plugin folder, that should not be shown, just prompt a file download dialog for the csv dump. Here is my code. In my plugin Settings screen:               <form method="post" id="download_form"  action="<?php echo plugins_url( 'download.csv.php' , __FILE__ ); ?>">                 <input type="hidden" name="download" value="<?php echo get_home_path(); ?>" />                 <input type="submit" name="download_csv"  class="button-primary" value="<?php _e('Download the log (.csv)', $this->localizationDomain); ?>" />             </form>      And the download.csv.php file:               $core = $_POST['download'].'wp-load.php';          if(isset($_POST['download']) && is_file($core)){              require_once( $core );              global $wpdb;              $rows = $wpdb->get_results('SELECT * FROM `'.$this->dbName.'`;',ARRAY_A);              if($rows){                  require_once('classes/csvmaker.class.php');             $CSV = new CSVMaker();                  $CSVHeader = array();             $CSVHeader['id'] = "ID";             $CSVHeader['when'] = "WHEN";             $CSVHeader['who'] = "WHO";             $CSVHeader['description'] = "DESCRIPTION";             $CSVHeader['type'] = "TYPE";                  foreach($rows as $r){                 $CSV->addEntry($r);             }             $file_name = plugin_dir_path(__FILE__).'data.csv';             file_put_contents($file_name,$CSV->buildDoc);             ob_start();             header("Expires: Mon, 1 Apr 1974 05:00:00 GMT");             header("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");             header("Cache-Control: no-cache, must-revalidate");             header("Pragma: no-cache");             header("Content-type: application/CSV");             header("Content-Disposition: attachment; filename=$file_name.csv");             echo $CSV->buildDoc;             return ob_get_clean();             exit;              }       What am i doing wrong?


title: add_shortcode() not working inside of function

text:
I have a custom post type `bhour`, with a field `bh_shortcode`. When a post of this type is saved, I'd like it to add a shortcode based on the post's value of `bh_shortcode`. If the value of `bh_shortcode` is "test", and when a [test] shortcode tag appears on a normal post type, nothing happens--[test] text is not replaced. If I place `add_shortcode('test','save_bhour_details');` outside of the function, the [test] text is replaced. How can I use the `add_shortcode` function inside of another function?               function bhour_shortcode_handler(){         global $post,$bhourdays;              $output='
this is a test
';              return $output;      }                    add_action('save_post', 'save_bhour_details');          function save_bhour_details(){         global $post, $bhourdays;              if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){             return;         }              if ( get_post_type($post) != 'bhours'){             return;         }              //retrieve current values         $current = get_post_custom();              //if($_POST['bh_shortcode']!==$current['bh_shortcode'][0]){             //remove current shortcode             remove_shortcode($current['bh_shortcode'][0]);                    //save new value             save_bhour_field('bh_shortcode');                  //get current values             $current = get_post_custom();                  //register new shortcode             add_shortcode($current['bh_shortcode'][0], 'bhour_shortcode_handler');         //}              //register new shortcode         add_shortcode($current['bh_shortcode'][0], 'bhour_shortcode_handler');     }


title: How can I create a basic PHP that can lives outside WP?

text: I am trying to do an email subscriber form and I would like to implement my own solution. I do not want to spend hours trying to figure out which Plugins is the best. Spending more times to install it in the template. And then realize that I can't easily send back a confirmation email to the subscriber... All I want is a normal .php file and do my job real fast inside. Let's call that page sign-up.php But, if I POST (even if I only GET) on that page, my 404.php is being displayed. How can I avoid this? I could probably go edit my .htaccess but I do not know if WP is going to overwrite it to get rid of my instructions. Any tips? I am using WP 3.4.1


title: Google Site and WordPress

text: Can WordPress be used through Google Sites? Instead of creating a blog at WordPress itself, I considering to make a mesh of a website and blog using Google Sites and WordPress source code, but I'm not sure how to do this or even if it's possible. What do you think?


title: Wordpress Plugin: Demon Image Annotation

text: I've been having issues with this plugin. What it does is that as long as an image in your blog post has an "id", then every commenter can hover over the image and leave a note directly in the image/photo. It is syncronized with the WP comment system and so the image/phot note will appear as comment with a small thumbnail of the picture one has commented on. This seems to be the only up to date plugin of its kind. I really need this function for my blog, but I would never be able to write a plugin like that myself, so I need to get this to work somehow. The original idea for the plugin came from here. Here's an example post where you can hover over the images and leave notes on them. It works perfectly fine, however when I try to leave a comment to the post (without leaving an image note, so we're talking about a normal comment) while I'm not logged in, I get the following error message: > noted on #img-46 > > Warning: Cannot modify header information - headers already sent by (output > started at /hermes/bosweb25a/b155/ipg.zoomingjapancom/wp- > content/plugins/demon-image-annotation/imageannotation.php:178) in > /hermes/bosweb25a/b155/ipg.zoomingjapancom/wp-comments-post.php on line 95 > > Warning: Cannot modify header information - headers already sent by (output > started at /hermes/bosweb25a/b155/ipg.zoomingjapancom/wp- > content/plugins/demon-image-annotation/imageannotation.php:178) in > /hermes/bosweb25a/b155/ipg.zoomingjapancom/wp-comments-post.php on line 96 > > Warning: Cannot modify header information - headers already sent by (output > started at /her.../wp-content/plugins/demon-image- > annotation/imageannotation.php:178) in /her.../wp-comments-post.php on line > 97 > > Warning: Cannot modify header information - headers already sent by (output > started at /her.../wp-content/plugins/demon-image- > annotation/imageannotation.php:178) in /her.../wp-includes/pluggable.php on > line 934 Here's the plugins php code that is causing the problem: @Pastebin It might have something to do with the "echo" command in line 178. I tried "return" instead, but then the thumbnail of the image you commented on is not shown in the comment anymore. There must be another way. I've already tried a few things and it seems that other people don't have the same problem with the plugin, so I was wondering if it's actually the plugin or something else that's causing this problem. This is quite tough, but I hope somebody here can help me figure it out. EDIT: As for now I'm trying to call the javascript in a better way! So what looks like this in the plugin's php file:               echo "<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' type='text/javascript'></script>\n";     echo "<script type='text/javascript' src='". $plugindir ."/js/jquery.annotate.js'></script>\n";     echo "<script type='text/javascript' src='". $plugindir ."/js/jquery-ui-1.7.1.js'></script>\n";     echo "<script type='text/javascript' src='". $plugindir ."/js/jquery.md5.js'></script>\n";      Should look somehow like this: (this is a shortened version)               function add_my_javascripts() {         /* If this is the admin area of WordPress, don't do anything */         if( is_admin() )             return;              /* Register all of our scripts */              wp_register_script('jquery-ui-perso', get_template_directory_uri() . '/js/jquery-ui-personalized-1.5.2.packed.js', array('jquery', 'tab-renamer'));         wp_register_script('md5', 'http://zoomingjapan.com/wp-content/plugins/demon-image-annotation/js/jquery.md5.js', array('jquery', 'jquery-ui-perso'));         wp_register_script('jquery.annotate', 'http://zoomingjapan.com/wp-content/plugins/demon-image-annotation/js/jquery.annotate.js', array('jquery', 'jquery-ui-perso', 'md5'));              /* Enqueue the ones that need to be enqueued */             wp_enqueue_script('jquery.annotate');               }     add_action('wp_enqueue_scripts', 'add_my_javascripts');      Unfortunately this doesn't work, so I think I'm calling it wrong. Maybe I got the dependencies wrong? I don't een know what that md5.js is supposed to do, so I'm not sure. Anybody knows? **EDIT:** I've marked the only answer as accepted answer, however there's still no solution to this and I'm not the only one struggling with this plugin.


title: Display only deepest category on a single post?

text: I want to display the direct category ancestor of a given post. An illustrative example: These are the categories I have:   * Cat1   * Cat2      * Cat2.1        * Cat2.1.1       * Cat2.1.2     * Cat2.2        * Cat2.2.1       * Cat2.2.2.     * Cat2.3   * Cat3   * Cat4 I only put the posts in a single category between a same "level", but when the category has more sub categories, I check the whole trailing, like in:   * Cat1   * [X] Cat2      * [X] Cat2.1        * Cat2.1.1       * [X] Cat2.1.2     * Cat2.2        * Cat2.2.1       * Cat2.2.2.     * Cat2.3   * Cat3   * Cat4 Now, in the single post page, I want to display the name of the direct category ancestor of the post (Cat2.1.2 in this case). By default I just use `get_the_category()`, but it shows the top level category instead (Cat2 in this case). I don't considerer unchecking top levels by now because it cause another problems within the template.


title: Adding post_class into functions.php query

text:
Obvious newbie question I'm sure. Working on a friend's site and trying to figure out how to add post_class to a query. Just adding works fine and adds the div, but I don't know how to get it to run the `"id="post-<?php the_ID(); ?>" <?php post_class(); ?>"` part of it instead of echoing it.               $sidebar .= sprintf('<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
%s' . chr(13),      I'm sure it's a formatting thing of some sort that I don't know yet... still so much to learn...


title: do add_action on condition

text: This snippet for example will email on EVERY post:               function email_friends( $post_ID )       {        $friends = 'bob@example.org, susie@example.org';        wp_mail( $friends, "sally's blog updated", 'I just put something on my blog: http://blog.example.com' );             return $post_ID;     }     add_action('publish_post', 'email_friends');      ... whereas I just need add_action to run ONLY if the post is in category say "uncategorized", not any other category. Thanks!


title: Is there a way to set default custom fields when creating a post?

text: When I'm creating a new post, **just after clicking "Add New"** , when the post editor shows, instead of having to use the dropdown and choose a custom field to use, I'd like to have some default custom field inputs already openend. Visually, instead of : ![enter image description here](http://i.stack.imgur.com/RJfvH.png) I'd like to have something like : ![enter image description here](http://i.stack.imgur.com/HvgkU.png) I know there are plugins for that (CPT, More fields, etc.) but I'd like a simple way to do it with a basic function. I tried something like this (I'm using a custom post type 'product' ) :               function register_custom_fields( $post_ID ) {              global $wpdb;                  if( !wp_is_post_revision( $post_ID ) ) {                      add_post_meta( $post_ID, 'reference', '', true);                 add_post_meta( $post_ID, 'price', '', true);                  }          }          add_action('edit_product', 'register_custom_fields');      But that doesn't seem to work. I think that the hook is probably wrong (because `edit_post` comes after an update), but I don't see any hook for "new post" (right after user clicks on "new post" in wp admin). Is there any ? Or maybe the whole idea is wrong and there's another way?


title: How can I use more than 2 DB's

text: Say I buy a hosting package with GoDaddy and they allow 1GB max databases. So my question is how can I combine and use 2 DB's in WordPress? Is there a plug=in or do I need to edit the wp-config.php file? Benny, Age 12.


title: How to disable page delete

text: My client is not a computer person. I created a website for him. There is some important pages. My client is always delete this page. Then i want to reconfigure the code (the page id). How do i disable delete options for particular pages. PS: He may able to EDIT these page. Not Delete.


title: How do I get my loop.php to properly paginate?

text:
I am using the Starkers theme as a foundation to build my theme and I am having difficulty getting my loop.php to paginate posts properly. When I click the "Next" or "Previous" post pagination button, it succeeds in changing the URL to example.com/page/2 however it does not actually load new posts (I have dozens of posts with the category I am querying, so this is not the problem.) Here is the code I have in my loop.php file. Please let me know if you need me to clarify anything further.                               <?php include('includes/featured-content-slider.php'); ?>

                                                                                <?php query_posts('category_name=featured-news'); ?>                                 <?php while ( have_posts() ) : the_post(); ?>                                                                                <article class="post" id="post-<?php the_ID(); ?>" <?php post_class(); ?> >                                                                       <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
By <?php echo get_the_author(); ?> / <?php echo get_the_date('d.m.Y'); ?>
                                                                                <?php the_post_thumbnail(array(640,320)); ?>
<?php the_excerpt(); ?>

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

                                                                   <?php endwhile; ?>                                                                                <?php if ($wp_query->max_num_pages > 1) : ?>
                                 <?php next_posts_link( __( '← Older News', 'twentyten' ) ); ?>

                                 <?php previous_posts_link( __( 'Newer News →', 'twentyten' ) ); ?>
                         <?php endif; ?>

                                                                                <?php query_posts('category_name=other-news&showposts=6'); ?>                             <?php while (have_posts()) : the_post(); ?>

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>

<?php echo get_the_date('d.m.Y'); ?>

                                                               <?php endwhile; ?>                             <?php wp_reset_query(); ?>
                                 View More →


title: How can I create a portfolio archive for my portfolio CPT?

text: Sorry if I'm not asking the right question but, here's what I'd like to try and do... I'm working on this site I used a nice theme that included a portfolio CPT which I'm using for their product catalog, which is going to work well. But, the client would now like the capability to mark a product as sold and have it automatically move to a page that looks exactly like their product page, but only shows the items that have been marked "Archive" or "Sold," yet still retain the category system in place for their current stock. I'm comfortable with editing theme files and all, but I just don't know the best approach to the situation. Is there a plugin that might do what I'm looking for, or do I need to create another CPT with some filtering or something?


title: Is it worth updating WP admin to jQuery 1.5?

text: I read that jQuery 1.5 has just been released. Do you think that replacing version 1.4.2 with this new release is worth in terms of pure performance (on the admin side because my current theme does not use jQuery a lot)? Any side effects or compatibility problems?


title: When I click edit on a post, all the content disappear. Does anyone know how to fix this?

text: I am working on a site: greatlakesecho.org When I try to edit a post, the content just disappears from the visual editor. I am running the latest version of Word Press but this happened on the previous version as well. I am using the Project Largo theme with the site. The site was recently migrated from to a new host and has gone an overhaul into a responsive design. This first started happening when I changed the character encoding to remove odd symbols from the posts. I was successful in that by changing it to utf16. At this point only older posts that were created before the migration would disappear when I clicked edit. I have since updated to the latest version of Word Press and it happens to every post. I have tried removing all the plugins but no luck.   Tried different themes with no luck.   Tried repairing the database from cPanel. Here is the debugging info: WordPress database error: [Table 'greatlak_wp776.wp_itsec_lockouts' doesn't exist] SELECT `lockout_host` FROM `wp_itsec_lockouts` WHERE `lockout_active`=1 AND `lockout_expire_gmt` > '2014-04-22 19:52:36' AND `lockout_host`='35.9.132.246'; WordPress database error: [Table 'greatlak_wp776.wp_itsec_lockouts' doesn't exist] SELECT `lockout_user` FROM `wp_itsec_lockouts` WHERE `lockout_active`=1 AND `lockout_expire_gmt` > '2014-04-22 19:52:36' AND `lockout_user`=93;


title: Gravatar alternative for Wordpress

text: I don't know whether it's something I'm doing wrong or an issue with the Gravatar website in general, but it doesn't seem to let me create an account (no error is given, the account just doesn't get created). There's no contact information that I could find for them to contact them. Regardless, is there something that will provide the avatar functionality in a similar way that I can use (that works)?


title: Apply a Meta tag to one page only

text: I'm working on a IP Locator Service, and I want to display a Customized Google Map which shows the visitor's location. It works fine here, but I don't know how to incorporate it into my Blog. I've got the "html/javascript in Wordpress" Plugin, but I also need to apply a few Meta tags to the page. Is there any plugin/tweak that allows to add a meta tag _only_ to one page? Please Help!! **Edit: I also need to include javascript ( < script>< /script>). How can I do that?**


title: pictures does not apeare in posts

text: I installed last version of wordpress by activating network. I can upload images or any media and insert into posts, But when I publish that, medias including images or any other media. My htaccess file includes:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]      How can I see my pictures in my blog? Please help.


title: show count is out of the anchor tag in wp_list_categories

text: I'm using wp_list_categories with 'show_count' enabled on that, i styled my `<a>` tag, but the category count doesn't show up under anchor tag.(it's under `li`)               $args = array(                 'orderby'            => 'ASC',                 'show_count'         => 1,                 'pad_counts'         => 0,                 'hide_empty'         => 0,                 'title_li'           => '',                 'taxonomy'           => 'genre'      I didn't find anything on codex page. ![enter image description here](http://i.stack.imgur.com/QAvXy.png) Is there anyway to push the count number into the anchor tag? so it should be get the style.


title: Adapting a php array to WordPress

text: The guys over at the other Stackoverflow said I should post this here. I've been reading and tweaking code for three days and can't figure this out, because I'm new to php. The developer that wrote this php login script to a remote server didn't code it for WordPress and not for an automatic login like I need. I think I've figured out the automatic login at the end of the code I didn't post here. He created this code for his array that will have set values for the three api strings that never change, but I need to include the logged in WordPress user's username and password to be included in his array. The array info is passed by xml later in the script. This is for an automated SSL login to another server and when an image is clicked it runs the php code. This is the code I just got from him, but I don't believe it's correct because all of the colors just changed in Notepad++ when I inserted it:               // Set the Query POST parameters - array         $query_vals = array(     'api_username' => 'api-username-goes-here',     'api_password' => 'password-here',      'api_key' => 'api-key-here’,     'username' => $current_user[‘user_login’],     'password' => $current_user[‘user_pass’]             );      And the suggestions I got from the guys at Stackoverflow said: You need to call this somewhere in your code first:               global $current_user;     get_currentuserinfo();      Then you'll want to change your array to stuff like this:               'username' => $current_user->user_login      and then someone posted a corrected code sample of what I posted with this:               // Set the Query POST parameters     $query_vals = array(         'api_username' => 'api-username-goes-here',         'api_password' => 'password-here',          'api_key' => 'api-key-here',         'username' => $current_user['user_login'],         'password' => $current_user['user_pass']     );      So now I'm really confused what to do, because I don't what to screw up the developer's array. So I guess my question is how to adapt the code passing the three api strings that don't change and the WP currently logged in users username and password? I am working with a file copy so the original code doesn't get trashed. This is the whole php file being called by an onclick event:               error_reporting(E_ERROR);     ini_set(‘display_errors’,true);          // Set the Query POST parameters     $query_vals = array(     'api_username' => 'website-api-username',     'api_password' => 'api-password',      'api_key' => 'api-key goes here',     'username' => $current_user['user_login'],     'password' => $current_user['user_pass']          );          // Generate the POST string     $postdata = '';     foreach($query_vals as $key => $value) {     $postdata .= $key.'='.urlencode($value).'&';     }          // Chop off the trailing ampersand     $postdata = rtrim($postdata, '&');          // create a new cURL resource     $ch = curl_init();     curl_setopt($ch, CURLOPT_URL, 'https://third-party-provider.com/encrypt_login.xml');     curl_setopt($ch, CURLOPT_HEADER, false);     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);     curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);          // Save response to a string     $response = curl_exec($ch);     curl_close($ch);          $xml = simplexml_load_string($response);          // post the user data     $xml"&encrypted_username=".$encrypted_username"&encrypted_password=".$encrypted_password';     if ($xml = FALSE)     $url = ('https://website-that-is-originating-the-array.com/error')     ;          // Save response to a string     //var_dump($xml);     echo "Status: ".$xml->status;      That's the entire php file except for the closing tag.


title: Wordpress - custom fields are not restored to previous revisions

text: I have built several Wordpress websites and noticed that custom fields are not restored to previous revisions. This might cause a problem when using custom fields to store content. Anybody knows how to add the custom fields to the revision history? Thanks


title: Checking if Post Title is Unique as Loop Criteria

text: I'm trying to make a seemingly simple bit of php (it output's to a Gravity Forms field, but that's basically irrelevant). I'm using Gravity Forms to create posts, which I can do easily, however I want each post to have a unique title (as this is how the user navigates). I managed to get this working for registration by checking if the user registration id (also the post title in that situation) was already in use, like so: { // Builds complete user id function build_id ($pcode_id, $assigned_id_no) {                do {             $cmplt_id = $pcode_id . "-" . number_pad($assigned_id_no, 3);  // Gets postcode string and calls the number padding function to add the leading 0's              $assigned_id_no++; // Increase assigned_id_no         }         while(username_exists($cmplt_id));  // Restart loop if username_exists is true         return $cmplt_id;          return $cmplt_id;      } // Takes a string and add's however many 0's (or other character placed there) to the left of the string function number_pad($number,$n) { return str_pad((int) $number,$n,"0",STR_PAD_LEFT); } } $pcode_id is just a formatted post code as a string and $assigned_id_no is simply a loop number, passes 1 basically. As you can see the while criteria is does this exist, but for the life of me I can't emulate this by simply checking post type. The nearest I've come is get_page_by_title() and if it's null then finish else loop, but it doesn't work: { function home_patient_id() { $post_id = $_GET['home_id']; $home_post_code = get_post_meta($post_id, "wpcf-home-post-code", true); $home_post_code = format_id($home_post_code); $home_post_code = build_home_id($home_post_code, 1);               return $home_post_code;      } // Builds complete user id function build_home_id ($pcode_id, $assigned_id_no) {                do {             $cmplt_id = $pcode_id . "-" . number_pad($assigned_id_no, 3);  // Gets postcode string and calls the number padding function to add the leading 0's              $assigned_id_no++; // Increase assigned_id_no              $exist = get_page_by_title($cmplt_id);             }         while(get_page_by_title($cmplt_id));    // Restart loop if username_exists is true         return $cmplt_id;          return $cmplt_id;      } } I've also tried checking if it returns null but nothing is working, I either get nothing or an infinite loop. Can someone please help I'm pulling my hair out over this! Many thanks.


title: Is it possible to control content on different pages by checkboxing wich content is shown where on a wordpress theme page?

text: i have created a sidebar in my wordpress site. i want this sidebar to be displayed on each of my pages and subpages in their respective admin editors. i want the sidebar to contain a list of specific posts with checkboxes to select them independantly or together. each checked post must then be displayed on my site where i call the sidebar. is this possible? can anybody direct me towards a plugin that can accomplish this?


title: Script for initializing JQuery Masonry for Wordpress

text: What is the different between this (http://pastebin.com/PX0YB0hy) and (http://pastebin.com/VBqiMHVQ) for JQuery Masonry. Why does the first one work and the second one doesn't. In both cases I used wp_enqueue_script to add the script. Thanks!


title: How to remove "Read on" content in the_excerpt?

text: I know the_content has the handy dandy $strip_teaser argument that lets you set whether there is "continue reading" text. No such luck for the_excerpt... I would like to just get rid of it. I had previously tried to just shorten it to Read on but that didn't seem to work either.                function beernews_auto_excerpt_more( $more ) {         return ' …' . __( 'Read on →', 'twentyeleven' ) . '';          }     add_filter( 'excerpt_more', 'beernews_auto_excerpt_more' );      Theme is Twenty Eleven.


title: Why doesn't the "Remember Me" checkbox work for me on a live website? Only works on a local server environment

text: If I check "Remember Me", and then log out, my login and password are **not** remembered. I've tested this on many WordPress sites running WP 3.2.1 on a server here in NZ and also on a completely different server hosted in the US. It doesn't appear to be a problem with just my browser, as quite a few people have tested this for me. Although I have tried clearing all cookies, cache etc. It **does** however work locally with a MAMP setup on OS X. Is there something I need to install on the server to get this working? I presume it's using session cookies? Any ideas?


title: Display only certain posts based on visitor's country?

text: Is it theoretically possible to have the following feature? Each post has a country code. When a visitor comes in, the system will determine the visitor's country code. Then when the page renders, only the post with that country code is displayed. This need to also affect the widgets/site search etc. I was asked to evaluate this. I think this would lead to if statements all over the place, in the loop, and I need to modify the widgets too. All in all I think it is doable but is difficult and make the whole code-base unmaintainable. However I want to get some insight to this, since I only have experience in themes, not plugin development. Also I am not sure how to tag this more appropriately. Any suggestion is welcomed. **UPDATE** : I took a look at the **'Country Filter'** plugin, it's nice but does filtering in the content level not the post level. I am also looking at `add_filter(request,...)` to see if this can be done at the root.


title: How to call function within a page/post, to dynamically generate content?

text: I added the following function to the file `functions.php`               function contentGenerator($param) {        if($param) {           echo "Content true";        } else {           echo "Content false";        }     }      How can I call this function within a **specific** blog post or page?


title: Wordpress renames slug of tags used in multiple taxonomies?

text: I've noticed Wordpress renames the slug of identical tags used across multiple taxonomies, is there an easy way to change this behavior? Let's say I create a tag called Nintendo under the publisher taxonomy, then also create a Nintendo tag under the developer taxonomy. Wordpress will prefix the slug of the second tag with a 2. This basically makes the taxonomy/tag system unusable for my application. I want the slugs to stay the same across multiple taxonomies.


title: Two installs conflicting - Pages redirecting

text: I have two installs of wordpress on my server. **Site 1.** mysite.com **Site 2.** mysite.com/othersite The first wordpress install is located in mysite.com/wordpress, but is viewable at mysite.com, and the second install located in mysite.com/othersite, and viewable at the same address. I have page slugs activated for both sites. **Site 1.** works perfect. I can login to both admin panels and they work perfect. On **Site 2.** i can view the index page, but all other pages redirect as follows:   1. redirect to the 404 page of **Site 1.**   2. if a page has a similar name in both sites e.g. mysite.com/contact and mysite.com/othersite/contact, it will redirect to the page on **Site 1.** My guess is that something in the wordpress core files uses redirection for slugs. But this is a stab in the dark, and i have no idea how to solve it. Any help with this issue would be very much appreciated. Thanks


title: Adding a cancel button to edit post screen

text: I'm actually quite surprised WP hasn't already implemented this. I want to add a Cancel button to the edit post screen which will do some cleanup when pressed. After a little playing while watching my tables, here's some things I've noticed.   1. A new post is created with a `post_status` of `auto-draft`. This is changed to `draft` by the `autosave.js` script. I'm assuming it's safe to just delete this post on cancel. How can you distinguish between a previously saved draft and a "promoted" autodraft?   2. Post's with a `post_status` of `draft` don't produce a revision. Rather, these posts are updated without any way of reverting back. Is there a way to circumvent this behavior? Possibly by working on a copy of the original and merging on submit?   3. Once a draft is published, a revision is also created. This leads to all posts taking up at least two rows. Wasteful in my opinion since it's impossible for the two to be different. This revision should be created the next time the post is to be edited. Is it best to just let WP handle the revisions?   4. Post's with a `post_status` of `publish` produce an autosave at a set interval during its editing. This autosave is not removed when submitting the post, instead the `post_modified` date of the original is updated. Is it safe to delete this autosave on cancel? Thus, preventing the "A more recent version exists" message. Does WP have an auto clean of these or can/should I delete on submit? Basically what I want is a way for the user to gracefully undo all changes they made during an editing session. Is there anything I have overlooked or am I safe to implement this?


title: Add user settings to specific roles

text: Is it possible to do this? I already know about get current_user_can(), which does not work like I need. I'd like to be able to use an array if there are multiple roles.               // Check roles to only add fields to necessary users     function check_role( $user ) {         $user_role = get_user_role($user->ID);              if($user_role == 'author') {             return true;         } else {             return false;         }     }     add_action('show_user_profile', 'check_role');     add_action('edit_user_profile', 'check_role');          if(check_role()) {         add_action('show_user_profile', 'add_user_fields');         add_action('edit_user_profile', 'add_user_fields');         add_action( 'personal_options_update', 'save_user_fields' );         add_action( 'edit_user_profile_update', 'save_user_fields' );     }


title: Advanced search: roles and multiple taxonomies

text: I have a site with custom roles, and custom taxonomies. I'm making the advanced search, where custom posts can be filtered by roles and taxonomies. To accomplish this, I'm using my own custom SQL query, which works fine with the roles, and one taxonomy, but I'm having a hard time getting it to work with a second taxonomy (I get no results). Here's the code I'm generating (with some sample values coming in from the form):               SELECT DISTINCT p.* FROM wp_posts p      LEFT JOIN wp_usermeta um ON p.post_author = um.user_id      LEFT JOIN wp_term_relationships txr ON p.ID = txr.object_id      LEFT JOIN wp_term_taxonomy tx ON txr.term_taxonomy_id = tx.term_taxonomy_id      LEFT JOIN wp_terms trm ON tx.term_id = trm.term_id      LEFT JOIN wp_terms trk ON tx.term_id = trk.term_id      WHERE (um.meta_key = 'wp_capabilities' AND (um.meta_value LIKE '%student%' OR um.meta_value LIKE '%instructor%' ))      AND (tx.taxonomy= 'mediums' AND ( trm.name LIKE '%acrylic%' OR trm.name LIKE '%oil%' ))      AND ( tx.taxonomy= 'keywords' AND ( trk.name LIKE '%landscape%' OR trk.name LIKE '%test%'))      AND p.post_status = 'publish'      AND p.post_type = 'gallery'      GROUP BY p.ID      ORDER BY p.post_date DESC      When I input this directly into PHPMyAdmin, I get no errors, but the thing just hangs ("Loading message"). What am I doing wrong?


title: Creating a related posts section in wordpress inside a default post

text: I'm trying to create a related posts section in my custom theme. The objective here is if the user views a post from a certain category it will also show all the posts from that category below. I have attached an image below. http://i255.photobucket.com/albums/hh140/testament1234/relatedposts_zpsa830adfc.jpg How do I achieve this? Do I use `wp_query` just like this?               <?php query_posts('cat=6', 'posts_per_page=-4=-'); if(have_posts()) : while(have_posts()) :the_post(); ?>      The code above sets which category it obtains the posts from. I have already set the first loop which is the content of the post.


title: capability for upload on front-end (An error occurred in the upload. Please try again later )

text: We have a front-end form with wp-editor on front-end template page. Everything is working fine. but the only problem is "we can't add new images on front end form". there is an error "An error occurred in the upload. Please try again later" This front end shows only the author own files.               // Show only posts and media related to logged in author     add_action('pre_get_posts', 'query_set_only_author' );     function query_set_only_author( $wp_query ) {         global $current_user;         if( is_admin() && !current_user_can('edit_others_posts') ) {             $wp_query->set( 'author', $current_user->ID );             add_filter('views_edit-post', 'fix_post_counts');             add_filter('views_upload', 'fix_media_counts');         }     }      If the user is "Editor" or "Administrator" it works ok. then I think role problem with upload capibility. but I setup capability correctly.                function tour_all_user_attachment_callback(){         wp_get_current_user()->add_cap('upload_files');      }      add_action('init', 'tour_all_user_attachment_callback');      And I added this from here ( exposing attachment uploading to the front end -- delicate )                function insert_attachment($file_handler,$post_id,$setthumb='false') {       // check to make sure its a successful upload         if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();         require_once(ABSPATH . "wp-admin" . '/includes/image.php');         require_once(ABSPATH . "wp-admin" . '/includes/file.php');         require_once(ABSPATH . "wp-admin" . '/includes/media.php');         $attach_id = media_handle_upload( $file_handler, $post_id );              if ($setthumb) update_post_meta($post_id,'_thumbnail_id',$attach_id);         return $attach_id;       }                 // set $post_id to the id of the post you want to attach       // these uploads to (or 'null' to just handle the uploads       // without attaching to a post)            if ($_FILES) {         foreach ($_FILES as $file => $array) {           $newupload = insert_attachment($file,$post_id);           // $newupload returns the attachment id of the file that           // was just uploaded. Do whatever you want with that now.         }       }      it makes better. after I upload files it shows the error but it uploaded. I have to refresh and I can see the files uploaded. but still it gets the error and I had to refresh. any tips?


title: Category Alphabet List Broken

text:
I need help in making this work in the latest version of wordpress. On Version 3.6.1 and down works well when I tested but when i decide to update WordPress well it breaks it. Ex: Version 3.6.1 looks like this               A|B|C          (A)    (B)    (C)     Apple  Bat    Cat      Ex: The latest version 3.9.1 looks like this               A|B|C          (A)    (B)    (C)     Apple  Apple  Apple     Bat    Bat    Bat     Cat    Cat    Cat      This is the code that works on 3.6.1 can some one help me make it work on the latest version?               <?php      $a = array('name__like' => "a", 'order' => 'ASC', 'title_li' => '0', 'use_desc_for_title' => '0');     $b = array('name__like' => "b", 'order' => 'ASC', 'title_li' => '0', 'use_desc_for_title' => '0');     ?>

A

B

A

     <?php wp_list_categories($a); ?>

B

     <?php wp_list_categories($b); ?>


title: WP get stuck with a query on MySQL when the site is resumed

text: I'm running my web site from a local dev on a VM. Everything works fine with the exception of the resuming bit. When I resume the machine, systematically WP takes ages to load. And actually the problem is not with WP itself but with MySQl and a query WP is doing against the DB. Looking into what query / process the system is hang on using the following command               mysql -uUSERNAME -pPASSWORD DATABASE -e "show processlist;"      Return the following               | 203 | jumpinuk | localhost:60327 | jumpinuk | Query   |    0 | closing tables | INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_doing_cron' |      The above can stay there until I don't brutally stop the service and restart it. And even while restarting MySQL can take a little while to complete the procedure. Doeas anybody experencied the same? Is there any chance to figure out what is the plugin (if any) or the part of the site that want to interact with my Cron? I don't have anything AFAIK. Thanks?


title: Child theme functions.php

text: I'm not sure how to implement a change in my child theme's functions.php. In the woothemes documentation it says that "The functions.php in your child theme should be empty and not include anything from the parent themes functions.php." I need to use this function to not display a product category, but I'm not sure how to do this in my child theme. Perhaps someone can refer me to instructions?               add_action( 'pre_get_posts', 'custom_pre_get_posts_query' );          function custom_pre_get_posts_query( $q ) {          if ( ! $q->is_main_query() ) return;     if ( ! $q->is_post_type_archive() ) return;     if ( ! is_admin() ) {          $q->set( 'tax_query', array(array(     'taxonomy' => 'product_cat',     'field' => 'slug',     'terms' => array( 'hands-on' ), // Don't display products in the knives category on the shop page     'operator' => 'NOT IN'     )));     }


title: Is there an action for when permalinks are rebuilt?

text: In my plugin, I have a list of titles and permalinks in the options table. It's updated every time my custom post type is saved. Since I'm saving permalinks the option data can become bad if the user changes their permalink structure. I need a action that I can hook into that happens whenever the permalink structure is updated. Is there one?


title: Display link categories after link

text:
I am looking to extend this function to display the link categories after each link, as per the image below. ![Links with categories](http://i.stack.imgur.com/KSOkg.jpg) Because each link will have more than one category. What do I need to do to extend the function to support this? Any help is appreciated :)                   <?php     function display_links_with_categories_func($atts){         extract(shortcode_atts(array(              ), $atts));                  $bookmarks = get_bookmarks();              ob_start();              echo "
";              foreach($bookmarks as $bookmark){             echo "
link_url) ."'>" . $bookmark->link_name ." " . $bookmark->link_category . "
";         }         echo "
";         $list = ob_get_clean();         return $list;     }     add_shortcode('display_links_with_categories', 'display_links_with_categories_func');          ?>


title: Edit tag cloud widget number

text: By default, the _WordPress_ tag cloud widget has a set amount of 45 tags to display. This can be seen in the `wp-includes/category-template.php` file. By default, the _WooCommerce_ plugin which I have installed, and it's products tag cloud widget also resembles this. How do I modify this amount from within my `wp-content/themes/functions.php` file, to display for example, only 15 product tags? Here is what I have so far, but it is not working.               function custom_tag_cloud_widget($args) {         $args['smallest'] = 8; //smallest tag         $args['largest'] = 22; //largest tag         $args['number'] = 15; //adding a 0 will display all tags         $args['unit'] = 'pt'; //tag font unit         return $args;     }          add_filter( 'widget_tag_cloud_args', 'custom_tag_cloud_widget' );      When changing the number within the core `wp-includes.php/category- template.php` file to 15 however, it does work. Obviously, I don't wish to edit any core files and am looking for an alternative solution. Thanks.


title: Dark Bar at the top of wordpress page can't be seen?

text: I am new to wordpress and created a website as shown in the picture bellow. My webpage used to have a black bar at the top, which allowed me to insert "New Posts". (area shown in red circle). But this black bar is gone from my wordpress site now. Can you please tell me how can I get it back? Image Link: http://img211.imageshack.us/img211/3443/2vj6.jpg


title: Sticky Posts exceed posts per page limit

text: I'm using `pre_get_posts` to adjust the number of posts displayed on my homepage.               function lifelounge_query_adjust( $query ) {         if ( is_home() ) {             set_query_var( 'posts_per_page', 12 );             return;         }     }     add_filter( 'pre_get_posts', 'lifelounge_query_adjust' );      But I am running into a problem with sticky posts. Basically, if I have any sticky posts, the query will display _more_ than the 12 posts I have specified, because it will display 12 _plus_ any sticky posts. I could, of course, ignore sticky posts:               function lifelounge_query_adjust( $query ) {         if ( is_home() ) {             set_query_var( 'posts_per_page', 1 );             set_query_var( 'ignore_sticky_posts', 1 );             return;         }     }     add_filter( 'pre_get_posts', 'lifelounge_query_adjust' );      But I don't think this is ideal. I think the sticky posts should be _included_ in the limit of 12 posts, and not _added_ to the limit. That is what makes the most sense to me. Is there a way to achieve that? Have I made a face-palm- worthy error? Pretty much a duplicate of: Sticky Posts & Posts Per Page but that was weirdly closed as too localized. I disagree, obviously because I'm looking for an answer, but also because it is a question of why WordPress doesn't seem to respect the `posts_per_page` _limit_ if you are using sticky posts. If you want 12 posts per page you should get 12, not 13, which is what you would get if you had a single sticky post.


title: Convert featured images into "product images"

text: I am developing a large ecommerce site using Wordpress and WP Ecommerce plugin. I recently overhauled the theme and framework. Where as before I was only required to set a featured image for a product, the new framework insists the image be "used as product image" or "inserted into post". As there are 3000 or so images/products; I need a quick way to set the featured images as post/thumbnail images. Is there a quick solution to this? My initial instinct suggests I can copy the featured image value in the mySQL database and insert it into the corresponding value for thumbnail/product image with an SQL statement. Am I wrong? If not, does anyone have any idea how this phrase will look?


title: Filter custom post types in admin not working

text: Hello I'm wondering if anyone can help me figure this out. Essentially when I click on my custom post type 'Portfolio' in admin, I see a list of 'Services' next to posts, but when I click on one to filter (e.g. `http://localhost:8888/wp-admin/edit.php?post_type=portfolio&Service=web- design`) nothing happens! It still lists all taxonomies. Below is code used to register custom post type & taxonomy (apologies for length, but can't work out what is wrong):               add_action('init','portfolio_register');          function portfolio_register(){          $labels=array(     'name'=> _x('Portfolio','posttype general name'),     'singular_name'=> _x('Project','posttype singular name'),     'add_new'=> _x('Add New Project','portfolio item'),     'add_new_item'=> __('Add New Project'),     'edit_item'=> __('Edit Project'),     'new_item'=> __('New Project'),     'view_item'=> __('View Project'),     'search_items'=> __('Search Portfolio'),     'not_found'=>  __('Nothing found'),     'not_found_in_trash'=> __('Nothing found in Trash'),     'parent_item_colon'=>'');          $args=array(     'labels'=>$labels,     'public'=>true,     'publicly_queryable'=>true,     'show_ui'=>true,     'show_in_menu'=>true,     'menu_position'=>5,     'query_var'=>true,     'menu_icon'=> get_stylesheet_directory_uri().'/images/mag.png',     'rewrite'=>true,'capability_type'=>'post',     'hierarchical'=>false,     'supports'=>array('title','editor','thumbnail','comments'));           register_post_type('portfolio',$args);}          register_taxonomy("Service",array("portfolio"),array("hierarchical"=>true,"label"=>"Service","singular_label"=>"Service","rewrite"=>true));      Then to view columns in admin:               add_filter( 'manage_edit-portfolio_columns', 'my_edit_portfolio_columns' ) ;          function my_edit_portfolio_columns( $columns ) {              $columns = array(             'cb' => '<input type="checkbox" />',             'title' => __( 'Project' ),             'Service' => __( 'Services' ),             'date' => __( 'Date' )         );              return $columns;     }          add_action( 'manage_portfolio_posts_custom_column', 'my_manage_portfolio_columns', 10, 2 );          function my_manage_portfolio_columns( $column, $post_id ) {         global $post;              switch( $column ) {                       /* If displaying the 'service' column. */             case 'Service' :                      /* Get the genres for the post. */                 $terms = get_the_terms( $post_id, 'Service' );                      /* If terms were found. */                 if ( !empty( $terms ) ) {                          $out = array();                          /* Loop through each term, linking to the 'edit posts' page for the specific term. */                     foreach ( $terms as $term ) {                         $out[] = sprintf( '%s',                             esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'Service' => $term->slug ), 'edit.php' ) ),                             esc_html( sanitize_term_field( 'name', $term->name, $term->term_id, 'Service', 'display' ) )                         );                     }                          /* Join the terms, separating them with a comma. */                     echo join( ', ', $out );                 }                      /* If no terms were found, output a default message. */                 else {                     _e( 'No Services' );                 }                      break;                  /* Just break out of the switch statement for everything else. */             default :                 break;         }     }


title: Why aren't my posts showing?

text:
I'm creating a theme for my portfolio site. After a some time of trial and error research and almostss, I'm stuck. It's going to be very minimal site in content, therefore I decided to create a one page website. I'm using `get_pages($args);` to display each page in my front-page.php file. This works great. Now here's where I'm stuck...I'd like to use a page to display my blog posts, which would be included in my one page flow and be called in my WP_Query same as the other pages. So far I've tried the most documented method I can find; which is to change the page that's used to display posts in Settings>Reading. ## To confirm I have a static home page (front-page.php) which I've made a page template declared it in a page called home. Enabling me to set it in the reading settings, and I've created a page called blog for the same reason(this has template set to defualt). ![enter image description here](http://i.stack.imgur.com/OztC0.png) My posts are not being loaded into the blog page set here. I've read that a custom query could be interfering but I've checked this and it isn't the case in my situation. _Updated to use WP_Query rather get get_pages_ ## front-page.php                   <?php                  $args = array (                 'post_type' => 'page',                 'order' => 'ASC',                 'orderby' => 'menu_order',                 'posts_per_page' => 5,             );                  $query = new WP_Query( $args );                  if ( $query->have_posts() ) {                 while ( $query->have_posts() ) {                     $query->the_post(); ?>                          <a data-magellan-destination="<?php echo $post->post_name; ?>" name='<?php echo $post->post_name; ?>'>                     <div id="<?php echo $post->post_name; ?>" class="page-wrap full">
<?php the_title() ?>
                             <?php the_content() ?>
                      <?php }             } else {         }                  wp_reset_postdata();         ?>      Has anyone come across this type of situation before? Or am I missing something with my loop that would prevent the blog post from loading. I'm learning php and WordPress and hit my limit of experience. I think the call to the content of the blog page itself is preventing the post information to come through? I'm not sure. Any guidance would be appreciated. Thanks in advance


title: Get the category is not working on url

text: Although this is my first post but i have been coming here for answers so I know the rule and this isn't a duplicate because i have tried whatever i could but couldn't seem to get my codes to work. Note that I have gone through many answers and tried out several ways but none worked. Here is the problem, I am trying to rewrite the permalink structure, I wanted to add both the category and parent category to the url so it looks like the example below but somehow my code doesn't seem to work, the category and the parent slug are missing on the url from the function below. Function 1 - This one works ok, just for your info               function custom_list_rewrite() {         global $wp_rewrite;         $query_arg = 'post_type=custom_list&p=';         $wp_rewrite->add_rewrite_tag( '%post_id%', '([^/]+)', $query_arg );         $wp_rewrite->add_permastruct( 'custom_list', '%post_id%-%category%', false );         }     add_action( 'init', 'custom_list_rewrite' );      Function 2 -               function custom_permalink( $post_link, $id = 0, $leavename ) {         global $wp_rewrite;              $post = &get_post( $id );         if ( is_wp_error( $post ) || $post->post_type != 'custom_list' )             return $post_link;              //first thing first, get the category id from post id             $category_id = get_the_category( $post->ID );            //firstly, load data for your child category             $child = get_category( $category_id );         //from your child category, grab parent ID             $parent = $child->parent;         //load object for parent category             $parent_name = get_category( $parent );         //grab a category name             $parent_name = $parent_name->name;                     $newlink = $wp_rewrite->get_extra_permastruct( 'custom_list' );         $newlink = str_replace( '%post_id%', $post->ID, $newlink );         $newlink = str_replace( '%category%', $parent_name.'-'.$child->name, $newlink );         $newlink = home_url( $newlink );         return $newlink;              }     add_filter( 'post_type_link', 'custom_permalink', 1, 3 );      In the perfect world my link should look like http://www.mydomain.com/123-honda-civic but honda-civic is missing, so it's showing http://www.mydomain.com/123- Please point me to the right direction. thanks.


title: Problems accesing my site

text: I was building a new site with WP, but when I checked it with various servers on http://www.host-tracker.com/InstantCheck, most of the request are returning with a 503 error. In addition my memory usage gets overloaded very often, passing from 100mb usage to 1gb in matter of seconds. I was wondering what could be causing this, since the only page on my site with this problem is my homepage. Any suggestions? Thanks in advance!


title: Set custom upload path for custom post type only?

text: I have a custom post type of 'clients' and would like all images/files uploaded through the admin for these posts to go to a specific directory on my server, but everything else to stay as normal. Is this possible maybe using wp_upload_dir?