Getting a PHP Notice when using Pods with WPML

I have Pods and WPML installed, and I have SitePress Multilingual CMS extension installed for WPML, and I have many custom post types which I've added using Pods. Recently when I was checking the website after adding ?lang=ar to the end of the URL to check how everything looks (I haven't translated anything yet), I got a PHP Notice, it was repeated 46 times above the header, and it said:               Notice: Invalid object kind: _pods_field in /my/website/path/wp-content/plugins/sitepress-multilingual-cms/inc/template-functions.php on line 194      When I checked line 194 in template-functions.php, I found the following:               $post_types = array_keys((array) $wp_post_types);     $taxonomies = array_keys((array) $wp_taxonomies);     $element_types = array_merge($post_types, $taxonomies);     $element_types[] = 'comment';          if (!in_array($element_type, $element_types)) {         trigger_error(sprintf(__('Invalid object kind: %s', 'sitepress'), $element_type), E_USER_NOTICE);         return null;     }      I know it's just a PHP Notice that can be ignored, but I've found that the translated version of the website loads in 5X the time that the normal site takes, and I think that these 46 errors are the reason why it's so slow. I've tried removing all widgets, removing the navigation menu, clearing Pods cache, and nothing seems to work.


How to show one page with two different templates

I have a page template that I want to be able to show in two different modes: a regular mode and a bare-bones mode, where there is no header, footer, sidebar, etc. My hope is that I can get this done using a parent-child url, like so: Normal view: http://sample.com/mypage/ Barebones view: http://sample.com/mypage/clean/ I assume I will need to edit header.php as well as footer.php to check whether or not they should show up, but how do I figure out the parent-child relationship, or is there an easier way to get this done?


Save post to category with gravity forms (post_data)

I'm trying to save my posts, generated with gravity forms, to a specific category. However whatever I try, it's not working. The post must be saved to sepecific category, dependent from a gravity forms field. What I've tried so far:               add_filter("gform_post_data", "change_post_category", 10, 3);           function change_post_category($post_data, $form, $entry){              $cat_entry = $entry["6"];         $catslug = get_category( $cat_entry );              $post_data["post_category"] = $catslug->slug;         return $post_data;     }      I did also try to change save it with the category id, or by full name. Nothing works. It did however changed from 'no category' to - (nothing). Thanks.


$wpdb error (Call to a member function insert() on a non-object)

I have very few knowledge on oo php and databases, and I am simply trying to insert data in my wp_pagesvisites table but I am having some trouble with this error message. This is my script:               $wpdb->insert(         'wp_pagesvisites',         array(             'Adresse_IP' => $ip,             'Post_ID' => $id,             'Timestamp' => $time         )     );      Thanks for helping!


Are the wordpress Core css styles really all nessasary?

On WordPress Codex there are this CSS styles listed, its a quite big list of styles but it seems they are doubled unnecessary. It says: > Each Theme should have these or similar styles in its style.css file to be > able to display images and captions properly. The exact HTML elements and > class and ID values will depend on the structure of the Theme you are using this means **all** this styles should be in a theme? Whats the reason for this specificity for the align styles that are already declared? By looking at this this it be reduced drastically. What are the disadvantages in reducing this to a minimum?               /* =WordPress Core from http://codex.wordpress.org/CSS#WordPress_Generated_Classes     -------------------------------------------------------------- */          .alignnone {         margin: 5px 20px 20px 0;     }          .aligncenter,     div.aligncenter {         display: block;         margin: 5px auto 5px auto;     }          .alignright {         float:right;         margin: 5px 0 20px 20px;     }          .alignleft {         float: left;         margin: 5px 20px 20px 0;     }          .aligncenter {         display: block;         margin: 5px auto 5px auto;     }          a img.alignright {         float: right;         margin: 5px 0 20px 20px;     }          a img.alignnone {         margin: 5px 20px 20px 0;     }          a img.alignleft {         float: left;         margin: 5px 20px 20px 0;     }          a img.aligncenter {         display: block;         margin-left: auto;         margin-right: auto     }          .wp-caption {         background: #fff;         border: 1px solid #f0f0f0;         max-width: 96%; /* Image does not overflow the content area */         padding: 5px 3px 10px;         text-align: center;     }          .wp-caption.alignnone {         margin: 5px 20px 20px 0;     }          .wp-caption.alignleft {         margin: 5px 20px 20px 0;     }          .wp-caption.alignright {         margin: 5px 0 20px 20px;     }          .wp-caption img {         border: 0 none;         height: auto;         margin: 0;         max-width: 98.5%;         padding: 0;         width: auto;     }          .wp-caption p.wp-caption-text {         font-size: 11px;         line-height: 17px;         margin: 0;         padding: 0 4px 5px;     }


Can i use php sql functions instead of $wpdb?

I'm new to WordPress and was wondering why in WordPress API do they tell you to use functions such as `prepare()`, `insert()`, `get_col()`, `get_row()`, `query()`, etc. when technically I can use the built-in PHP-SQL functions such as `mysqli_query()`, `mysqli_fetch_assoc()`, etc. What exactly are the advantages of using the `$wpdb` SQL functions to execute queries?


Disable The Events Calendar plugin from loading its scripts

I have just installed The Events Calendar Pro. I am currently using the following custom template to hide any plugin related content and display a message and login link instead:               <?php if (current_user_can('read_tribe_event')): ?>       <div id="tribe-events-pg-template">         <?php tribe_events_before_html(); ?>         <?php tribe_get_view(); ?>         <?php tribe_events_after_html(); ?>       </div> <!-- #tribe-events-pg-template -->          <?php else: ?>       <?php echo get_template_part('restricted_access'); ?>     <?php endif; ?>          <?php get_footer(); ?>      What I am finding is that the javascript for the plugin is still being loaded and is throwing a exception, presumably because the content it expects to find is not there any more. This is stopping the javascript of another plugin from working. I am now thinking that there may be some hook I can use to prevent The Events Calendar plugin from loading any of its content and load my content instead. Does anyone know of the correct way to do this or have any other ideas?


How would I go about adding custom header images per category?

I am using WooCommerce along with the Neighborhood theme. I am trying to figure it out but I need some guidance if anyone can offer it.


trouble with the_post_thumbnail

I'm trying to create a portfolio page that will display a series of thumbnails and, when clicked on, will go to single.php. The code I'm using below seems to work in that when I click "see more" it goes to the proper page, however the thumbnails are not showing up. Any ideas as to why? Thanks. Live site. work.php                   <?php query_posts('cat=4'); ?>         <?php if (have_posts()) : while ( have_posts() ) : the_post(); ?>
                      <?php //get article_image (custom field) ?>                 <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID )); ?>                      <a href="<?php the_permalink(); ?>"<img src="<?php echo esc_url( $image[0] ); ?>" alt="View more info" />
<a href="<?php the_permalink(); ?>">See more

         <?php endwhile; ?>         <?php endif;?>              <?php wp_reset_query();?>
      functions.php               <?php                // unregister all default WP Widgets         function unregister_default_wp_widgets() {         unregister_widget('WP_Widget_Pages');         unregister_widget('WP_Widget_Calendar');         unregister_widget('WP_Widget_Archives');         unregister_widget('WP_Widget_Links');         unregister_widget('WP_Widget_Meta');         unregister_widget('WP_Widget_Search');         unregister_widget('WP_Widget_Text');         unregister_widget('WP_Widget_Categories');         unregister_widget('WP_Widget_Recent_Posts');         unregister_widget('WP_Widget_Recent_Comments');         unregister_widget('WP_Widget_RSS');         unregister_widget('WP_Widget_Tag_Cloud');         }         add_action('widgets_init', 'unregister_default_wp_widgets', 1);               // set thumbnail size             set_post_thumbnail_size( 130, 130, true ); // default Post Thumbnail dimensions (cropped)                    ?>


Full page (no WP admin menus and options) admin theme options

I'd like to drag and drop functionality into one of the admin pages and I've been wondering about the best way to implement it: an iframe or something else? What I'd like is: Once the use choose the theme, it'll be redirected to the page (under one of the admin menus) which will have a link that would launch the drag and drop options in a full page (without the admin menu on the left side). Like I said, I've been thinking about an iframe, but I'm not it'd be the best solution. Any suggestions?


Not sure how I would go about doing this in WP.. related to custom tags

Okay, so I want to do something, and after searching on Google I couldn't find any answers. Maybe you guys can help. basically, I want to assign every post with a little bit of unique identification information. Every post would be tagged white, gray, or black. **I don't want to use categories or tags because I want to display this "unique identifier" on the home page only, and not in the posts where the categories and tags are already shown.** For example, If I made a post about white tigers, I would want to **identify it as white post** (no racism or anything intended, just an example), and display it on the home page only. If I made a post about gray tigers, I would want to identify the post as gray, and you get the point. _**How can I go about doing this without a plugin?_** **TL;DR - Want to identify each post with a unique identifier, but can't use categories and tags.** Please help!


How many members have made comments approved for an article?

Good afternoon. Please, I would like to have a function that calculates for each post displayed (one by one), not how many comments, but how many are the authors of the comments for the post viewed at that time. Something like this:               function commentCount() {     global $wpdb;           $count = $wpdb->get_var('SELECT COUNT(distinct comment_author) FROM' .$wpdb->comments. 'WHERE comment_approved = 1 AND comment_post_ID = $postID');         echo $count;           }      Thank you very much!. * * * @ s_ha_dum: Goog Afternoon. To explain better, I enclose a picture of the condition that I got on the page of a post, at the beginning of the field of the comments. ![enter image description here][1] [1]: http://i.stack.imgur.com/bNElu.jpg http://i.stack.imgur.com/bNElu.jpg


template page to show custom a post types only

Does anyone know how to make this page template to only show knowledgebase post types? I've tried various different ways but with no luck               <?php       $cat_args = array(       'taxonomy' => 'knowledgebase_category',       'orderby' => 'slug',      'order' => 'ASC',      'hierarchical' => true,      'parent' => 0,       'child_of' => 0       );           $categories = get_categories($cat_args);       $catCounter = 7;      foreach($categories as $category) {       $catCounter++;      if ($catCounter == 1) {       echo '

';      }       elseif ($catCounter == 8) {      $catCounter = 1;      echo '
';      }      elseif ($catCounter == 3) {       $catCounter = 0;      }            echo '
';      echo '
term_id ) . title="'            .         $category->name . '" ' . '>' . $category->name.'
';          // Sub category     $sub_category = get_category($category);     $subcat_args = array(     'orderby' => 'name',     'order' => 'ASC',     'child_of' => $sub_category->cat_ID,     'parent' => $sub_category->cat_ID      );      $sub_categories = get_categories($subcat_args);            foreach($sub_categories as $sub_category) {      echo '
';     echo '
 term_id ) . '" title="' . $sub_category->name .     '" ' . '>' . $sub_category->name.'
';     echo '
';         }                   //List Posts              // Smart Lists         $cat_post_num = gt_get_option('kb_aticles_per_cat');              $sub_category_num = count($sub_categories);         if ($sub_category_num != 0) {         $cat_post_num_smart = $cat_post_num - $sub_category_num;          } else {         $cat_post_num_smart = $cat_post_num;             }         $posts_order = '' ;// of_get_option('st_hp_cat_posts_order');                  global $post;         // Listed by popular?         $cat_post_args = array(           'post_type' => 'knowledgebase',        'numberposts' => $cat_post_num_smart,           'orderby' => $posts_order,               );              $cat_posts = get_posts($cat_post_args);         echo '
';         foreach($cat_posts as $post) : setup_postdata($post);         if (get_post_format() == 'video') {         $post_icon = 'icon-film';         } elseif (get_post_format() == 'image') {          $post_icon = 'icon-picture';         } else {         $post_icon = 'icon-file';          }         ?>
<i class="<?php echo $post_icon; ?>"> <a href="<?php the_permalink();       ?>"><?php the_title(); ?>
             <?php      endforeach;     echo '
';          echo 'term_id ) . '" title="" ' . '>View all ' .     $category->count .' articles ';         echo '
';          }         ?>


Changes to .htaccess not updating the file (old rules still take effect)

I was running a Wordpress site using pretty permalinks, and everything was dandy - the .htaccess file was behaving, and url rewriting was working. This weekend, I decided to convert the site into a multisite installation, and followed the instructions with no real problems until I tried to enable pretty permalinks on the new sites. Nothing happened when I saved the changes on the permalinks page - I checked, and the .htaccess file was not changed. I tried to change the permalinks settings on the original site, but I can't change those settings successfully either. I can enable pretty permalinks with the existing settings (i.e. domain.com/%postname%/), or disable them (i.e. domain.com?p=123), but I can't switch to another type of permalink, only %postname% works. Again, the .htaccess is never updated, but URL rewriting is occurring properly for %postname% pretty permalinks. I tried deleting the .htaccess to see if WordPress would create a new one, but no, all that did was break the images on my multisite blogs. A new .htaccess was never created. I thought it was probably a permissions problem, so I tried to change the permissions on .htaccess to 777, but that made no difference. I also chowned .htaccess to apache:apache (for good measure), but again, no dice. The permissions are now identical to those of the file upload folder (which is working perfectly across all sites), but the file is never changed. What confuses me the most is that I never get any kind of error from WordPress about permissions or even being unable to write to the file. I'm turning here in the hopes that someone may shed some light on even a new idea for debugging, let alone a solution to the issue. Here is my current .htaccess, for reference:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule . index.php [L]      Thanks in advance,


> added to images link in Wordpress

For some reason today my Wordpress decided to add > to every image link on the website, resulting 404 on every image. Any idea how to resolve it? Nothing has been changed from the last time it worked, not even a new plugin installed.


Send email only upon draft

I'm trying to send an email only upon saving a post as a draft, this doesn't seem to work with the current code:               add_action( 'save_post', 'er_send_email_on_post_draft_save' );          function er_send_email_on_post_draft_save( $post_id ) {              //verify post is not a revision         if ( $post_id->post_status == 'draft' ) {                  $post_title = get_the_title( $post_id );             $post_url = get_permalink( $post_id );             $subject = 'A post has been updated';                  $message = "A post has been updated on your website:\n\n";             $message .= "" .$post_title. "\n\n";                  //send email to admin             wp_mail( 'myemail@undisclosed.co.uk', $subject, $message );              }     }      it works if I change the if statement to:               !wp_is_post_revision( $post_id )      but that's not what I want, I only want to send notification if it's saved as a draft only.


How to create a metabox that will list all my pages in a dropdown selector?

I would like to have a metabox for the user to be able to select from a dropdown list one page from the website. I need to save the user choice, so I can use it later. So, my question is how can I create a metabox that will list all my pages?


Pods custom type integration with navigation menu and current_menu_parent

I have a Pods type called `project`, and a Pods pages url as `project/*` (which links to a template to show the project). I also have a normal Page which lists the projects (via a custom shortcode that loops through all the pods) and outputs on the page. My navigation menu is simple: Home, About Us, Method, Our Work, Contact Us. I need further guidance please on how to link up the Pods `project/*` page so that when a specific project is being displayed, the top level Projects link is highlighted with the correct wordPress class `current_menu_parent`. Also where should the Pods page be listed in the Wordpress Appearance -> Menu, as I see no link there for the Pods type. How can I do this please? ![unable to link pods custom type to nav menu](http://i.stack.imgur.com/HWOPx.png)


Front end registration/login & publish/update 1 custom post

I want to be able to allow a user to **register/login via a front end form** and be able to **create 1 custom post** which only they will be able to **edit and update via a front end form**. This will be part of a "dashboard". **It's very important that this works with thehttp://www.advancedcustomfield.com plugin.** I've managed to get some of the way there by using the front end forms from ACF. This allows the editing and updating of a custom post. The problem with this is that:   1. There is no front end registration/login.   2. The post was already created, whereas I need a user to login and create 1 post initially.   3. I'm only able to front end edit the post when I'm on the actual page. I need the user to only be able to edit their own post. **If anyone could point me in the right direction with those issues or has any creative ways to get around them then that would be great. I need to do this without using lot's of other plugins.** **UPDATE:** I've found that this will allow me to create a new post via a front end form. Using the `action` of the form I think I can redirect the user to the custom post they just created. Therefore that will allow them to update/edit the post via the 2nd code box below. **So all that I need to do is the user registration/login!**               <?php $postTitle = $_POST['post_title'];     $post = $_POST['post'];     $submit = $_POST['submit'];          if(isset($submit)){              global $user_ID;              $new_post = array(             'post_title' => $postTitle,             'post_content' => $post,             'post_status' => 'publish',             'post_date' => date('Y-m-d H:i:s'),             'post_author' => $user_ID,             'post_type' => 'post',             'post_category' => array(0)         );              wp_insert_post($new_post);          }          ?>     <!DOCTYPE HTML SYSTEM>               <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />     <title>Untitled Document</title>
     <form action="" method="post">

         Post Title	         <input name="post_title" type="text" />

         Post	         <input name="post" type="text" />

          <input name="submit" type="submit" value="submit" />     </form>
                     The code below allows the user to edit/update the post they just created.               <?php     /**      * @package WordPress      * @subpackage Default_Theme      * Template Name: Login      */     acf_form_head();     get_header(); ?>              <?php if (have_posts()) : ?>             <?php while (have_posts()) : the_post(); ?>
     <?php global $current_user;     get_currentuserinfo();     $page_name = $current_user->user_login; ?>     Logged in as: <?php echo $page_name; ?> (<?php echo $current_user->ID; ?>)
     List posts by <?php echo $page_name; ?>:          <?php                    $loop = new WP_Query( array(         'post_type' => 'page',         'author' => $current_user->ID     ));          while ( $loop->have_posts() ) : $loop->the_post();      the_title();     echo "
";     endwhile;          //Reset Query     wp_reset_query();          ?>          <?php $defaults = array(         'post_id' => $post->ID, // post id to get field groups from and save data to         'field_groups' => array(), // this will find the field groups for this post (post ID's of the acf post objects)         'form_attributes' => array( // attributes will be added to the form element             'class' => ''         ),         'return' => add_query_arg( 'updated', 'true', get_permalink() ), // return url         'html_field_open' => '
', // field wrapper open         'html_field_close' => '
', // field wrapper close         'html_before_fields' => '', // html inside form before fields         'html_after_fields' => '', // html inside form after fields         'submit_value' => 'Update', // value for submit field         'updated_message' => 'Post updated.', // default updated message. Can be false to show no message     );          acf_form(); ?>
                  <?php endwhile; ?>         <?php endif; ?>          <?php get_footer(); ?>


saving file to external server vip

I have a handwritten script that writes a text file locally in one of my Wordpress pages, but now I need it to read and write to a remote server that is password protected and accessible only through SSH or SFTP. I can't write to the local filesystem at all. Only the remote server. What would be the best way of doing this?


wpColorPicker is not a function!

i tried to use iris color picker in my plugin admin area but when i implemented i'm getting this error- **TypeError: $(...).wpColorPicker is not a function** Code-               function sam()     {     wp_enqueue_style( 'wp-color-picker');     wp_enqueue_script( 'wp-color-picker');     }     add_action( 'admin_enqueue_scripts', 'sam' );                    <input type="text" value="#bada55" class="ir" />                     <script type="text/javascript">             jQuery(document).ready(function($){         $('.ir').wpColorPicker();     });             </script>      Why am i getting this error any clue? where am i making wrong?


How do I allow a specific Role in Wordpress 3+ to only see certain plugins?

I am familiar with user roles and how to change them within Wordpress 3+, My problem is when I disable a user from being able to view plugins, all plugins are disabled from view. How do I let them see only specific plugins? Thanks in Advance, Michael


Creating a WordPress shortcode

I'm coding my first WP shortcode and am having trouble turning my working PHP into a working shortcode. I have successfully created a basic shortcode that returns text in the spot I'd like so that much is good. But I'm not doing so well putting the chocolate in the peanut butter. Here's what I have for the working PHP:

Connect, Share & Follow

                <?php $meta_socialgr = apply_filters('the_content', get_post_meta($post->ID, 'author_goodreads', true));                   if (!empty($meta_socialgr)) { ?>
<a href="<?php echo get_post_meta( $post->ID, 'author_goodreads', true );?>">
                <?php } ?>

                    And here is my basic shortcode:               <?php     // Adding a shortcode to return each author's social media links         function funcauthor_social( $atts ){             $output = 'bubbalicious';             return $output;         }         add_shortcode( 'author_social', 'funcauthor_social' );     ?>      I'm not having much success in replacing "bubbalicious" with my functions as I'm just not grasping...something.               <?php     // Adding a shortcode to return each author's social media links         function funcauthor_social( $atts ){             $output = '

Connect, Share & Follow

'.$meta_socialgr = apply_filters('the_content', get_post_meta($post->ID, 'author_goodreads', true));                  if (!empty($meta_socialgr)) { '
ID, 'author_goodreads', true );.'">
'.}.'

';           return $output;      }         add_shortcode( 'author_social', 'funcauthor_social' );         ?>


wp-admin is redirecting to back to home page (localhost)

I have WordPress installed on my localhost. All worked perfectly till today. But today when I enter http://localhost/wp-admin in the url to access the admin panel, it redirects back to the home page. I can't get access the admin panel. It's not happened before, whenever I try to access admin panel, it does. Please guys help me out.... Thank You.


Wordpress for Podcast Network

Is there a theme or some hack of the categories system that I can use to create a site for a podcast network? I want it similar to This Week in Tech in that all the podcasts will appear on the front page, but also each have their own homepage. I do not think a multi-site installation will be my solution. Each podcast must have its own RSS feed with podcast enclosures. Any ideas on how this could be done? I'm thinking that each podcast would be a category and each podcast home would be a separate category listing page.


Google Map is not working on the second tab of Tab Plugins

I am using a postTabs plugin and Comprehensive Google Map Plugin, my problem was when I have my Google map on the second tab, the map is not loading as expected. But if I move it on the 1st tab it works really great.. Is there any way to make the map work on the second tab? Actually, whichever Tab plugin I use the map is not loading properly on the second tab.. Any suggestion is appreciated. Thanks :)


How to add PHP pagination to wordpress

I'm trying to make a custom PHP pagination work with wordpress, the page in wordpress is a very custom one, not a post or a page, it's a select from DB that shows flowers, the styling is ok now, but it shows all the flowers in a city and i want to limit 10 flowers per page:               $per_page = 10;     $page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;     $startAt = $per_page * ($page - 1);          $user_query_subs = new WP_User_Query( array('meta_key' => 'location', 'number' => $per_page, 'offset' => $startAt, 'meta_value'  => $flow_location, 'meta_compare' => '=', 'role' => 'admin', 'orderby' => 'rand', 'order' => 'DESC'), array('fields' => 'all_with_meta') );               $all_user_query_subs = new WP_User_Query( array('meta_key' => 'location', 'meta_value'  => $flow_location, 'meta_compare' => '=', 'role' => 'admin', 'orderby' => 'rand', 'order' => 'DESC'), array('fields' => 'all_with_meta') );          $all_flowers = $all_user_query_subs->get_total();     $flowers = $user_query_subs->get_results();      and after the content is loaded: i'm adding the links on the bottom like this:               <?php             $totalPages = $all_flowers / $per_page;             $links = "";             $current_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];             for ($i = 1; $i <= $totalPages; $i++) {             $links .= ($i != $page )                  ? "Page $i "                 : "$page ";     }         echo $links;         ?>      The select query is working perfectly, it's loading only 10 per page, but my problem is with the `links` at the bottom: Right now when i press the page 2 to access the next 10 flowers from the city, i get `Page Not Found` from `Wordpress` but with the correct `$current_url/page/$i` Any ideas please? Thanks in advance!


Screen Options JavaScript Code

I want to know, what script drives the "screen options" animation toggle in WordPress. I'm referring to the options menu that slides out when the admin clicks the "Screen Options" link near the upper right corner of the window in the Post, or Page, or Categories, etc. – and slides back in when the same link is clicked again. Would appreciate it if someone knowledgeable could show me the exact location of that JavaScript code snippet.


looping widgets to organize bootstrap grids

Using twitter bootsrap I want to grid my widgets if in the same position more widgets are present what I mean: having a registered widget               register_sidebar(array(         'name' => __('Footer Top', 'roots'),         'id' => 'footer-top',         'before_widget' => '
',         'after_widget' => '
',         'before_title' => '
',         'after_title' => '
',     ));      how would I count and loop all widgets in columns? Lets say I have theoretically 3(this would be variable) widgets in a given position than I would split 12/3(or with another counted) which would give me with the example above `footer_teaser col-sm-4 col-md-4` than the expected result would generate something like

About us

Fugiat dapibus, tellus ac cursus commodo, mauesris condime ntum nibh, ut fermentum mas justo sitters.

 3 Athens street

 (+30) 265-9987

 (+30) 9854-7855

 hello@domain.de

      So far what I found for counting the widgets               function count_sidebar_widgets($sidebar_id, $echo = true) {         $the_sidebars = wp_get_sidebars_widgets();         if (!isset($the_sidebars[$sidebar_id]))             return __('Invalid sidebar ID');         if ($echo)             return 12 / count($the_sidebars[$sidebar_id]);         else             return count($the_sidebars[$sidebar_id]);     }      than on generation I do               register_sidebar(array(         'name' => __('Footer Top', 'roots'),         'id' => 'footer-top',         'before_widget' => '
',         'after_widget' => '
',         'before_title' => '
',         'after_title' => '
',     ));      but I'm not satisfied with it


Can't upload files

I've been developing a wordpress website (with a custom theme) for a month. Today I wanted to upload an image to a page and I got a message saying there was an error and I should try again later. I tried to upload the image directly to the library and I got the following error: > 1096 Notice: ob_end_flush(): failed to delete buffer zlib output > compression. in (...)/wp-includes/functions.php on line 2707 I deactivated all plugins, that didn't work. I tried changing the theme to twenty twelve, that didn't work. Is there anything I can do to fix this issue, or at least understand what this is all about?


Wordpress Importer Tries to save media files to wrong site folder

I am importing from one WordPress multisite instance to another, using Tools -> Export to generate a WXR file that I then import with and Tools -> Import . I receive the "Failed to import media" message for all files. When I look at the apache log(on the production server, which is importing) I get: ` [Wed Nov 13 11:05:30 2013] [error] [client 10.11.1.13] client denied by server configuration: /var/vhosts/wordpress/html/wp-content/uploads/sites/10, referer: http://drawyourweapons.wordpress.drake.edu/ ` The path on the test server I am importing from is: /var/vhosts/wordpress- test/html/wp-content/uploads/sites/10 The path to the new site on the production server is: /var/vhosts/wordpress/html/wp-content/uploads/sites/6 I do not understand why it is trying to get to that site on prod


Querying posts globally based on custom taxonomy with its own taxonomymeta table

I have gone through the process of creating a custom taxonomy + admin panel for a custom post type in my site. These taxonomies store various meta data in a `wp_taxonomymeta` table and use get_metadata/set_metadata to get and set the values of these fields. One of the fields in this taxonomy is an enabled/disabled flag. I would like to globally exclude posts that have the disabled flag set to true. I am hooking into `pre_get_posts`, but I cannot figure out how to modify the query so that I can pull data in the `wp_taxonomymeta` for use in the query to exclude posts that should be hidden. Can anyone provide some insight into doing this? I could not find much helpful advice on google. If clarification is needed, please ask, I will do my best to clear anything confusing up. **EDIT FROM COMMENTS** I'm trying to modify the main query. The idea is ultimately to be able to hide/show globally across the site based on the taxonomy's meta data flag value. So I have a plugin that implements a `pre_get_posts` hook, but I cannot get the query figured out with the custom table (at least in the typical wordpress fashion, raw SQL would be cake, but I'm wanting to modify the main query). There's not a lot of documentation around for working with these taxonomy tables since it seems to be a disputed way of doing stuff in wordpress.


How to redirect non-logged in users to login with post_password_required()

I have created a membership site which is working how I would like in that non-members cannot view private pages. However, I want that when someone who has not logged in, clicks on a link that links to a private page, they should be directed to my login page. The closest I can figure out is using post_password_required(), but it doesn't seem to be working. I don't want to hide the links from non-members.               function redirect_to_login() {         if( post_password_required( get_the_ID() )  ) {             wp_redirect( "index.php?p=50" );         }     }     add_action('wp', 'redirect_to_login');


When we register a custom taxonomy or post type, does the WP database modified at all?

When you use the `register post type` and `register taxonomy` functions in your functions.php, where do all that setting info get stored in regards to the CT's and CPT's you are registering? I'm talking about the settings such as whether the CPT is public or not, which custom post types work with which registered taxonomies, whether custom taxonomy is hierarchical or not etc. Is that all on the server memory? If so, what's the reason of not saving it on the database -for example in wp_options table? Isn't the `wp_options` table specifically deal with stuff like this?


Can figure out how to get wordpress to go .com not .com/directory

hey I just installed wordpress and everything is working fine but when I go to www.domain.com nothing shows up it only works when I go to www.domain.com/directory anyone know how to change this? I've tried googling it but I can't figure out how to "phrase" it to google, lol. thanks.


How to enque js script in footer that are not in .js file?

I do have code that is js script inline together with php script is their possible way to enque it to footer without puting it on .js file To clear explanition on my question here is my example code               <script>         $(function(){             $('#slides').slides({                 preload: <?php echo $option1 ?>,                 generateNextPrev: <?php echo $option2 ?>             });                         //some other script               });     </script>      Without putting that code in single js, How can I enque it? I see the documentation about enque script usage which only needs 'src'               wp_enqueue_script(           $handle         ,$src         ,$deps         ,$ver         ,$in_footer      );


List of Posts and Categories

I have a custom taxonomy of Species and a custom post type of Animals. I would like to display them in a tree view like so: ## All Animals   * **Fish (taxonomy term)**     * Shark (Custom Post Type)     * Sun Fish   * **Mammals**     * Monkey     * Zebra Each item in the list would be linked to its respective place. So the custom post types link to the animal and the taxonomy terms go to the taxonomy page. I'm aware of ways for WordPress to list categories, but I would also like the posts grouped under each category (custom taxonomy) as well.


Wordpress redirect to splash page once a day for the first week

How can I redirect the user to the splash page for the first week they ever visit only? This code would redirect it once every week, but I'm more after a once a day for 7 days solution:               function checkAccessed(){     if ( !isset($_COOKIE['accessed']) ) {          setcookie('accessed', 'yes', time() + 3600*24*7);          define("ACCESSED", false);     }else{         define("ACCESSED", true);     }     }     add_action("init", "checkAccessed");      The splash page should permit the user to go to the home page between other links.


Endpoints help with permalinks

I'm trying to do the following, and I believe its done with endpoints, but I'm not entirely sure. I have 2 different CPTs. Let's call them "Movies" and "Music." The music is always from movies, but I wanted its own CPT for SEO reasons. Anyhow, rather than have, for example:               example.com/movie/rocky      and               example.com/music/rocky      I'd much rather have               example.com/movie/rocky/music      Where the `/music` for each movie points to a template and ultimately displays the other CPT. Is this done with endpoints? I know theres a way to do this, I'm just not 100% sure how. I'd call myself intermediate with PHP and WP development... Nothing amazing, but I'm definitely not a beginner. Just can't wrap my head around endpoints, and it may be because I'm looking at the wrong solution.


Search Results Page - Displaying Custom Meta Fields

For the search results page Im making a custom template. And in that custom template I want to display custom meta field values. However, when I do this:                   <?php if ( have_posts() ) : ?>                  <?php /* Start the Loop */ ?>             <?php while ( have_posts() ) : the_post(); ?>                      <?php                 $pName = get_post_meta($post->ID, $productName, 'true');                 echo $pName;      );         ?>             <?php endwhile; ?>                  <?php else : ?>                 <?php get_template_part( 'content', 'none' ); ?>              <?php endif;      The result I get is not the value of the custom field but:               Array      When I var_dump the $pName it shows all the right custom field content. Question: Why am I getting an array as the result (when Ive told it its a single result with 'true') and how do I fix it so it displays the proper content? Thanks! --- UPDATE #1 --- var_dump($pName) with true set:               array(12) { ["productName"]=> array(1) { [0]=> string(10) "Lemon Kush" } ["locationName"]=> array(1) { [0]=> string(57) "La Brea Caregivers THE BEST $35 CAP in the 90019 Zip Code" } ["locationAddress"]=> array(1) { [0]=> string(18) "1188 S La Brea Ave" } ["locationCity"]=> array(1) { [0]=> string(11) "Los Angeles" } ["locationState"]=> array(1) { [0]=> string(11) " California" } ["locationZip"]=> array(1) { [0]=> string(6) " 90019" } ["locationPhone"]=> array(1) { [0]=> string(15) "1(323)-549-0400" } ["meta_priceGram"]=> array(1) { [0]=> string(0) "" } ["meta_priceEighth"]=> array(1) { [0]=> string(0) "" } ["meta_priceQuarter"]=> array(1) { [0]=> string(0) "" } ["meta_priceHalfOunce"]=> array(1) { [0]=> string(0) "" } ["meta_priceOunce"]=> array(1) { [0]=> string(0) "" } } string(0) "" array(12) { ["productName"]=> array(1) { [0]=> string(10) "Lemon Kush" } ["locationName"]=> array(1) { [0]=> string(57) "La Brea Caregivers THE BEST $35 CAP in the 90019 Zip Code" } ["locationAddress"]=> array(1) { [0]=> string(18) "1188 S La Brea Ave" } ["locationCity"]=> array(1) { [0]=> string(11) "Los Angeles" } ["locationState"]=> array(1) { [0]=> string(11) " California" } ["locationZip"]=> array(1) { [0]=> string(6) " 90019" } ["locationPhone"]=> array(1) { [0]=> string(15) "1(323)-549-0400" } ["meta_priceGram"]=> array(1) { [0]=> string(1) "5" } ["meta_priceEighth"]=> array(1) { [0]=> string(2) "15" } ["meta_priceQuarter"]=> array(1) { [0]=> string(0) "" } ["meta_priceHalfOunce"]=> array(1) { [0]=> string(0) "" } ["meta_priceOunce"]=> array(1) { [0]=> string(0) "" } } string(0) "" array(12) { ["productName"]=> array(1) { [0]=> string(39) "Bananna Kush ***NEW*** 5grm 1/8 Special" } ["locationName"]=> array(1) { [0]=> string(10) "H+H CO-OP " } ["locationAddress"]=> array(1) { [0]=> string(21) "1938 West. Adams blvd" } ["locationCity"]=> array(1) { [0]=> string(11) "Los Angeles" } ["locationState"]=> array(1) { [0]=> string(3) " CA" } ["locationZip"]=> array(1) { [0]=> string(6) " 90018" } ["locationPhone"]=> array(1) { [0]=> string(12) "323-733-0442" } ["meta_priceGram"]=> array(1) { [0]=> string(2) "14" } ["meta_priceEighth"]=> array(1) { [0]=> string(2) "55" } ["meta_priceQuarter"]=> array(1) { [0]=> string(0) "" } ["meta_priceHalfOunce"]=> array(1) { [0]=> string(0) "" } ["meta_priceOunce"]=> array(1) { [0]=> string(0) "" } } string(0) "" array(12) { ["productName"]=> array(1) { [0]=> string(37) "Master Kush 5grm 1/8 Special **NEW**" } ["locationName"]=> array(1) { [0]=> string(10) "H+H CO-OP " } ["locationAddress"]=> array(1) { [0]=> string(21) "1938 West. Adams blvd" } ["locationCity"]=> array(1) { [0]=> string(11) "Los Angeles" } ["locationState"]=> array(1) { [0]=> string(3) " CA" } ["locationZip"]=> array(1) { [0]=> string(6) " 90018" } ["locationPhone"]=> array(1) { [0]=> string(12) "323-733-0442" } ["meta_priceGram"]=> array(1) { [0]=> string(2) "10" } ["meta_priceEighth"]=> array(1) { [0]=> string(2) "50" } ["meta_priceQuarter"]=> array(1) { [0]=> string(0) "" } ["meta_priceHalfOunce"]=> array(1) { [0]=> string(0) "" } ["meta_priceOunce"]=> array(1) { [0]=> string(0) "" } } string(0) "" array(12) { ["productName"]=> array(1) { [0]=> string(7) "OG Kush" } ["locationName"]=> array(1) { [0]=> string(30) "The Dragon Collective $45 CAP " } ["locationAddress"]=> array(1) { [0]=> string(16) "3977 West 6th st" } ["locationCity"]=> array(1) { [0]=> string(11) "Los Angeles" } ["locationState"]=> array(1) { [0]=> string(3) " CA" } ["locationZip"]=> array(1) { [0]=> string(6) " 90020" } ["locationPhone"]=> array(1) { [0]=> string(12) "213-529-4016" } ["meta_priceGram"]=> array(1) { [0]=> string(2) "40" } ["meta_priceEighth"]=> array(1) { [0]=> string(0) "" } ["meta_priceQuarter"]=> array(1) { [0]=> string(0) "" } ["meta_priceHalfOunce"]=> array(1) { [0]=> string(0) "" } ["meta_priceOunce"]=> array(1) { [0]=> string(0) "" } } string(0) ""      var_dump($pName) true unset:               array(12) { ["productName"]=> array(1) { [0]=> string(10) "Lemon Kush" } ["locationName"]=> array(1) { [0]=> string(57) "La Brea Caregivers THE BEST $35 CAP in the 90019 Zip Code" } ["locationAddress"]=> array(1) { [0]=> string(18) "1188 S La Brea Ave" } ["locationCity"]=> array(1) { [0]=> string(11) "Los Angeles" } ["locationState"]=> array(1) { [0]=> string(11) " California" } ["locationZip"]=> array(1) { [0]=> string(6) " 90019" } ["locationPhone"]=> array(1) { [0]=> string(15) "1(323)-549-0400" } ["meta_priceGram"]=> array(1) { [0]=> string(0) "" } ["meta_priceEighth"]=> array(1) { [0]=> string(0) "" } ["meta_priceQuarter"]=> array(1) { [0]=> string(0) "" } ["meta_priceHalfOunce"]=> array(1) { [0]=> string(0) "" } ["meta_priceOunce"]=> array(1) { [0]=> string(0) "" } } Array    array(0) { } Array  array(12) { ["productName"]=> array(1) { [0]=> string(10) "Lemon Kush" } ["locationName"]=> array(1) { [0]=> string(57) "La Brea Caregivers THE BEST $35 CAP in the 90019 Zip Code" } ["locationAddress"]=> array(1) { [0]=> string(18) "1188 S La Brea Ave" } ["locationCity"]=> array(1) { [0]=> string(11) "Los Angeles" } ["locationState"]=> array(1) { [0]=> string(11) " California" } ["locationZip"]=> array(1) { [0]=> string(6) " 90019" } ["locationPhone"]=> array(1) { [0]=> string(15) "1(323)-549-0400" } ["meta_priceGram"]=> array(1) { [0]=> string(1) "5" } ["meta_priceEighth"]=> array(1) { [0]=> string(2) "15" } ["meta_priceQuarter"]=> array(1) { [0]=> string(0) "" } ["meta_priceHalfOunce"]=> array(1) { [0]=> string(0) "" } ["meta_priceOunce"]=> array(1) { [0]=> string(0) "" } } Array    array(0) { } Array  array(12) { ["productName"]=> array(1) { [0]=> string(39) "Bananna Kush ***NEW*** 5grm 1/8 Special" } ["locationName"]=> array(1) { [0]=> string(10) "H+H CO-OP " } ["locationAddress"]=> array(1) { [0]=> string(21) "1938 West. Adams blvd" } ["locationCity"]=> array(1) { [0]=> string(11) "Los Angeles" } ["locationState"]=> array(1) { [0]=> string(3) " CA" } ["locationZip"]=> array(1) { [0]=> string(6) " 90018" } ["locationPhone"]=> array(1) { [0]=> string(12) "323-733-0442" } ["meta_priceGram"]=> array(1) { [0]=> string(2) "14" } ["meta_priceEighth"]=> array(1) { [0]=> string(2) "55" } ["meta_priceQuarter"]=> array(1) { [0]=> string(0) "" } ["meta_priceHalfOunce"]=> array(1) { [0]=> string(0) "" } ["meta_priceOunce"]=> array(1) { [0]=> string(0) "" } } Array  array(0) { } Array  array(12) { ["productName"]=> array(1) { [0]=> string(37) "Master Kush 5grm 1/8 Special **NEW**" } ["locationName"]=> array(1) { [0]=> string(10) "H+H CO-OP " } ["locationAddress"]=> array(1) { [0]=> string(21) "1938 West. Adams blvd" } ["locationCity"]=> array(1) { [0]=> string(11) "Los Angeles" } ["locationState"]=> array(1) { [0]=> string(3) " CA" } ["locationZip"]=> array(1) { [0]=> string(6) " 90018" } ["locationPhone"]=> array(1) { [0]=> string(12) "323-733-0442" } ["meta_priceGram"]=> array(1) { [0]=> string(2) "10" } ["meta_priceEighth"]=> array(1) { [0]=> string(2) "50" } ["meta_priceQuarter"]=> array(1) { [0]=> string(0) "" } ["meta_priceHalfOunce"]=> array(1) { [0]=> string(0) "" } ["meta_priceOunce"]=> array(1) { [0]=> string(0) "" } } Array     array(0) { } Array  array(12) { ["productName"]=> array(1) { [0]=> string(7) "OG Kush" } ["locationName"]=> array(1) { [0]=> string(30) "The Dragon Collective $45 CAP " } ["locationAddress"]=> array(1) { [0]=> string(16) "3977 West 6th st" } ["locationCity"]=> array(1) { [0]=> string(11) "Los Angeles" } ["locationState"]=> array(1) { [0]=> string(3) " CA" } ["locationZip"]=> array(1) { [0]=> string(6) " 90020" } ["locationPhone"]=> array(1) { [0]=> string(12) "213-529-4016" } ["meta_priceGram"]=> array(1) { [0]=> string(2) "40" } ["meta_priceEighth"]=> array(1) { [0]=> string(0) "" } ["meta_priceQuarter"]=> array(1) { [0]=> string(0) "" } ["meta_priceHalfOunce"]=> array(1) { [0]=> string(0) "" } ["meta_priceOunce"]=> array(1) { [0]=> string(0) "" } } Array array(0) { }       --- UPDATE #2 --- If it makes any difference or not: the post im want the meta from are in a CPT (product) (but Im using the 'search everything' plugin to include CPT's in standard search results) -- FIGURED IT OUT!! -- Ok, I made a really silly error. $productName should not be a var. It should be the actual name of the field, which is: productName. So making that change fixed all the problems. haha.. good times :) Thanks for all your help everybody!


WordPress SQL query to tag all posts containing a specific word on title

Is there a way to bulk tag all posts which have for instance "bottle" in their titles? Thanks!


Using Image Links in Wordpress Navigation Menus Instead Of Text Links

Does wordpress support the capability to use images in the navigation menus instead of text links? I searched for this capability and found a site that shows how to include images in the menu through css editing: http://vanweerd.com/how-to-replace-text-links-with-icon-links-in- wp-3-navigation-menus/ If wordpress does not support the ability to easily add an image in as a linkable object in the nav menu, is there a plugin that can do this? I would like to have the ability to add and remove images to a navigation menu without having to edit css.


Add media column to edit post screen

I am trying to add a column in the edit post screen that shows any attached media. I found this code to do it with tags, but don't know how to change it to do Media attachments instead.               //add media column to edit post screen     add_action('media_buttons_context','zg_post_buttons');     function add_tag_column($posts_columns) {           // Add a new column     $posts_columns['att_tag'] = _x('Tags', 'column name');     return $posts_columns;     }          function manage_attachment_tag_column($column_name, $id) {     switch($column_name) {     case 'att_tag':     $tagparent = "upload.php?";     $tags = get_the_tags();     if ( !empty( $tags ) ) {     $out = array();     foreach ( $tags as $c )     $out[] = "slug'> " .        esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) .       "";     echo join( ', ', $out );     } else {     _e('No Tags');     }     break;     default:     break;     }


WPDeals Add custom currency

I'm using WPDeals plugin and need to add a custom currency. Here is what I have found so far:               add_filter( 'deals_currencies', 'add_my_currency' );          function add_my_currency( $currencies ) {     $currencies['ABC'] = __( 'Currency name', 'wpdeals' );     return $currencies;     }          add_filter('deals_currency_symbol', 'add_my_currency_symbol', 10, 2);          function add_my_currency_symbol( $currency_symbol, $currency ) {     switch( $currency ) {     case 'ABC': $currency_symbol = '$'; break;     }     return $currency_symbol;     }`      But I have no idea where to insert this code, or how to modify it to work. Could someone please provide an example, and which file to edit. Thanks...


Display additional user fields

A theme is in development that echo's fields from the users account on their themed account page. This is the standard format.               <?php echo  $current_user->user_lastname;?>      Thats all well and good. But there are 13 additional fields added via the plugin register plus. How do we echo them? This for example does not work.               <?php echo  $current_user->user_post_code;?>      Any help appreciated, marvellous.


Hide a div that is part of all pages on one specific page

How can I hide a div (which contains an image) for a specific WordPress page? I believe my page id is 46: ![enter image description here](http://i.stack.imgur.com/Ess6T.png) Here is the div I am trying to change:

      And the associated CSS code in my main CSS file:               #static-footer-image body.page-id-46 {           display: none;      }      It is still showing. What do I do to fix this?


Integrating the Wordpress admin panel with a frontend theme

I am building a Wordpress membership site where I need to collect user generated content in form of: -posts -events -classified ads I am using three plugins to accomplish this. However I need to integrate the style of the admin panel with the design of the site for certain user roles. Is this possible without having to build a custom plugin?


(resolved) Constructing a custom login form using ajax (without plugin)

I'm attempting to use this tutorial WordPress AJAX Login Without a Plugin – The Right Way by Natko Hasic to build a login, registration and forgot password forms that handle everything, including error messages with AJAX. The differences between the tutorial and my project are... I don't want to do it in a popup and I'm doing it in a plugin not in the root theme folder. Here's what code I do have... The code in the page template:               <form name="login_form" id="login_form" class="login_form" action="" method="post">

             <input type="text" name="username" id="username" placeholder="Username" />

             <input type="password" name="password" id="password" placeholder="Password" />
              <button name="submit" id="submit" class="btn"><?php _e("Sign in", "shorti"); ?></button>         <a class="lost" href="<?php echo wp_lostpassword_url(); ?>">Lost your password?              <?php wp_nonce_field( 'ajax-login-nonce', 'security' ); ?>          </form>      The code running in my main plugin .php file:                <?php // The php script I'm trying to run              add_action( 'init', 'ajax_login_init' );         function ajax_login_init() {                  wp_register_script( 'ajax-login-script', plugin_dir_url( __FILE__ ) . 'js/ajax-login-script.js', array('jquery') );             wp_enqueue_script( 'ajax-login-script' );                  wp_localize_script( 'ajax-login-script', 'ajax_login_object', array(                 'ajaxurl' => admin_url( 'admin-ajax.php' ),                 'redirecturl' => home_url(),                 'loadingmessage' => __( 'Sending user info, please wait...' )             ));                  // Enable the user with no privileges to run ajax_login() in AJAX             add_action( 'wp_ajax_nopriv_ajaxlogin', 'ajax_login' );         }              // Check if users input information is valid         function ajax_login() {             // First check the nonce, if it fails the function will break             check_ajax_referer( 'ajax-login-nonce', 'security' );              //Nonce is checked, get the POST data and sign user on         $info = array();             $info['user_login'] = $_POST['username'];             $info['user_password'] = $_POST['password'];             $info['remember'] = true;              $user_signon = wp_signon( $info, false );         if ( is_wp_error( $user_signon )) {             echo json_encode( array( 'loggedin'=>false, 'message'=>__( 'Wrong username or password!' )));         } else {             echo json_encode( array( 'loggedin'=>true, 'message'=>__('Login successful, redirecting...' )));         }              die();     }      My `ajax-login-script.js` file contents:               jQuery(document).ready(function($){              // Perform AJAX login on form submit         $('form#login_form').on('#submit', function(e){             $('form#login_form p.status').show().text(ajax_login_object.loadingmessage);             $.ajax({                 type: 'POST',                 dataType: 'json',                 url: ajax_login_object.ajaxurl,                 data: {                      'action': 'ajaxlogin', //calls wp_ajax_nopriv_ajaxlogin                     'username': $('form#login_form #username').val(),                      'password': $('form#login_form #password').val(),                      'security': $('form#login_form #security').val() },                 success: function(data){                     $('form#login_form p.status').text(data.message);                     if (data.loggedin == true){                         document.location.href = ajax_login_object.redirecturl;                     }                 }             });             e.preventDefault();         });     });      I'm not at all familiar with AJAX nor JS so any light you can shed on the matter is greatly appreciated!


WooCommerce change number of columns in the frontpage

I've been looking for an answer for a couple of days now. I've tried every snippet possible, changing the functions files, creating a separate template for content products but I can't change the number of products listed. Currently WooCommerce displays 4 products per row. Adding a css class of "last" to that fourth product. I want to display the products in a line of three products. Here is the url to the current store: http://teamhappiness.org/store/


Getting first Image from post

Hi I am following the instructions from this article and I cannot get it to work, it gives me a blank screen. I think there is something wrong with the opening and closing php tags between the div "view view-first" and the div "mask". When I remove these tags I get the site is displayed again but instead of images the is php code displayed. I did get the code to work briefly but now it is broken again. Thanks for your help. RT               <?php get_header(); ?>
          <?php query_posts(array('category__in' => array(5), 'posts_per_page' => 10000)); ?>                 <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                                        <?php $currentid = get_the_id(); ?>

                                           <?php                                                   if ( get_the_post_thumbnail($post_id) != '' ) {                                                echo '';                                           the_post_thumbnail(array(300,600));                                           echo '';                                              } else {                                               echo '';                                          echo '';                                          echo '';                                              }                                           wp_reset_query();                                     ?>

<a href="<?php the_permalink(); ?>"><?php echo get_the_title($currentid); ?>

<?php echo get_the_excerpt( $post->parent ); ?>
                                     <a href="<?php the_permalink(); ?>" class="info">Read More...

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

     <?php get_footer(); ?>


Redirecting From An Old Permalink Structure

We recently launched a new site that has a different permalink stucture than its prior one. Old site URL was like this:   http://centerline.net/blog/detail/?p=3989 New like this:   http://centerline.net/cxo-content-conversations-part-1-is-your-content- lacking-eminence/ Simply setting up a 301 redirect doesn't work:   Redirect 301 http://centerline.net/blog/detail/?p=3989 http://centerline.net/cxo-content-conversations-part-1-is-your-content- lacking-eminence/ I'm assuming that something in the new installs rewrite rules is fighting with it. Is there a way to systematically redirect from the old site's URLs to the new ones?


Comments deactivated

I can't write comments to new articles (no `add comment` link available). I use Wordpress 3.4. I checked the discussion properties and they are set to   * allow guests to comment articles   * none of the other (relevant) options are checked I have the feeling that comments aren't available since I installed some plugins. But I tried deactivating some with no success in activating comments again. Suggestions?


Custom post-type metabox position

I'm pretty new to Wordpress development, I'm learning about custom post types, custom taxonomies & meta boxes at the moment, following various tutorials online. So please forgive any mistakes! I've got a custom post-type set up, and a meta box with input field too, yet I can't seem to set the permanent position of the meta box. Here's the code:               function add_discography_metaboxes() {         add_meta_box('meta_album_info', 'Album Information', 'meta_album_info', 'discography', 'normal', 'high');     }      I can drag the `Album Information` meta box from the main section to the side, is this cause of a problem with code? or can you drag a meta box anywhere even if the position is set?


How to make text show up - new page template

I created a Page Template following these instructions: http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates When I create some text in a test page and apply the template I created using the instructions at that link, the text I create doesn't show up when I go 'view page'. What code do I need to add to the template so that text shows up?


Output menu navigation in php file

I have a WordPress site which generates a menu at the top of the page with this:               <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>      This line is located somewhere in a file called `header.php`. (Location in wp-admin is: `Appearance -> Editor -> Templates -> Header (header.php)` What i need to do is use the line i gave earlier:               <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>      In a separate php file. So that when i navigate to: `http://mijnwpsite.com/justthemenu.php That it only outputs the menu. No doctype or anything. What steps do i have to take for this? Thanks in advance.


How to manage multiple domain with different languages on each domain with single wordpress installation?

I need to manage multiple domain with different content on each domain. For each domain I need to manage content in different languages. I found we can use WordPress MU Domain Mapping to manage different domain with single wp installation. But my concern is can the contents be managed with multi language for each domain. Has anyone done this kind of task before. Please advice. How the plugin mentioned above can be tested in local server. Thanks in advance


Deployment strategies for  WP-Supercache

I'm looking to improve my deployment process, which currently uses Capistrano to deploy from a hosted git repository. For the most part, this is working pretty well. However, I'm running into problems with deploying WP-Supercache:   * Activating the WP-Supercache plugin creates a file `advanced-cache.php` in the `wp-content` folder that includes an absolute (and server specific path) to a file in the WP-Supercache plugin folder.    * Cache files are stored in `wp-content/cache` which I'm (correctly) excluding from git. The searching I've done has shown me a couple of possible alternatives for `advanced-cache.php`   * Have the deployment task create the advanced-cache.php file each time (through the use of a template).    * On the initial deployment, have the plugin create the correct file on the server, then move it to a shared folder and have a deployment task that symlinks to it.  For the cache files, the strategy seems to be to move the cache folder to the shared folder and add a deployment task to symlink it. So, does anyone have a good solution / process for this - doesn't necessarily need to be Capistrano related, I think this issue surfaces for any deployment that includes WP-Supercache.


Wordpress make Grandparent and great grandparent filterable in custom columns

Is there a way to make a Custom Post Type's grandparent and great grandparent filterable in the CPT's columns? For parents I use :               esc_url( add_query_arg( 'post_type' => $post->post_type, 'post_parent' => $parentID , 'edit.php' ) )enter code here      But this wont work for the Grandparent of the CPT. I tryed several relative solutions (like child_of, post_parent__in) found here but with no luck. Any suggestions on this? Thanks!


wp_list_comments adds unnecessary elements

**wp_list_comments** adds _UL_ / _OL_ or _DIV_ which do not serve for my thema. how do I prevent this?? screeshots: http://d.pr/i/1bpn my code http://pastebin.com/bQxUyZTs tnx!


How do I get a array, with the right order of the nested comments?

array (size=10)       'comment 0' =>         array (size=2)           'comment_id' => string '22' (length=2)           'parent_of' => string '0' (length=1)       'comment 1' =>         array (size=2)           'comment_id' => string '23' (length=2)           'parent_of' => string '0' (length=1)       'comment 2' =>         array (size=2)           'comment_id' => string '24' (length=2)           'parent_of' => string '0' (length=1)       'comment 3' =>         array (size=2)           'comment_id' => string '25' (length=2)           'parent_of' => string '0' (length=1)       'comment 4' =>         array (size=2)           'comment_id' => string '26' (length=2)           'parent_of' => string '24' (length=2)       'comment 5' =>         array (size=2)           'comment_id' => string '27' (length=2)           'parent_of' => string '22' (length=2)       'comment 6' =>         array (size=2)           'comment_id' => string '28' (length=2)           'parent_of' => string '0' (length=1)       'comment 7' =>         array (size=2)           'comment_id' => string '29' (length=2)           'parent_of' => string '25' (length=2)       'comment 8' =>         array (size=2)           'comment_id' => string '30' (length=2)           'parent_of' => string '29' (length=2)       'comment 9' =>         array (size=2)           'comment_id' => string '31' (length=2)           'parent_of' => string '27' (length=2)      this is a **var_dump** of **comment_ID** and **comment_parent**. main output: 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 right order: **22** -> 27 -> 31, 23, **24** -> 26, **25** -> 29 -> 30, 28


Change the default number of posts to show on mobile version

I want to change the default number of posts shown for my mobile site. Here is my theme's loop                         <?php /* Start the Loop */ ?>                <?php while ( have_posts() ) : the_post(); ?>                   <?php get_template_part( 'mobile-content' ); ?>                     <?php endwhile; ?>      I have 25 posts showing on desktop version set in wordpress settings but how can I show 15 posts per page for mobile version?


Unable to pass variable from jQuery/AJAX to PHP

I'm trying to pass the Post ID of an Option in a Select Drop Down field in Gravity Forms through jQuery/AJAX in order to be used in a different PHP function to dynamically populate a second Select Drop Down field with Options that are linked to that Post ID in Posts 2 Posts. This is all going into a single PHP file as a plugin because I couldn't manage to get a separate JavaScript file to work as well as I don't want to bother with the functions.php. Basically, choose Post A -> See Posts C and D. Choose Post B -> See Posts E and F. However, it needs to be dynamically expandable over time so a long string of conditionals obviously won't cut it. So far everything is working outside of the jQuery/AJAX. It is able to grab the value of the Option based on the CSS Class of the List Item, but on Success I cannot manage to pass it to the PHP properly. The best I've been able to do is print it to the Console. My Drop Down populations refused to work without being placed outside of the Class, so I bet I'm running into issues with that as well. Here is the jQuery/AJAX and PHP callback as well as any necessary add_actions and such:               function programs_at_campuses() {         p2p_register_connection_type( array(             'name' => 'programs_at_campuses',             'to' => 'program_of_study',             'from' => 'campuses'         ) );     }     add_action( 'p2p_init', 'programs_at_campuses' );          $programFilter = new programFilter();          class programFilter{              function __construct() {             add_action('wp_ajax_programFilter', array( &$this, 'programFilter_callback') );             add_action('wp_ajax_nopriv_programFilter', array( &$this, 'programFilter_callback') );                  add_action('wp_enqueue_scripts', array( &$this, 'load_jquery') );             add_action('admin_enqueue_scripts', array( &$this, 'load_jquery') );                  add_action('wp_footer', array( &$this, 'footer_script'), 99 );             add_action('admin_footer', array( &$this, 'footer_script'), 99 );                  add_action('wp_ajax_gd_programFilter', 'programFilter_callback');             }                  function programFilter_callback() {                 print_r($campusprogram = $_POST['campusprogram']);                 exit();             }                  function load_jquery() {                 wp_enqueue_script( 'jquery' );             }             function footer_script() {             ?>             <script type = "text/javascript">                 var test = 'hello';                 var programClass = '.programs select',                     campusClass  = '.campuses select';                 jQuery(programClass).change(function($){                     var programSelect = this.value;                     (jQuery).ajax({                         type: 'POST',                         data: {                             action: 'programFilter',                             campusprogram: programSelect                         },                         url: '<?php echo admin_url('admin-ajax.php') ?>',                         success: function(data){                             console.log(data);                         }                     });                 });             </script><?php             }     }      And here's the code that populates the Select Drop Downs:               //This populates the dropdown for Undergraduate Programs to use this, add programs to the css class of the dropdown to be populated.     add_filter('gform_pre_render', '<CAMPUSNAME>_populate_ugradprograms');     function <CAMPUSNAME>_populate_ugradprograms($form){              foreach($form['fields'] as &$field){                  if($field['type'] != 'select' || strpos($field['cssClass'], 'programs') === false)                 continue;                  // you can add additional parameters here to alter the posts that are retreieved             // more info: http://codex.wordpress.org/Template_Tags/get_posts             $posts = get_posts('post_type=program_of_study&post_parent=0&orderby=title&order=asc&numberposts=-1&post_status=publish');                  // update 'Select a Post' to whatever you'd like the instructive option to be             $choices = array(array('text' => 'Select a Program', 'value' => ' '));                  foreach($posts as $post){                 $choices[] = array('text' => $post->post_title, 'value' => $post->ID);             }                  $field['cssClass'] = 'programs';             $field['choices'] = $choices;              }              return $form;     }          add_filter('gform_pre_render', '<CAMPUSNAME>_populate_campuses');     function <CAMPUSNAME>_populate_campuses($form){              $firstChoice = 57; // This was a Post ID I was testing the population with. It works if I substitute $campusprogram with this.              $posts = get_posts(array(                 'numberposts'=>-1,                 'connected_type'=>'programs_at_campuses',                 'connected_to'=>$campusprogram,                 'orderby'=>'title',                 'order'=>'ASC',                 'suppress_filters'=>false             ));              foreach($form['fields'] as &$field){                  if($field['type'] != 'select' || strpos($field['cssClass'], 'campuses') === false)                 continue;                  // you can add additional parameters here to alter the posts that are retrieved             // more info: http://codex.wordpress.org/Template_Tags/get_posts                            // update 'Select a Post' to whatever you'd like the instructive option to be             $choices = array(array('text' => 'Select a Campus', 'value' => ' '));                  foreach($posts as $post){                     $choices[] = array('text' => $post->post_title, 'value' => $post->post_title);             }                 $field['cssClass'] = 'campuses';             $field['choices'] = $choices;                       }              return $form;              }               ?>      I'm beginning to realize that the second Drop Down's population code will likely need to go into the Callback function, but right now I'm focused on being able to access that variable, even if it is through a simple Echo. I understand this is a long post, but any help would be greatly appreciated!


Get Parent List Class for Child Pages Using Walker

I'm having trouble getting child pages to use the parent `li` class whilst using `wp_list_pages()`. I'm using a walker to get the list classes to use page title, but no matter which way I try, I can't transfer the parent li class to its child. Here's what I'm trying to achieve:
The First Ebook
 /* Child of 'Ebooks' */
Webinars

Modules

Ebooks
   /* Parent of 'The First Ebook' */      The child `li` class on every method I've tried outputs `'The First Ebook'` instead of its parent class `'Ebook'`. Here's my Walker:               class Walker_Child_Classes extends Walker_page     {          function start_el( &$output, $page, $depth, $args, $current_page )     {         if ( $post->post_parent )         {             $css_class = apply_filters(                 'the_title',                 $parent_title = get_the_title( $page->post_parent ),                 $page->name             );         }         else         {             $css_class = apply_filters(                 'the_title',                 $page->post_name,                 $page->ID             );         }              $output .= $indent             . '
'             . 'ID )                 . '" title="'                  . esc_attr(                      wp_strip_all_tags(                          apply_filters(                              'the_title',                              $page->post_title, $page->ID                          )                     )                 )              . '">'                  . $link_before                  . apply_filters(                     'the_title',                     $page->post_title,                     $page->ID                 )                  . $link_after              . '';     } // end function/method          } // end Walker class      And I'm calling it using this:               $sWalker = new Walker_Child_Classes();     wp_list_pages( array(          'title_li'    => null,          'walker'      => $sWalker,          'depth'       => -1,          'sort_column' => 'post_date',          'sort_order'  => 'DESC',          'child_of'    => $post->ID     ) );


WordPress on Nginx - Missing admin/toolbar

Hi I've been trying to figure this out for quite some time now, but whatever I do nothing seem to work. I have a VPS setup running Nginx + Varnish with WordPress multisite. Everything works fine except the admin/toolbar when browsing the sites. It simply wont load. It loads in the admin area, but when viewing site it doesn't load. I have checked the "Show Toolbar when viewing site", and I have deactivated all plugins. Now I have even gone so far as of creating a brand new WP install running only the default stuff, just to see if that works, but still the bar wont show. I have checked the source code and the strange thing is that the "#wpadminbar" isn't there! But since this is the default theme every code looks fine - `wp_head` & `wp_footer` is correctly placed. My guess now is that this is more a server problem, and maybe a Nginx or Varnish issue? I hope someone can help me figure this out... -Howie


Using ajax on editing a category edit page?

add_action ( 'edit_category_form_fields', 'tag_category_fields');     add_action ( 'edited_category', 'save_tag_category_fields');     add_action('wp_ajax_my_action', 'tag_category_fields');     function tag_category_fields($tag){         $t_id = $tag->term_id;         $tag_items_list = individual_tag();         $mytags = $_POST['whatever'];         ?>
         <?php _e('Available Categary Tags'); ?>	                  <form class="category_tag_list_values">         <select id="list_category_tags" name="list_category_tags" style="width: 300px; padding: 5px; overflow-y: auto;" multiple="multiple">         <?php foreach($tag_items_list as $tags){ ?>             <option value="<?php echo $tags->name ?>"><?php echo $tags->name ?></option>         <?php } ?>             </select>
         <input class="uibutton" style="width: 75px" type="button" value="add">         </form>

         <?php _e('Current Category Tags'); ?>	                      <input id="mytags" name="mytags" />
         	         <input type="hidden" name="listtag1" value="hi" />         <?php foreach($mytags as $tags){                 echo '<input type="hidden" name="listtag" value="'.$tags.'" />';                 }             ?>
         <?php     }//add extra fields to category edit form hook               function save_tag_category_fields( $term_id ) {         if(isset($_POST['listtag'])){            $value = $_POST['listtag'];         }     }      So What I'm trying to do is set values with jquery and ajax to set values and then perform actions with them when I save the category edit page but I can't seem to get the value into function save_tag_category_fields( $term_id ) function, help?


How to execute function/method when specific URL is called?

I have url "www.something.com/wp- content/plugins/tool_new/admin/new_tool_email.php?method=new_tool_send" I want to sent up real cron job, and when this url is called to execute method 'new_tool_send'. How can I do this?


add image caption

I would like to add caption to a image I just uploaded through a from. So I have the attachment id and the caption text in a variable. I found wp_update_attachment_metadata in wordpress codex .. but how do I add caption through it?


Two WooCommerce installations on the same server, one sends customer emails but the other does not

Currently I have two WooCommerce setups both running on the same server for demonstration and testing purposes. Each is installed on a different subdomain. One sends out registration and forgot password emails ("working" version) but the other does not ("fail" version). Both use WP latest (3.8). The "working" version is running 100% default everything and the Twenty Twelve theme with WooCommerce dummy data imported. The "fail" version is running a custom theme and several plugins (various WooCommerce payment gateways, Advanced Custom Fields, and a Mailchimp plugin). When I change the theme to Twenty Twelve and delete ALL plugins except those running on the "working" version I still cannot get any registration or lost password emails to send. Tested with multiple email addresses. Any help troubleshooting would be greatly appreciated! * * * **Update** After following @Subharanjan's advice here are the relevant entries in my `mail.txt` log:               array (          'error_count' => 1,          'sign_cert_file' => '',          'sign_key_file' => '',          'sign_key_pass' => '',          'exceptions' => true,     )


Securing Contact Form 7

I have a client who's website I created with Wordpress. It has a contact form created with contact form 7. This client is a subsidiary of a larger organization who's IT department runs scans on their subdomains. The asked my client to protect Contact Form 7 from malicious scripts or take it down. When I asked for an example of what they tested, my client informed me that they run tests to see if a script could be inserted into a input (ie: `<script>alert('hello');</script>`) field or as a url string (ie: `www.mydomain.com/contact?<script>alert('hello');</script>`). With the query string, the contact form sets the action to: `action="/?scriptalert('hello');/script#wpcf7-f1-p6-o1"` Is there anything I can add to remove the possibility of running scripts in Contact Form 7?


A better code for no post format?

As suggested on this site, I am using this code to style an excerpt if no post format is selected/if it is a standard post.               <?php     $format = get_post_format();     if ( false === $format )     {     echo 'This is a default post';     the_excerpt();     }     ?>      However, it seems there must be a better way to include it with one PHP statement... the rest of which follows this pattern:               if ( has_post_format( 'video' )) {         ?>         A VIDEO POST         <?php the_content();     }     if ( has_post_format( 'audio' )) {         ?>         AN AUDIO POST         <?php the_content();     }      Anybody know how to include the original code in this same if statement? If, then...


WordPress as a backend only. How to output database content on public side without WordPress?

I'm a bit of a PHP MySQL newb but i feel i need to bypass WordPress for the frontend of a site i'm building (it is mainly just RSS and JSON feeds). I was wondering if there are any tutorials or advice I should follow on this or just cut straight to it?


Need to give custom page template for each language in WPML

I need to give each page a custom/different page template for every language page in WPML. eg: Let i have a test page in English and french. Is there any way out so that in English i give sidebar template while same page in french don't have sidebar template. Note: Solution should not be any core condition to be put in code. Thanks in advance.


How to put posts in pages using query posts

What is the code in order to put some posts in different pages? I already have one but the tittle of post is missing. And i don't know how to. This is the code that i have now:               <?php get_header(); ?>

<?php the_title(); ?>

             <?php $pagedesc = get_post_meta($post->ID, 'page_description', $single = true);?>             <?php if($pagedesc !=''){?>
<?php echo $pagedesc ?>
             <?php }?>

     <?php     $catID = 0;     if (is_page('apple')) {       $catID=12;     } elseif (is_page('htc')) {       $catID=13;     } elseif (is_page('nokia')) {       $catID=14;     }          if ($catID) {        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;        query_posts("cat=$catID&paged=$paged");     } ?>     <?php     $title = $queried_post->post_title;     echo $title;     ?>                            <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                  <?php the_content(__('(more...)')); ?>                  <?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
             <?php endif; ?>
                       <?php get_sidebar(); ?>            <?php get_footer(); ?>      I would love for an answer please.


What is wp-admin/meta for?

I noticed that I have a directory `meta/` as a sub-directory of the wp-admin folder, but there is nothing in it. What goes in here? Should I keep it?


meta_query for keys that aren't yet set

I'm trying to query for a custom post type for a gallery system. I have a checkbox to set a gallery as a "featured" gallery (set up through More Fields plugin) - if this is checked then the meta value becomes 1 and then if unchecked it becomes 0. All good. However if the box has never been checked then the meta key is never created, meaning I can't query for NOT LIKE 1 because it doesn't exist. The query I want is to pull out 4 galleries that aren't marked as '1' in this meta value, but also those that don't have this value at all. Is there a way to always give newly added posts a default value for this meta key (ie always make them 0 by default if the box is left unchecked) or is there a way to query for the key not yet being set? My current query is:               $args = array(                             'post_type' => 'gallery',                             'showposts' => 4,                             'meta_key' => 'gal-ID',                             'order_by' => 'meta_value',                             'order' => 'ASC',                             'meta_query' => array( array(                                                 'key' => 'main-gal',                                                 'value' => false,                                             ) ),                             ) );      And I've tried various attempts with 'compare' => 'NOT LIKE', '!=' etc etc. Any ideas? This ticket seems to imply it's something that ought to be sorted out: http://core.trac.wordpress.org/ticket/18158 Thanks!


Custom query does not find pages

I don't consider myself to be a newb, I've had a loop of all the pages work before, but right now one of my custom loops on my page template (which is used as the index page of the site), will not show a list of 'pages'.               <?php get_header(); ?>          <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> // first I want to call the information for the page itself -- i've tried removing this and it has no effect.
<?php the_content(); ?>
               <?php endwhile;      wp_reset_query();           // end frontpage while ?>

About the film festival
                         <?php                 $get_pages =    ( //the loop to get all the pages on the site                     array(                              'post_type' => 'page',                         'posts_per_page' => -1,                          ));                     query_posts( $get_pages );                  if ( have_posts() ) while ( have_posts() ) : the_post();      ?>       // this here is what I want to happen for each page, but it shows up for anything aside from page
<?php the_title() ?>
                <?php endwhile; //end pages while                     wp_reset_query();                      wp_reset_postdata();     ?>      Am I missing something crucial? Is there a stupid mistake? I am clueless at the moment. Tanks for anything that might help here.


Globally register styles but enqueue them selectively

I am trying to get my theme registered stylesheets in plugin, the purpose is I want to get all stylesheets in my plugin and then manipulate those registered styles. stylesheets registered via               add_action('wp_enqueue_scripts', 'mytheme_register_styles', 1);          add_action('wp_enqueue_scripts', 'mytheme_enqueue_styles', 5);      and as you already know this action doesn't get fired in backend, so I want a hookable / callable way so it gets enqueued and I can modify / manipulate for my needs and resave them.


get_permalink wrongfully returns only year and month and not all the link

This is very strange and I don't know why. I am developing a theme, and in some areas I am manually creating different related news. They work perfectly, because I can start a WP_query almost everytime I need it. In one case I can't, so I'm using functions to get posts data, starting from their ID. As soon as I set the permelinks to "pretty" (in my case year/month/name) in the admin panel, the get_permalink() function stopped working. Instead of returning the whole post url, it stops after the month. Any ideas on what could be causing this?


Show pages and articles in category search result

I'm using "Map Categories to Pages" to add categories to pages. When I call the link http://mypage.com/category/catA+catB I get all my articles, that are associated to the categories catA and catB. What I'm looking for is: A) a way to do something similar with pages: call http://mypage.com/pages/catA+catB and get all pages that are associates to the categories catA and catB -or- B) a way to get first pages and then articles, on the category search result page, like:   * Some Page    * Another Page   * Some Article   * Another Article   * One more Article


How to use manage_$post_type_posts_columns with underscore in post type?

I have a post type `'job_listing'` and I want to use `manage_{$post_type}_posts_columns` filter in it. I tried `manage_job_listing_posts_columns` but it's not working because of the underscore in the post type. The code I tried is:                 add_filter('manage_job_listing_posts_columns', 'add_more_column_to_post', 10, 1);            function add_more_column_to_post ($posts_columns) {         $posts_columns[ 'featured' ] = __( 'Select Featured Post' );         return $posts_columns;       }


Breadcrum not displaying the parent page

I have few pages                - HOME      - SERVICES      ---- MY SERVICE      My problem is that when I open My service page the breadcrumb looks like this: > home > My service And I would need the parent to be there: > home > services > my service How can I do so? -EDIT- This is the content of my `includes/breadcrumbs.php`               <?php if ( class_exists( 'woocommerce' ) && is_woocommerce() ) return; ?>

             <?php if(function_exists('bcn_display')) { bcn_display(); }                   else { ?>                         <a href="<?php echo esc_url( home_url() ); ?>" class="breadcrumbs_home"><?php esc_html_e('Home','Harmony') ?> >                              <?php if( is_tag() ) { ?>                             <?php esc_html_e('Posts Tagged ','Harmony') ?>"<?php single_tag_title(); echo('"'); ?>                         <?php } elseif (is_day()) { ?>                             <?php esc_html_e('Posts made in','Harmony') ?> <?php the_time('F jS, Y'); ?>                         <?php } elseif (is_month()) { ?>                             <?php esc_html_e('Posts made in','Harmony') ?> <?php the_time('F, Y'); ?>                         <?php } elseif (is_year()) { ?>                             <?php esc_html_e('Posts made in','Harmony') ?> <?php the_time('Y'); ?>                         <?php } elseif (is_search()) { ?>                             <?php esc_html_e('Search results for','Harmony') ?> <?php the_search_query() ?>                         <?php } elseif (is_single()) { ?>                             <?php $category = get_the_category();                                   if ( $category ) {                                     $catlink = get_category_link( $category[0]->cat_ID );                                     echo (''.esc_html($category[0]->cat_name).' '.'> ');                                   }                                 echo get_the_title(); ?>                         <?php } elseif (is_category()) { ?>                             <?php single_cat_title(); ?>                         <?php } elseif ( is_tax() ) { ?>                             <?php                                 $et_taxonomy_links = array();                                 $et_term = get_queried_object();                                 $et_term_parent_id = $et_term->parent;                                 $et_term_taxonomy = $et_term->taxonomy;                                      while ( $et_term_parent_id ) {                                     $et_current_term = get_term( $et_term_parent_id, $et_term_taxonomy );                                     $et_taxonomy_links[] = 'name ) . '">' . esc_html( $et_current_term->name ) . '';                                     $et_term_parent_id = $et_current_term->parent;                                 }                                      if ( !empty( $et_taxonomy_links ) ) echo implode( ' > ', array_reverse( $et_taxonomy_links ) ) . ' > ';                                      echo esc_html( $et_term->name );                             ?>                         <?php } elseif (is_author()) { ?>                             <?php                                 global $wp_query;                                 $curauth = $wp_query->get_queried_object();                             ?>                             <?php esc_html_e('Posts by ','Harmony'); echo ' ',$curauth->nickname; ?>                         <?php } elseif (is_page()) { ?>                             <?php the_title(); ?>                         <?php } elseif ( is_post_type_archive() ) { ?>                             <?php post_type_archive_title(); ?>                         <?php } ?>             <?php } ?>

       Well, I solved by inserting this in my code (checking first if `$post->post_parent > 0`):               <?php $permalink = get_permalink($post->post_parent); ?>     <a href="<?php echo $permalink; ?>"Parent


Start post pagination at 0 instead of 1

Is it possible to start post pagination count at zero instead of 1? I want the URLs to be like this: > ../page (Foreword) > > ../page/ **1** (Chapter 1) > > ../page/2 (Chapter 2) But by default the URL is not corresponding to my chapter numbers: > ../page (Foreword) > > ../page/ **2** (Chapter 1) > > ../page/3 (Chapter 2)


How to make a text string into a bullet list

I have a multi-select box (with a list of countries) on my BuddyPress registration page and would like to display the results on a member's page in a bullet list. The code below shows a bullet but then still displays the text as a string. Please help.               <?php $countries = bp_member_profile_data( 'field=Countries' );     if ( ! empty( $countries ) ) {         echo '
';         foreach ( $countries as $country ) {             printf( '
%s
', $country );         }         echo '
';     }     ?>      Thank you, John


For Each +1 Wordpress Loop

Im using a loop to make a slider. My code is               <?php      query_posts( array( 'post_type' => 'my_gallery', 'author'=>$author->ID ) );          while( have_posts() ) :          the_post();          $imagethum = eh_postImage(115, 70);      ?>     <?php echo $imagethum; ?>     <?php endwhile; ?>      I need the `data-slide-index="0"` attribute to increase by 1 for every post in the loop so the output appears as...                                              after printed Some kind of `for each` statement here?


Changing $before_widget for certain widgets

So I'm working on designing a Wordpress theme with lots of extra widgets. The ones I have added are in separate files, and called in the functions.php I have lots of css on the widgets themselves and the div classes are in the $before_widget and $after_widget etc in functions.php. My problem is that for certain widgets I don't want the same CSS, for example no background or border. I can't seem to work out how to go about this. If that makes sense. Thanks in advance!


Enabling users to control custom loop's query

Let's say we started a custom loop:               <?php $custom_posts = new WP_Query(); ?>     <?php $custom_posts->query('post_type=post&category=Uncategorized&orderby=epo_custom'); ?>     <?php while ($custom_posts->have_posts()) : $custom_posts->the_post(); ?>     (...)      I want to enable users to change for instance, the category part. In other words, something like this:               <?php $custom_posts->query('post_type=post&category=$user_selected_category&orderby=epo_custom'); ?>      So that value will be saved and the user will see only posts of that category each time he/she logs in. Any suggestions to accomplish that? EDIT: I'll be getting the user preference at the time of his registration? Example: Lets say the user registers, and select his/her preferred category as 'business'.


How to configure self hosted wordpress so that everything can be upgraded/installed from dashboard

I have a blog on shiplu.mokadd.im. After installing wordpress I see upgrade notice time to time. Sometimes its core upgrade and sometimes its plugin or theme upgrade. Each time I try to upgade any of them I see wordpress asks for ftp credential. To resolve this I have created ftp account. But somehow wordpress fails to log in. My question is how can I make this upgrade working directly from dashboard? If its an ftp account what type of privileges would it require? If its ch{mod,own}, what is the secure way? I am using **version 3.2.1**


register sidebars

i registered my sidebars as follows:               $sidebars = array (                 'sidebar-10'       => 'Hoof Sidebar',                 'sidebar-11'       => 'Tuisbladsy area een',                 'sidebar-12'       => 'Tuisbladsy area twee',                 'sidebar-13'       => 'Tuisbladsy area drie',                 'sidebar-14'       => 'Tuisbladsy area vier',                 'sidebar-15'       => 'Voet area een',                 'sidebar-16'       => 'Voet area twee',                 'sidebar-17'       => 'Voet area drie',                 'sidebar-18'       => 'Voet area vier',                 'sidebar-19'       => 'Onder artikel 1 area',                 'sidebar-20'       => 'Advertensie area onder die hoof area',                 );     foreach ( $sidebars as $sidebar ) {     register_sidebar(         array (                 'name'          => __( $sidebar, 'pietergoosen' ),                 'id'            => $sidebar,                 'before_widget' => '',                 'after_widget'  => '',                 'before_title'  => '
',                 'after_title'   => '
',         ));     }      The thing is, "Hoof Sidebar" is the name of my widget. I need to set sidebar-10 as the widget id. the same with the rest as in my array. any suggestions


Twitter feed is showing blank in WP site

I am using themefuse WP theme and facing this problem. http://themefuse.com/forum/thepractice-wp/twiiter-newsline-is-blank Can someone please suggest if I need to use some other attribute. I am not finding any help on ThemeFuse site. Thanks


Difference between do_action_ref_array() and do_action()

I am having trouble wrapping my head around these two functions. I understand `do_action()` but I don't see clearly when `do_action_ref_array()` would be useful. Couldn't we pass an array to `do_action()` as well?


Why are you using add_action for shortcode?

I would like to create shortcodes, some tutorials write about to use `add_action` > add_action( 'init', 'register_shortcodes'); but I read tutorials where the author didn't use it, only put > add_shortcode('recent-posts', 'recent_posts_function'); to `functions.php`. Which is the best method, and why to use `add_action`?