title: Page display certain Category Posts

text: I want to do almost exactly this: http://codex.wordpress.org/Pages#A_Page_of_Posts But Im confused by the last line: > Save this to pageofposts.php and then assign PageofPosts as the Template > when creating the action Page: How do I tell Wordpress to go to index.php, (or anything else) when, for example, it receives an 'events' slug?


title: I want to create a filter for the query string is this possible?

text: I have spent the last few days working on and researching this question and have found no solution. Basically I want to replace the query string which wordpress parses in order to query the database. So for example, I want to say if the url is:               www.mysite.com/support/question      go to               www.mysite.com/another/page       I know I can setup fancy rewrite rules using the `add_rewrite_rules` filter, but this is over complicating the situation. I don't want to go down this route, all I want to do replace the exact request i.e. `support/question` with `another/page` Is there a simple way to pass a different query string to wordpress?


title: add_action for admin_init hook with a parameter

text: In my theme, i want to create a generic way of inserting a meta box to a post, page, portfolio or other custom item. For now, this action is like :               add_action('admin_init', 'add_portfolio_settings');      Which works fine, but has a problem. It currently works only for creating an add_meta_box for a portfolio item. However, what if i wanted to add the same to a post or page ? So, i would like to have add_action passing an argument to my add_portfolio_settings function, ideally an array, that specifies what the types that a new meta box should register under. I've read stuff and tried different things about do_action, but i cannot get it to work. Any ideas ?


title: Problem with writting correctly a query posts args in Wordpress

text: In my posts custom fields, I have a meta_key named ending. The value of it is a date in the form of 30-11-2011 (dd-mm-yyyy). I tried this below but with no luck. `query_posts("paged=$paged&meta_key=ending&order_by=meta_value&order=DESC")` I also tried to do it like below, again with no correct output using my date format               $querystr = "         SELECT wposts.*          FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta         WHERE wposts.ID = wpostmeta.post_id          AND wpostmeta.meta_key = 'ending'          ORDER BY wpostmeta.meta_value ASC         ";                $pageposts = $wpdb->get_results($querystr, OBJECT);          ?>      <?php if ($pageposts): ?>       <?php global $post; ?>       <?php foreach ($pageposts as $post): ?>         <?php setup_postdata($post); ?>                     <?php the_title(); ?>     <br>       <?php endforeach; ?>            <?php else : ?>           <?php endif; ?>      There are two points I concern.   1. Is my query_posts correct?   2. Is the format of the date I type into the custom field, ideal for this? Thank you for this


title: using jquery autocomplete in wordpress plugin

text: I am currently developing a plugin for wordpress, and using jquery autocomplete. In my plugin file i enque autocomplete like this:               wp_enqueue_script('jquery-ui-autocomplete');      Then i assign the script to an input id like this:               jQuery("#post_email_repeatable").autocomplete({           source:"get_posts.php",           minLength:1     })      This works fine for one input. However i am using repeatable / reuasble input fields (they can be created on the fly). They all have the same id of `#post_email_repeatable`. Auto-complete will only work on the first input with the id of `#post_email_repeatable`. My question is, is it possible to get auto-complete to work on work than one input with the same id?


title: How to Customize "WordPress > Error" Text in Titlebar?

text: When a user doesn't enter all required things in comment box area and click on submit comment button, a new page is shown telling user that some required fields are missing such as name, email, etc. The page contains `"WordPress > Error"` text in titlebar. I want to replace this text with my custom text. I have been doing this by manually replacing following line in `wp- includes\functions.php` file:               $title = $have_gettext ? __('WordPress › Error') : 'WordPress › Error';      Now I don’t want to edit core file. I want to know if it is possible to do the same thing by using my blog theme's `functions.php` file?


title: wp_parse_args not insert it to options

text: wp_parse_args not inserting default value to options. But its printing results.               $options = get_option('my_options');     $defaults = array (         'logo' => 'http://domain.com/logo.png',         'do_extra_thing' => false     );          // Parse incomming $args into an array and merge it with $defaults     $new_options = wp_parse_args( $options, $defaults );      But when i run `print_r($new_options);` Its give me results. Please guide me where i'm missing and wrong.


title: "pagination" (but not really) and queries using custom posts types

text: More of a conceptual question here, than a strict code question: Working on a site for a musician who wants to list concerts, both upcoming and past. These are custom post types that use a custom field for the date of the show (formatted as yyyymmdd). For queries and sorting, the date of the show is the critical bit of data, as opposed to the publish date of the post, which is kind of irrelevant. Here's the page, which gives future and past shows for the current year: http://dev.bobpassaro.com/david/concerts/ The query to generate this (two queries and loops, actually):               <?php          //Query $args for upcoming concerts, ordered soonest to furthest in future         $upcoming_args = array(             'post_type' => 'concert',             'meta_key' => 'date',             'orderby' => 'meta_value_num',             'order' => 'ASC',             'posts_per_page' => -1,             'meta_query' => array(                 array(                     'key' => 'date',                     'value' => date('Ymd'),                     'compare' => '>=',                 ),             )         );              //Query $args for past concerts, ordered most recent to oldest         $past_args = array(             'post_type' => 'concert',             'meta_key' => 'date',             'orderby' => 'meta_value_num',             'order' => 'DESC',             'posts_per_page' => -1,             'meta_query' => array(                 array(                     'key' => 'date',                     'value' => array(date('Y') . '0101',date('Ymd')),                     'compare' => 'BETWEEN',                 ),             )         );     ?>      You'll see also (at the bottom of that page) that I sort of "paginated" the older concerts, grouping them by year. (Regular WP pagination with custom post types is a pain, but it's not what I want, anyway. I don't want pages with equal numbers of concerts, I want pages with concerts grouped by year.) So what I've done is create another template with a similar query:               <?php          //Query $args for past concerts, grouped by year         $concert_year = substr($post->post_name,0,4);         $year_args = array(             'post_type' => 'concert',             'meta_key' => 'date',             'orderby' => 'meta_value_num',             'order' => 'DESC',             'posts_per_page' => -1,             'meta_query' => array(                 array(                     'key' => 'date',                     'value' => array($concert_year . '0101', $concert_year . '1231'),                     'compare' => 'BETWEEN',                 ),             )         );     ?>      This is used in a custom template that I assign to pages that I set up for each year. (The content of these pages is actually empty, but the page slug gets used to set the $concert_year variable above, which then allows the query to pull the proper set of concerts.) I then use a regular WP menu at the bottom of these pages that includes all these pages and allows people to look back at shows performed in previous years. This all functions as I want, but it's a pretty kludgy solution. I mean, when we get to 2015, I'll have to create a new page for 2014, otherwise 2014 concerts won't be showing up anywhere. I'd like that to just happen dynamically. I also have all these essentially blank/empty pages (one for each past year), whose only function is to call the template and be used in the WP menu (that is, their only function is to allow users to select the url associated with each year and set $concert_year for use in the query.) Thoughts on a better approach this problem?


title: Archive - same title for the first two posts

text:
I created an archive page called archive.php Here I include header / footer and this code:               <?php if (have_posts()) : while (have_posts()) : ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                   <?php the_post(); the_content();  ?>
     <?php endwhile; endif; ?>      The problem is that when there are more posts for a month, the first two posts have the title and permalink of the first post. How can I fix this? Anticipated thanks! **EDIT** Good advice toscho. I fixed it, here's the solution:               <?php while(have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
     <?php the_content(); ?>
          <?php endwhile; ?>


title: Can we able to post blog on another Wordpress blogsite?

text: I am relatively new to Wordpress. When we check techcrunch.com which is built on Wordpress platform, they have few official bloggers and tons of comment posters which is usually authenticated through facebook. How do a Wordpress Blogging site manage other Bloggers to Blog / Post blog on their Blogging site ? Whether Wordpress allows an Admin User and non-admin users to blog on a Website ?


title: get_categories only getting categories in the main language

text: I am trying to retrieve in the "content composer" the categories of projects based on the active language. But i only get the categories off the main language, never on the other. My code is: Category All                   $categories = get_categories('taxonomy=jw_portfolio_categories');                                     if(!empty($categories)){                             foreach($categories as $cat){                                 ?><option value="<?php echo $cat->term_id; ?>"><?php echo $cat->name; ?></option><?php                             }                         }            ?>                     </select>      Any idea on how to get all the categories or the ones of the active language in the WP backoffice?


title: Posts mysteriously disappearing/deleted

text: I'm looking for help about this issue I've been having on one of my client's sites (http://revistero.mx it's in spanish) The problem is that somehow, every once in a while the last published posts (let's say, from 2 days ago til now) get deleted from the site. First I believed that it was someone from my client's office who was deleting the posts, so i created two functions in functions.php to create a mini-log of actions:               function wp_log_publish($post_ID){         global $wpdb;         $post = get_post($post_ID);         if ($post->post_date != $post->post_modified) return;         if(!wp_is_post_revision($post_ID)) {                 $actionP = "New ";               $user = get_userdata($post->post_author);             $date = new DateTime();             $wpdb->insert('wplog', array('author'=>$user->user_login, 'description'=>$actionP.$post->post_title .' ID = '.$post->ID, 'date'=>$date->format("Y-m-d H:i:s")));         }     }     add_action('publish_rvs_revista', 'wp_log_publish');          function wp_log_delete($post_ID){         global $wpdb;         $post = get_post($post_ID);         $user = get_userdata($post->post_author);         $date = new DateTime();         $wpdb->insert('wplog', array('author'=>$user->user_login, 'description'=>'Delete '.$post->post_title .' ID = '.$post->ID, 'date'=>$date->format("Y-m-d H:i:s")));     }          add_action('delete_post', 'wp_log_delete');      What the log stated is that it was the "webmaster" (a.k.a. the user of my client) who was deleting the posts. Strangely all posts stated that they were deleted exactly at the same time. After a meeting with my client we decided I was going to manage the site for 15 days to check everything. Everything went just OK in those 15 days. Not a single post went missing. But today, after our last meeting after the 15 days a bunch of posts got deleted. What's more strange is that this time not only they appeared to be deleted at the same time, also it stated that my user, another user from my office and even the user from my client (whom, by the way, I revoked all privileges to) were the ones who deleted them! I don't know what could be happening, I'm thinking about a security issue but I don't even know where to start so I come here for ideas. **More Specs about the site:** **Plug Ins Installed:**   * AdRotate   * Contact Form 7   * Register Plus Redux (I'm aware this plugin has had some security issues so I'm deactivating it immediately)   * WP-PostRatings   * WP-PostViews **Custom Post Types:**   * Magazines (they are the ones that are disappearing, no other posts disappear) I forgot to mention before, it has only happened three times, and dates are not periodical.


title: clients list using wordpress

text:
I am using wordpress for my new website and i have list of clients(name and their logos). I am confused how to make those editable using wordpress? Html as follows...

Client1

Client2

      Should i use custom post type or something? Please suggest some similar examples or better approach to achieve this using wordpress, so clients can be added/edited/delted easily. thanks.


title: Storing password (functions.php)

text: I have created password form where visitors can access any password protected post with belonging password. Basically you enter unique password and you are redirected to a post which is protected with given password. Everything works fine (with help from s_ha_dum), except one thing - you have to enter password twice. functions.php :               function doPasswordStuff(){         if(isset($_POST['homepagepassword'])){             global $wpdb;             $post_password = trim($_POST['passwordfield']);             $post_id = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_password = %s", $post_password) );             if (!empty($post_id)) {                     wp_redirect(get_permalink($post_id));                     exit();             } else {                 // oh dear, there isnt a post with this 'password', put a redirect to a fallback here                 wp_redirect(xxx');                 exit();             }             wp_reset_query();         }     }     add_action('template_redirect','doPasswordStuff');      Do you have any idea how to do this without entering password twice?


title: Query all posts in a given taxonomy

text: For sure it's very simple, but I can not figure out how to do this. I need to query all posts that has a specific taxonomy set. Like this:               $query03 = array(      'numberposts' => 5,      'post_type' => array(         'video'         ),      'tax_query' => array(             array(                 'taxonomy' => 'product',                 'field' => 'slug',                 'terms' => **all_the_terms_in_taxonomy**             )         )      );      I want set the `terms` field a wildcard. I know I could populate `terms` fild with an array, but the list is very very long and I'm worried about weight of the query.


title: List of taxonomy archive index page links

text: I want to show all my post taxonomies on the left side of the web page in such a way that when a person click on it the post can be displayed according to the taxonomies.is there anyway to display them and i also want to add some style in it.


title: Retrieve comments from current post using SQL

text:
I am trying to use this code below to auto-refresh comments but at the moment it is displaying all comments. I would like to only show comments for the current post. I am not very experienced with SQL and don't know how to go about doing this:               <?php     function dp_recent_comments_ajax() {             $no_comments = 5;         $comment_len = 300;             global $wpdb;              $request = "SELECT * FROM $wpdb->comments";         $request .= " JOIN $wpdb->posts ON ID = comment_post_ID";         $request .= " WHERE comment_approved = '1' AND post_status = 'publish' AND post_password =''";         $request .= " ORDER BY comment_date DESC LIMIT $no_comments";              $comments = $wpdb->get_results($request);         if ($comments) {             foreach ($comments as $comment) {                 ob_start();                 ?>
                         <a style="font-size:12px "href="<?php echo get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID; ?>"><?php echo dp_get_author($comment); ?> on <?php echo $comment->comment_date; ?> :
                         <?php echo strip_tags(substr(apply_filters('get_comment_text', $comment->comment_content), 0, $comment_len)); ?>..
                 <?php                 ob_end_flush();             }         } else {             echo '
'.__('No comments', 'my-first-wp-theme').'
';         }         die(); // this is needed for ajax to work properly     }     function dp_get_author($comment) {         $author = "";              if ( empty($comment->comment_author) )             $author = __('Anonymous', 'my-first-wp-theme');         else             $author = $comment->comment_author;              return $author;     }     add_action('wp_ajax_my_recent_comments', 'dp_recent_comments_ajax');     add_action('wp_ajax_nopriv_my_recent_comments', 'dp_recent_comments_ajax'); //for users that are not logged in


title: wp_is_mobile function

text: Let me know whether `wp_is_mobile` function will work with all the mobile and tablet devices ? Is it enough to check mobile device ? I found that this method in `wp-includes/vars.php`                   function wp_is_mobile() {         static $is_mobile;              if ( isset($is_mobile) )             return $is_mobile;              if ( empty($_SERVER['HTTP_USER_AGENT']) ) {             $is_mobile = false;         } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false // many mobile devices (all iPhone, iPad, etc.)             || strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false             || strpos($_SERVER['HTTP_USER_AGENT'], 'Silk/') !== false             || strpos($_SERVER['HTTP_USER_AGENT'], 'Kindle') !== false             || strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') !== false             || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false ) {                 $is_mobile = true;         } else {             $is_mobile = false;         }              return $is_mobile;     }      If i need to develop any mobile site, whether i can use this method ? **Edit** Why wp uses server side script to detect mobile device ?


title: Authentication for wordpress website

text: i am developing android app for website, and have done coding for login page which contains username and password for my website(Job Roller), i have stuck up in validating and authenticating the username and password from remote web server, do i have to upload any code to the web-server?? please can anybody guide me? Thanks in Advance:)


title: Is there any way to inject text onto pages?

text: I run a network of sites that get updated constantly, and the content they cover is updated frequently itself. So on each page we have a "updated for [text we want injected]" Is there a way to edit this text in just one place, so that it updates everywhere across the site? Instead of manually having to edit thousands of pages?


title: display two images in theme header.php file

text: I would like to display two images in my header. functions.php:               define('BP_DTHEME_DISABLE_CUSTOM_HEADER', true);          //add support for featured images with post type of header image     add_theme_support( 'post-thumbnails', array('header_image') );           add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'header_image',             array(                 'labels' => array(                     'name' => __( 'Header Image' ),                     'singular_name' => __( 'Header Image' )                 ),             'public' => true,             'has_archive' => true,             'supports' => array('thumbnail') //(featured image, current theme must also support post-thumbnails)             )         );     }      header.php:                       <?php                 $args = array( 'post_type' => 'header_image');                 $header_images = new WP_Query( $args );             ?>             <?php   foreach($image as $header_images){ ?>                     <div class="header-image">                     <?php echo get_the_post_thumbnail($image, 'thumbnail'); ?>                     </div>             <?php                        }                            ?>      Now I have two problems: 1) I am getting a php error: Warning: Invalid argument supplied for foreach() in header.php 2) Where do I append two image paths to the header_image post type array so that i can reference the two images in header.php? thanks for response


title: if get_post_meta is empty do something

text: I need opposite of this:               <?php if ( get_post_meta($post->ID, 'price_list_category1', true) )  : ?>style="display:none;"<?php endif; ?>      In other words I want `style="display:none;"` only when meta data doesn't exist. I thought it would be straightforward like `if ( get_post_meta($post->ID, 'price_list_category1', true` but this true/false turns out to be a completely different stuff. any ideas? Thank you.


title: Front end user registration form

text:
I have created front side registration form is as under                           <?php                 /* ------------------------------------------------------------------------------------------------------------                      Template Name: newForm-template                      ------------------------------------------------------------------------------------------------------------ */                      get_header(); ?>
                          <?php while ( have_posts() ) : the_post(); ?>
                         <?php get_template_part( 'breadcrumb' ); ?>                         <?php the_title( '
', '
' ); ?>

                         <?php dynamic_sidebar( 'sidebar-4' ); ?>

                              <?php get_template_part( 'content', 'page' );                         comments_template(); ?>

                         <?php dynamic_sidebar( 'sidebar-5' ); ?>
                          <?php endwhile; ?>                                                               <?php                                             global $post;                                             // clear the cashe data meance not repeat a post, when refresh the page                                                  if(isset($_POST['submit']) ){                                                      global $wpdb;   // to connect a database                                                            //store array arg in database                                                  $custompost = array('post_status' => 'publish', 'post_type' => 'post', 'post_author' => $user_ID,                                                                 'ping_status' => get_option('default_ping_status'), 'post_parent' => 0,                                                                 'menu_order' => 0,'post_content_filtered' => '', 'post_excerpt' => '', 'import_id' => 0,                                                                 'post_content' => $_POST['content'], 'post_title' => $_POST['contactTitle']);                                                           //var_dump($id);                                                      $postId = wp_insert_post($custompost);                             ?>
                                 <form action="<?php echo $_SERVER['REQUEST_URI']?>" method="post" >

Registration Form

Name:	                                     <input type="text" id="name" value="" tabindex="1" size="20" name="name" />

                                     Designation/Class:	                                     <input type="text" id="designation" value="" tabindex="1" size="20" name="designation" />	                                     Sex:                                                    <input type="radio" name="sex" value="male">Male                                     <input type="radio" name="sex" value="female">Female

                                     Organization:	                                     <input type="text" id="organization" value="" tabindex="1" size="20" name="organization" />

                                     Postal Address	                                     <textarea id="postaladdress" tabindex="3" name="postaladdress" cols="25" rows="3"></textarea>

                                     Telephone Office:	                                     <input type="text" id="telephoneoffice" value="" tabindex="1" size="20" name="telephoneoffice" />	                                     Mob:                                         <input type="text" id="Mob" value="" tabindex="1" size="20" name="mob" />

                                     Email Address:	                                        <input type="text" id="emailaddress" value="" tabindex="1" size="20" name="emailaddress" />

                                     Academic Qualification:	                                     <input type="text" id="academicqualification" value="" tabindex="1" size="20" name="academicqualification" />

                                     Experience Teaching / Industry:	                                         <input type="text" id="experience" value="" tabindex="1" size="20" name="experience" />

                                     Title of Paper(s)	                                     <textarea id="titleofpaper" tabindex="3" name="titleofpaper" cols="25" rows="3"></textarea>

                                     Participation as:	                                      <input type="text" id="participationas" value="" tabindex="1" size="20" name="participationas" />

                                     Participation as:	                                     <select>                                         <option value="faculty">Faculty</option>                                         <option value="research">Research Scholar</option>                                         <option value="under">Under Graduate Student</option>                                         <option value="industrial">Industrial Participant</option>                                         <option value="participant">Participant Outside India</option>                                     </select>

                                     <button type="submit" name="submit">Submit</button>                                         <input type="hidden" name="submitted" id="submitted" value="true" />

                     </form>
                      <?php get_footer(); ?>  **Line 142 this**      But it's giving me: > **Parse error** : syntax error, unexpected $end in /wp- > content/themes/academica/new-template.php on line 142 Can anyone suggest to me how can I solve this error ?


title: Disable saving comment details (name, e-mail) in cookie?

text: The European Union has introduced a directive requiring that websites obtain permission for setting all 'non-essential' cookies. In the UK (where my site is based), the appropriate detail is explained by the ICO. As I understand it, with a 'vanilla' WordPress site the only cookies set are:   1. Those for logged in users to allow administration, _etc._   2. One to store the name and e-mail address of people leaving comments. The first of these seems to fall under the 'strictly necessary' clause, and my site is set up so that general log in is not an option anyway: it's only for administration. However, the second form of cookie seems to me to fall within the scope of requiring consent. There are lots of plugins about to add banners, _etc._ asking for permission, but as this functionality is not really needed I'd rather just turn off saving the cookie entirely, while still allowing comments to be left. That seems to be a lot more difficult to find out about. So I'm looking either for a plugin or direct modification of the code to do this.


title: Permalinks: custom structure for taxonomy - tags?

text: In my Wordpress permalink settings I have set the `Tag-Base` to "". So `/tag/whatever` is the current-url structure for my tag-page. However I do have a `custom-post-type` with a `custom-taxonomy` that is also using this as `rewrite_slug`.               register_taxonomy(             'event_tags',             'wr_event',             array(                 'label' => 'Tags',                 'singular_label' => 'Tag',                 'hierarchical' => false,                 'query_var' => true,                 'rewrite' => array('slug' => 'tag'),             )         );      This means both (tags for normal posts and tags for my custom-post-type) should have the same permalink structure for their tags. However this does not work. When I do set the `rewrite`-slug for my custom- taxonomy to "tag" as well, the normal tag-archive for blogposts throws a 404. I know I could easily fix this by just using two different rewrite-bases for both post-types. However I wonder if it is possible to make this work as well. So that normal tags of blogposts and tags of my custom-post-type do have the same rewrite structure. Any ideas on that?


title: Script won't load via plugin class

text:
I'm not sure why this script is not loading or producing any load errors via Firebug. Here is my plugin script:               class AV_Slideshow{           function __construct(){         $this->hooks();     }     function hooks(){         add_action('wp_head', array( $this, 'load_av_slider' ));     }        function load_av_slider(){         wp_register_script('av-slideshow', get_bloginfo('stylesheet_directory') . '/js/AV-Slideshow/av_slideshow.js', array('jquery') );         wp_enqueue_script('av-slideshow' );     }          function build_slideshow($slides){              if(!$slides){$slideshow = 'No posts are selected for this slideshow.';}                  $slideshow = '

';             foreach($slides as $post_id){                 $post = get_post($post_id);                 $title = $post->post_title;                 $content = $post->post_content;                      $slideshow .= '' . $title . '' . $content . '';             }             $slideshow .= '

';                  return $slideshow;     }          }          add_shortcode( 'slideshow', array('AV_Slideshow', 'build_slideshow') );      ?> The `$slideshow` output is working but the script never loads. Am I loading this correctly?


title: Rating system and changing the loop

text: Alright, so I want to see who can help me implement this idea I have. I just want one single Icon next to a post. If you click it, then you "Heart" it or "Love it". The post has a counter to see how many people "heart" it. Then I want to change the loop to show off "Trending" posts, "Hot Posts" or something along those lines. Any ideas or suggestions?


title: wpdb insert and boolean fields

text: I'm preparing an insert query like this:               $wpdb->insert('table', $data, $format);      data array will be:               $data = array_push($data, 'resp' => true)      problem is, what $format shall i use for a boolean field?               $format = array_push($format, '%%')      in the codex i found only %s (for strings) %d (for integers) and %f (for floats)...but what about booleans?


title: How can i catch (with get_posts) attachment file (pdf, images) from a post when i have only inserted it from media library and it isn't upload for it?

text: I'm sorry for my english. I discover a strange behavior in WP get_posts when i try to detect from a post an attachment (in my case a pdf file) inserted from the library. This is my code:               $my_query_referenze = new WP_Query( array( 'category_name' => 'referenze', 'paged' => get_query_var('paged') ) );                     while ( $my_query_referenze->have_posts() ) : $my_query_referenze->the_post();                         $content_referenze = apply_filters('the_content', get_the_content());                         $idpost = $my_query_referenze->post->ID ;                         $args_referenze = array(                             'post_type' => 'attachment',                             'post_parent' => $idpost,                             'numberposts' => 1,                             );                          $attachments_referenze = get_posts($args_referenze);                         if ( $attachments_referenze ) {                             foreach ( $attachments_referenze as $attachment_referenze ) {                                 $indirizzoallegato_referenze= wp_get_attachment_url( $attachment_referenze->ID , false );                             }                         }      If i upload a file and i attach it this code works properly. If i try to attach a file from the media library it doesn't work. I found a discussion in WP official forum where the people say that there isn't a solution for this case but is it possible? Isn't there any way to catch the images in both the situation?


title: Taxonomy archive template that shows posts from more than one taxonomy

text: I've had a fair amount of experience with WP, but this continues to make issues and could be on the brief for my next website. I'm looking for a "good" way to accomplish this task;   * the post screen will have two custom taxonomies (tax-1 and tax-2)   * each custom taxonomy will have several terms   * the user can view posts by clicking on a link to a custom taxonomy archive, like www.domain.com/tax-1/term-1/  The catch is, the admin needs to be able to select two terms, one from each taxonomy. That posts needs to be found like this;   * www.domain.com/tax-1/term-1/   * www.domain.com/tax-2/term-2/   * www.domain.com/not-sure-what-taxonomy/term-1-and-term-1 As far as I know, WP generates a category archive for each category/term/tag or whatever, so how do I combine two (or more) into one page? What would the URL look like, and would I need to $wp_rewrite magic for this? I've found you can do this sort of thing: www.domain.com/category/tag-1,tag-2, which is great, but I'd rather have something like "tag-1-tag-2" as the URL structure. I'm aware some people may say this isn't a "real" question. I'm looking for an idea, or some info from someone who has done this, not a load of code! I simply don't understand how this part of WP/querying is made up, and would love a little more knowledge. Surely someone else has also had this issue? Many thanks for your time, Dan.


title: Get the URL, width and height of an image where the width and height are a specified minimum

text:
Is it possible to get the URL, height and width of an image where the height and width are as a minimum the size I specify? `wp_get_attachment_image_src()` almost does this, but not quite, grabbing instead the image where either one of the height or width is as a minimum the size I specify. # Example For example this -> `wp_get_attachment_image_src(get_the_ID(), array(208,208));` will return these results -               array (       0 => 'http://localhost/wp-content/uploads/2014/04/image-name-300x168.jpg',       1 => 208,       2 => 116,       3 => true,     )      As you can see, the height is less than 208, so when I display the image using those attributes it becomes stretched. so in the case of the above I would actually require WP to find the next size image and return these results -               array (       0 => 'http://localhost/wp-content/uploads/2014/04/image-name-672x372.jpg',       1 => 376,       2 => 208,       3 => true,     )      Naturally I don't just want to grab the original (thus largest) image as that will unnecessarily eat bandwidth and cause the page load to be slower. # Background In case you are wondering why I require this, I am displaying 4x images in a row in a square container (208x208). The images are both horizontally and vertically centered, and I need the images to fill the container while being as small as possible. # Code               <?php     if($this->items->have_posts()) : while($this->items->have_posts()) : $this->items->the_post();                  $last = ($this->is_last_on_line()) ? 'last' : false;             $media_preview = wp_get_attachment_image_src(get_the_ID(), array(208,208));             $sizing = ($media_preview[1] >= $media_preview[2]) ? 'height="208"' : 'width="208"';                     ?>             <div id="post-<?php the_ID(); ?>" class="preview-container <?php echo $last; ?>">                    <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">                     <img src="<?php echo $media_preview[0]; ?>" <?php echo $sizing; ?> />
     <?php         endwhile;     endif;     wp_reset_query();


title: Pass widget variable to external function

text: I am working on a custom widget which displays posts from a selected taxonomy (category or tag). This widget contains a textbox which the user enters an ID of a taxonomy (category or tag) to exclude from posts. This ID can vary from widget to widget as multiple instances of this widget will appear on the same page excluding different category or tags. **I am looking for a way to pass the`$exclude` variable from `widget()` to the `excludeTheID()` function which is located in functions.php** **What I have tried:** Setting the filter to a wrapper function that calls the excludeTheID() function and passes in $exclude, but NULL is returned. For the sake of this example, here is a mock of what I am trying to accomplish:               class testWidget extends WP_Widget {              public function __construct() {             // .......         }              public function form( $instance ) {             // This widget contains a text field ($exclude)  that the user is to enter a taxonomy ID into.         }              public function update( $new_instance, $old_instance ) {             // .......         }              public function widget( $args, $instance ) {             // this value represents what the user would enter in the textbox of the widget             $exclude = 15;             // .......                  // This function does the work             add_filter( "posts_where", "excludeTheID" );                      // Create a new query             $loop = new WP_Query();                  // Remove the filter             remove_filter( "posts_where", "excludeTheID" );         }     }          // FROM Functions.php:      // External function responsible for generating the new WHERE clause using the  value in $exclude.          function excludeTheID( $where, $exclude )     {                 $clauses = array(             array(                 'taxonomy'  => 'category',                 'field'     => 'id',                 'terms'     => $exclude,                 'operator' => 'NOT IN',             ),         );              // Access the global WordPress DB variable         global $wpdb;              // Create the new WHERE Query string using the above arrays         $tax_sql = get_tax_sql( $clauses, $wpdb->posts, 'ID' );         $where .= $tax_sql['where'];              return $where;     }      I do not want to use globals to accomplish this as each widget will be passing a unique value for $exclude in every instance of that widget on a page. Any guidance would be greatly appreciated :) Thanks.


title: add_rewrite_endpoint() and Custom Post Type Archive

text: I've got a custom post type. Let's call it `books`. I'm adding a new rewrite endpoint called `pages`. I want the url `/books/pages/2/` to work but I don't see any rewrite rules generated by WordPress for this. I can manually add the rewrite rules for this specific example, but I'm looking for a way to make this work automatically. How can I make this work automatically for any given custom post type archives? I'm guessing I'll need to add a function to my plugin to look for all of the custom post types registered for the current site and then loop over that list adding the custom rewrite rules. Any better ideas? **Update** This is what I ended up doing:               function my_plugin_rewrite_rules( $wp_rewrite ) {         $pages_regex = '?([\d\-]+|all)';              $args = array(             'has_archive' => true         );         $post_types = get_post_types( $args );              $new_rewrites = array();         foreach( $post_types as $post_type ) {             $key = $post_type . '/pages/' . $pages_regex . '/?$';             $val = 'post_type=' . $post_type . '&pages=' . $wp_rewrite->preg_index(1);                  $new_rewrites[ $key ] = $val;         }              $wp_rewrite->rules = $new_rewrites + $wp_rewrite->rules;     }     add_action('generate_rewrite_rules', 'my_plugin_rewrite_rules');


title: How do I add e-mail subscription functionality

text: Hi I am new to wordpress. Kinda going through different themes that is available. I like on, which is Oulipo, but it doesn't have any e-mail subscription feature. I am using free wordpress hosting. I know may be this question is too silly but I don't understand how to add it. As I have heard free word press hosting don't have many features available, so I was wondering if only the allowed features are those that comes with the theme or is it customizable further? Thanks.


title: Can I remove a widget area without editing code?

text:
I am dealing with a Wordpress setup which has 2 widget areas. One seems to be breaking the page, and I want to remove it. Here is the screenshot of my widget setup ![enter image description here](http://i.stack.imgur.com/i5vyT.png) How can I remove the Main Widget Area without editing any code? Is that possible? And if not possible, how can I remove this area in general? Thank you!! And here is the functions.php file:               /*      * Set up the content width value based on the theme's design.      *      * @see twentythirteen_content_width() for template-specific adjustments.      */     if ( ! isset( $content_width ) )         $content_width = 604;          /**      * Add support for a custom header image.      */     require get_template_directory() . '/inc/custom-header.php';          /**      * Twenty Thirteen only works in WordPress 3.6 or later.      */     if ( version_compare( $GLOBALS['wp_version'], '3.6-alpha', '<' ) )         require get_template_directory() . '/inc/back-compat.php';          /**      * Twenty Thirteen setup.      *      * Sets up theme defaults and registers the various WordPress features that      * Twenty Thirteen supports.      *      * @uses load_theme_textdomain() For translation/localization support.      * @uses add_editor_style() To add Visual Editor stylesheets.      * @uses add_theme_support() To add support for automatic feed links, post      * formats, and post thumbnails.      * @uses register_nav_menu() To add support for a navigation menu.      * @uses set_post_thumbnail_size() To set a custom post thumbnail size.      *      * @since Twenty Thirteen 1.0      *      * @return void      */     function twentythirteen_setup() {         /*          * Makes Twenty Thirteen available for translation.          *          * Translations can be added to the /languages/ directory.          * If you're building a theme based on Twenty Thirteen, use a find and          * replace to change 'twentythirteen' to the name of your theme in all          * template files.          */         load_theme_textdomain( 'twentythirteen', get_template_directory() . '/languages' );              /*          * This theme styles the visual editor to resemble the theme style,          * specifically font, colors, icons, and column width.          */         add_editor_style( array( 'css/editor-style.css', 'fonts/genericons.css', twentythirteen_fonts_url() ) );              // Adds RSS feed links to  for posts and comments.         add_theme_support( 'automatic-feed-links' );              /*          * Switches default core markup for search form, comment form,          * and comments to output valid HTML5.          */         add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) );              /*          * This theme supports all available post formats by default.          * See http://codex.wordpress.org/Post_Formats          */         add_theme_support( 'post-formats', array(             'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video'         ) );              // This theme uses wp_nav_menu() in one location.         register_nav_menu( 'primary', __( 'Navigation Menu', 'twentythirteen' ) );              /*          * This theme uses a custom image size for featured images, displayed on          * "standard" posts and pages.          */         add_theme_support( 'post-thumbnails' );         set_post_thumbnail_size( 604, 270, true );              // This theme uses its own gallery styles.         add_filter( 'use_default_gallery_style', '__return_false' );     }     add_action( 'after_setup_theme', 'twentythirteen_setup' );          /**      * Return the Google font stylesheet URL, if available.      *      * The use of Source Sans Pro and Bitter by default is localized. For languages      * that use characters not supported by the font, the font can be disabled.      *      * @since Twenty Thirteen 1.0      *      * @return string Font stylesheet or empty string if disabled.      */     function twentythirteen_fonts_url() {         $fonts_url = '';              /* Translators: If there are characters in your language that are not          * supported by Source Sans Pro, translate this to 'off'. Do not translate          * into your own language.          */         $source_sans_pro = _x( 'on', 'Source Sans Pro font: on or off', 'twentythirteen' );              /* Translators: If there are characters in your language that are not          * supported by Bitter, translate this to 'off'. Do not translate into your          * own language.          */         $bitter = _x( 'on', 'Bitter font: on or off', 'twentythirteen' );              if ( 'off' !== $source_sans_pro || 'off' !== $bitter ) {             $font_families = array();                  if ( 'off' !== $source_sans_pro )                 $font_families[] = 'Source Sans Pro:300,400,700,300italic,400italic,700italic';                  if ( 'off' !== $bitter )                 $font_families[] = 'Bitter:400,700';                  $query_args = array(                 'family' => urlencode( implode( '|', $font_families ) ),                 'subset' => urlencode( 'latin,latin-ext' ),             );             $fonts_url = add_query_arg( $query_args, "//fonts.googleapis.com/css" );         }              return $fonts_url;     }          /**      * Enqueue scripts and styles for the front end.      *      * @since Twenty Thirteen 1.0      *      * @return void      */     function twentythirteen_scripts_styles() {         /*          * Adds JavaScript to pages with the comment form to support          * sites with threaded comments (when in use).          */         if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )             wp_enqueue_script( 'comment-reply' );              // Adds Masonry to handle vertical alignment of footer widgets.         if ( is_active_sidebar( 'sidebar-1' ) )             wp_enqueue_script( 'jquery-masonry' );              // Loads JavaScript file with functionality specific to Twenty Thirteen.         wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '2013-07-18', true );              // Add Source Sans Pro and Bitter fonts, used in the main stylesheet.         wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null );              // Add Genericons font, used in the main stylesheet.         wp_enqueue_style( 'genericons', get_template_directory_uri() . '/fonts/genericons.css', array(), '2.09' );              // Loads our main stylesheet.         wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri(), array(), '2013-07-18' );              // Loads the Internet Explorer specific stylesheet.         wp_enqueue_style( 'twentythirteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentythirteen-style' ), '2013-07-18' );         wp_style_add_data( 'twentythirteen-ie', 'conditional', 'lt IE 9' );     }     add_action( 'wp_enqueue_scripts', 'twentythirteen_scripts_styles' );          /**      * Filter the page title.      *      * Creates a nicely formatted and more specific title element text for output      * in head of document, based on current view.      *      * @since Twenty Thirteen 1.0      *      * @param string $title Default title text for current view.      * @param string $sep   Optional separator.      * @return string The filtered title.      */     function twentythirteen_wp_title( $title, $sep ) {         global $paged, $page;              if ( is_feed() )             return $title;              // Add the site name.         $title .= get_bloginfo( 'name' );              // Add the site description for the home/front page.         $site_description = get_bloginfo( 'description', 'display' );         if ( $site_description && ( is_home() || is_front_page() ) )             $title = "$title $sep $site_description";              // Add a page number if necessary.         if ( $paged >= 2 || $page >= 2 )             $title = "$title $sep " . sprintf( __( 'Page %s', 'twentythirteen' ), max( $paged, $page ) );              return $title;     }     add_filter( 'wp_title', 'twentythirteen_wp_title', 10, 2 );          /**      * Register two widget areas.      *      * @since Twenty Thirteen 1.0      *      * @return void      */     function twentythirteen_widgets_init() {         register_sidebar( array(             'name'          => __( 'Main Widget Area', 'twentythirteen' ),             'id'            => 'sidebar-1',             'description'   => __( 'Appears in the footer section of the site.', 'twentythirteen' ),             'before_widget' => '',             'after_widget'  => '',             'before_title'  => '
',             'after_title'   => '
',         ) );              register_sidebar( array(             'name'          => __( 'Secondary Widget Area', 'twentythirteen' ),             'id'            => 'sidebar-2',             'description'   => __( 'Appears on posts and pages in the sidebar.', 'twentythirteen' ),             'before_widget' => '',             'after_widget'  => '',             'before_title'  => '
',             'after_title'   => '
',         ) );     }     add_action( 'widgets_init', 'twentythirteen_widgets_init' );          if ( ! function_exists( 'twentythirteen_paging_nav' ) ) :     /**      * Display navigation to next/previous set of posts when applicable.      *      * @since Twenty Thirteen 1.0      *      * @return void      */     function twentythirteen_paging_nav() {         global $wp_query;              // Don't print empty markup if there's only one page.         if ( $wp_query->max_num_pages < 2 )             return;         ?>
<?php _e( 'Posts navigation', 'twentythirteen' ); ?>

                      <?php if ( get_next_posts_link() ) : ?>
<?php next_posts_link( __( '← Older posts', 'twentythirteen' ) ); ?>
                 <?php endif; ?>                      <?php if ( get_previous_posts_link() ) : ?>
<?php previous_posts_link( __( 'Newer posts →', 'twentythirteen' ) ); ?>
                 <?php endif; ?>
                  <?php     }     endif;          if ( ! function_exists( 'twentythirteen_post_nav' ) ) :     /**      * Display navigation to next/previous post when applicable.     *     * @since Twenty Thirteen 1.0     *     * @return void     */     function twentythirteen_post_nav() {         global $post;              // Don't print empty markup if there's nowhere to navigate.         $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );         $next     = get_adjacent_post( false, '', false );              if ( ! $next && ! $previous )             return;         ?>
<?php _e( 'Post navigation', 'twentythirteen' ); ?>

                      <?php previous_post_link( '%link', _x( '← %title', 'Previous post link', 'twentythirteen' ) ); ?>                 <?php next_post_link( '%link', _x( '%title →', 'Next post link', 'twentythirteen' ) ); ?>
                  <?php     }     endif;          if ( ! function_exists( 'twentythirteen_entry_meta' ) ) :     /**      * Print HTML with meta information for current post: categories, tags, permalink, author, and date.      *      * Create your own twentythirteen_entry_meta() to override in a child theme.      *      * @since Twenty Thirteen 1.0      *      * @return void      */     function twentythirteen_entry_meta() {         if ( is_sticky() && is_home() && ! is_paged() )             echo '' . __( 'Sticky', 'twentythirteen' ) . '';              if ( ! has_post_format( 'link' ) && 'post' == get_post_type() )             twentythirteen_entry_date();              // Translators: used between list items, there is a space after the comma.         $categories_list = get_the_category_list( __( ', ', 'twentythirteen' ) );         if ( $categories_list ) {             echo '' . $categories_list . '';         }              // Translators: used between list items, there is a space after the comma.         $tag_list = get_the_tag_list( '', __( ', ', 'twentythirteen' ) );         if ( $tag_list ) {             echo '' . $tag_list . '';         }              // Post author         if ( 'post' == get_post_type() ) {             printf( '%3$s',                 esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),                 esc_attr( sprintf( __( 'View all posts by %s', 'twentythirteen' ), get_the_author() ) ),                 get_the_author()             );         }     }     endif;          if ( ! function_exists( 'twentythirteen_entry_date' ) ) :     /**      * Print HTML with date information for current post.      *      * Create your own twentythirteen_entry_date() to override in a child theme.      *      * @since Twenty Thirteen 1.0      *      * @param boolean $echo (optional) Whether to echo the date. Default true.      * @return string The HTML-formatted post date.      */     function twentythirteen_entry_date( $echo = true ) {         if ( has_post_format( array( 'chat', 'status' ) ) )             $format_prefix = _x( '%1$s on %2$s', '1: post format name. 2: date', 'twentythirteen' );         else             $format_prefix = '%2$s';              $date = sprintf( '<time class="entry-date" datetime="%3$s">%4$s</time>',             esc_url( get_permalink() ),             esc_attr( sprintf( __( 'Permalink to %s', 'twentythirteen' ), the_title_attribute( 'echo=0' ) ) ),             esc_attr( get_the_date( 'c' ) ),             esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) )         );              if ( $echo )             echo $date;              return $date;     }     endif;          if ( ! function_exists( 'twentythirteen_the_attached_image' ) ) :     /**      * Print the attached image with a link to the next attached image.      *      * @since Twenty Thirteen 1.0      *      * @return void      */     function twentythirteen_the_attached_image() {         /**          * Filter the image attachment size to use.          *          * @since Twenty thirteen 1.0          *          * @param array $size {          *     @type int The attachment height in pixels.          *     @type int The attachment width in pixels.          * }          */         $attachment_size     = apply_filters( 'twentythirteen_attachment_size', array( 724, 724 ) );         $next_attachment_url = wp_get_attachment_url();         $post                = get_post();              /*          * Grab the IDs of all the image attachments in a gallery so we can get the URL          * of the next adjacent image in a gallery, or the first image (if we're          * looking at the last image in a gallery), or, in a gallery of one, just the          * link to that image file.          */         $attachment_ids = get_posts( array(             'post_parent'    => $post->post_parent,             'fields'         => 'ids',             'numberposts'    => -1,             'post_status'    => 'inherit',             'post_type'      => 'attachment',             'post_mime_type' => 'image',             'order'          => 'ASC',             'orderby'        => 'menu_order ID'         ) );              // If there is more than 1 attachment in a gallery...         if ( count( $attachment_ids ) > 1 ) {             foreach ( $attachment_ids as $attachment_id ) {                 if ( $attachment_id == $post->ID ) {                     $next_id = current( $attachment_ids );                     break;                 }             }                  // get the URL of the next image attachment...             if ( $next_id )                 $next_attachment_url = get_attachment_link( $next_id );                  // or get the URL of the first image attachment.             else                 $next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );         }              printf( '%3$s',             esc_url( $next_attachment_url ),             the_title_attribute( array( 'echo' => false ) ),             wp_get_attachment_image( $post->ID, $attachment_size )         );     }     endif;          /**      * Return the post URL.      *      * @uses get_url_in_content() to get the URL in the post meta (if it exists) or      * the first link found in the post content.      *      * Falls back to the post permalink if no URL is found in the post.      *      * @since Twenty Thirteen 1.0      *      * @return string The Link format URL.      */     function twentythirteen_get_link_url() {         $content = get_the_content();         $has_url = get_url_in_content( $content );              return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() );     }          /**      * Extend the default WordPress body classes.      *      * Adds body classes to denote:      * 1. Single or multiple authors.      * 2. Active widgets in the sidebar to change the layout and spacing.      * 3. When avatars are disabled in discussion settings.      *      * @since Twenty Thirteen 1.0      *      * @param array $classes A list of existing body class values.      * @return array The filtered body class list.      */     function twentythirteen_body_class( $classes ) {         if ( ! is_multi_author() )             $classes[] = 'single-author';              if ( is_active_sidebar( 'sidebar-2' ) && ! is_attachment() && ! is_404() )             $classes[] = 'sidebar';              if ( ! get_option( 'show_avatars' ) )             $classes[] = 'no-avatars';              return $classes;     }     add_filter( 'body_class', 'twentythirteen_body_class' );          /**      * Adjust content_width value for video post formats and attachment templates.      *      * @since Twenty Thirteen 1.0      *      * @return void      */     function twentythirteen_content_width() {         global $content_width;              if ( is_attachment() )             $content_width = 724;         elseif ( has_post_format( 'audio' ) )             $content_width = 484;     }     add_action( 'template_redirect', 'twentythirteen_content_width' );          /**      * Add postMessage support for site title and description for the Customizer.      *      * @since Twenty Thirteen 1.0      *      * @param WP_Customize_Manager $wp_customize Customizer object.      * @return void      */     function twentythirteen_customize_register( $wp_customize ) {         $wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';         $wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';         $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';     }     add_action( 'customize_register', 'twentythirteen_customize_register' );          /**      * Enqueue Javascript postMessage handlers for the Customizer.      *      * Binds JavaScript handlers to make the Customizer preview      * reload changes asynchronously.      *      * @since Twenty Thirteen 1.0      *      * @return void      */     function twentythirteen_customize_preview_js() {         wp_enqueue_script( 'twentythirteen-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20130226', true );     }     add_action( 'customize_preview_init', 'twentythirteen_customize_preview_js' );


title: I lock the site's contents, click on a post, redirect to login, enter uname+password but fail to redirect to article

text: As stated in the following: http://wordpress.stackexchange.com/a/100573/16266 I lock the site's contents. I then click on a post. I am navigated to wp-login screen. I enter the correct username + password of admin. I am never returned back to the article but remain stuck in wp-login without any feedback. Please help..


title: Turning Wordpress Into full-featured website?

text: I just took 2 coffees worth of caffeine and started a very big project: Turning a wordpress-engined blog with a custom theme into a full-featured website. Can this be done? Is this legal? Has this been tried before? My searches on google were in vain as I only came up with tutorials to turn my front page into a static one or how to update my theme! lame... What I want to do: Take my current website and my new blog. Then take the content from the site (database, scripts, data) and the design, look and feel plus the user administration from the blog and mix them together. Is this possible? Can it be done with today's technology? :P... is it legal? Will it bother wordpress if I use their engine to manage my website, with them not getting anything in return? I want to take my custom designed theme from my blog, the way the blog manages users(register, login, administrator right to delete users etc). I then want to take the scripts I have for my website: content-fetching from mysql, content posting, rating, comments system, custom search and all kinds of scripts and put all of these into wordpress... Is there a way to do this without digesting the whole wordpress engine by myself? has this been done before so I could follow a tutorial? THANKS IN ADVANCE to anyone kind-hearted that will lend me a helping hand


title: Simple custom post query for all the posts or many of them not working

text: I am doing this query               $args = array(     'posts_per_page' => '-1',     'post_type' => 'custom_post_type',     'post_status' => 'publish'     );          query_posts( $args );      but it is not working I have around 800 posts in that custom type and the query_posts function is working just if posts_per_page < 519. I know is weird but if I do this               $args = array(     'posts_per_page' => '518', //or any lower number     'post_type' => 'custom_post_type',     'post_status' => 'publish'     );          query_posts( $args );      it does work but not with               $args = array(     'posts_per_page' => '519', //or bigger     'post_type' => 'custom_post_type',     'post_status' => 'publish'     );          query_posts( $args );      Any suggestion??? Thanks


title: How can I upload a csv file into Wordpress?

text: I have some customers in my site. My ERP system has customers along with their price reduction level. I extracted from my ERP the list of customers' Tax IDs and price reductions levels and I want to upload it in a custom table in Wordpress. Any idea how to automate that?


title: Appending meta value onto post content in WordPress during save_post

text: The problem seems pretty straight forward: Once the `save_post` action is fired, I would like to append the value of a meta key onto the end of the `post_content` if it's not already found within the post itself. I've attempted making a call to `wp_update_post()` from within a function tied to `save_post`, but as many of you will immediately object, `wp_update_post()` contains `do_action('save_post')` and as such creates an infinite loop. What other way (using the API) exists for one to update the content of a post based on said posts custom values once the post has been saved/edited without invoking a nightmarish infinite loop?


title: Integrating jSquares and Jquery with Wordpress loop

text:
I am trying to integrate jSquares with wordpress and I am having a couple of issues. I am a beginner developer - but would love to solve this problem so that anyone can use jSquares with Wordpress. jSquares info can be found here: boedesign.com/blog/2009/10/22/jsquares-for-jquery/ This is my code so far:
          <?                      $boxes = array(     // sizes are styled through css and top, left css attributes are hard-coded on the div                     array('size' => 3, 'top' => 0, 'left' => 0),                         array('size' => 2, 'top' => 0,'left' => 224),                         array('size' => 2, 'top' => 78, 'left' => 224),                         array('size' => 3, 'top' => 0, 'left' => 336),                         array('size' => 2, 'top' => 0, 'left' => 560),                         array('size' => 2, 'top' => 78, 'left' => 560),                         array('size' => 2, 'top' => 156, 'left' => 0),                         array('size' => 3, 'top' => 156, 'left' => 112),                         array('size' => 2, 'top' => 156, 'left' => 336),                         array('size' => 1, 'top' => 156, 'left' => 448),                         array('size' => 1, 'top' => 195, 'left' => 448),                         array('size' => 2, 'top' => 156, 'left' => 504),                         array('size' => 1, 'top' => 156, 'left' => 616),                         array('size' => 1, 'top' => 234, 'left' => 56),                         array('size' => 1, 'top' => 234, 'left' => 336)); ?>                      <?php                  query_posts(array(                     'showposts' => 15,                      'post_type' => 'page',                      'posts_per_page=15',                      'orderby' => 'rand',                      'post__not_in' => array(33,145,31,148,109,111,113,29,209)));                           if (have_posts()) : while (have_posts()) : the_post();                  foreach ($boxes as $box); ?>                  <div class="js-image size-<?= $box['size']; ?>" style="top:<?= $box['top']; ?>px;left:<?= $box['left']; ?>px;">                  <a href="<?php the_permalink(); ?> "><img class="js-small-image" src="<? $image = wp_get_attachment_image_src ( get_post_thumbnail_id ( $post_id ), 'single-post-thumbnail' ); echo $image[0]; ?>"/>
                 <?php the_title(); ?>

<?php the_title(); ?>

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

                       <?php endwhile; endif; ?>      But the foreach ($boxes as $box) is only reflecting the last array for $boxes instead of one of each. I hope this makes sense. Any suggestions would be greatly appreciated!! Thanks for the advice! Here's where I am:                    <?php $query = new WP_Query(                  array('showposts' => 15,                   'post_type' => 'page',                   'posts_per_page=15',                   'orderby' => 'rand',                   'post__not_in' => array(33,145,31,148,109,111,113,29,209)));            foreach($query->$boxes as $box );            while ($query->have_posts()) : $query->the_post() ; ?>      I appreciate your help. I am trying to teach a lot of this to myself and post it for everyone else to use. I am still getting stuck - Invalid argument supplied for foreach()


title: Predefine magazine style layouts

text: I want my customer to be able to create a post by select between a significant number of magazine style layouts (possibly generated by me). Typically, they would have a number of images and pick a layout suitable for that number of images (or more). Perhaps one large image and two smaller with a block of text between them, or a 3x3 grid, or a 2x4 grid etc. **Is there any way to achieve this, or is this a no-no in Wordpress?** I'm a complete Wordpress amateur, just toying around with it right now. But I have good knowledge of MySQL, PHP and CSS, and considered writing everything myself, but thought it would be a time saver to use this framework. But before digging too deep I'd like to know it's even possible.


title: Localizing text from XML files

text: Do you guys know any way I could automatically pick up strings from .xml files and store them in a .po / .pot file, just like PoEdit does with the ones from .php files? The XML structure looks like this:               <?xml version="1.0" encoding="iso-8859-1"?>     <options>       <page id="content" label="Content Options" icon="4">         <section id="post" label="Content Options">           <option id="title" type="checkbox" default="yes" label="Show post title"></option>           <option id="comments" type="checkbox" default="yes" label="Show comments link"></option>           <option id="thumb_size" type="select" default="default" label="Thumbnail Size">             <value id="default" label="Default Size, (%s)" vars="default_size"></value>             <value id="100x100" label="Small (100x100)"></value>             <value id="150x150" label="Medium (150x150)"></value>             <value id="200x200" label="Large (200x200)"></value>           </option>              </section>       </page>     </options>      Strings within the "label" attribute should be detected by a gettext parser or something...


title: Proper Way to Remove Thumbnail Links In Gallery

text:
I use the **`post_gallery` filter** in functions.php to replace the core gallery code, with the gallery code I've modified to suit my needs, like this:               function aahan_post_gallery($output, $attr) {         global $post;              static $instance = 0;         $instance++;              // We're trusting author input, so let's at least make sure it looks like a valid orderby statement         if ( isset( $attr['orderby'] ) ) {             $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );             if ( !$attr['orderby'] )                 unset( $attr['orderby'] );         }              extract(shortcode_atts(array(             'order'      => 'ASC',             'orderby'    => 'menu_order ID',             'id'         => $post->ID,             'itemtag'    => 'div',             'icontag'    => '',             'captiontag' => 'div',             'columns'    => 3,             'size'       => 'full',             'include'    => '',             'exclude'    => ''         ), $attr));              $id = intval($id);         if ( 'RAND' == $order )             $orderby = 'none';              if ( !empty($include) ) {             $include = preg_replace( '/[^0-9,]+/', '', $include );             $_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );                  $attachments = array();             foreach ( $_attachments as $key => $val ) {                 $attachments[$val->ID] = $_attachments[$key];             }         } elseif ( !empty($exclude) ) {             $exclude = preg_replace( '/[^0-9,]+/', '', $exclude );             $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );         } else {             $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );         }              if ( empty($attachments) )             return '';              if ( is_feed() ) {             $output = "\n";             foreach ( $attachments as $att_id => $attachment )                 $output .= wp_get_attachment_link($att_id, $size, true) . "\n";             return $output;         }              $itemtag = tag_escape($itemtag);         $captiontag = tag_escape($captiontag);         $columns = intval($columns);         $itemwidth = $columns > 0 ? floor(100/$columns) : 100;         $float = is_rtl() ? 'right' : 'left';              $selector = "gallery-{$instance}";              $gallery_style = $gallery_div = '';         if ( apply_filters( 'use_default_gallery_style', true ) )             $gallery_style = "                          ";         $size_class = sanitize_html_class( $size );         $gallery_div = "

";         $output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );              $i = 0;         foreach ( $attachments as $id => $attachment ) {             $count++;             $aahan_active = (1 == $count) ? ' active' : '';             $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);                  $output .= "<{$itemtag} class='item$aahan_active'>";             $output .= "$link";             if ( $captiontag && trim($attachment->post_excerpt) ) {                 $output .= "                    <{$captiontag} class='wp-caption-text gallery-caption'>                    " . wptexturize($attachment->post_excerpt) . "                    </{$captiontag}>";             }             $output .= "</{$itemtag}>";             if ( $columns > 0 && ++$i % $columns == 0 )                 $output .= '
';         }              $output .= "

\n";              return $output;     }     add_filter("post_gallery", "aahan_post_gallery",10,2);      Now, I am pretty sure that this line in the code is responsible for linking gallery thumbnails to their Attachment Page or full-size image:               $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);      How should I modify the line so that the thumbnails don't link to anything at all? (i.e. no `<a href="">` around thumbnails in gallery)


title: Why does my delete_post hook get called twice

text: Here is how I've implemented it:               add_action( 'delete_post', array( 'MyClassName', 'delete' ) );      In the delete function I was using a $wpdb->insert command to see whether the function gets called. But I see that the $wpdb->insert command is called twice (inserts two rows in my table). Any ideas as to why something like this might happen? I've also attempted to use the before_delete_post hook since it doesn't really make a difference to me but I get the same outcome. EDIT: It seems as though the delete function is called for each entry in the wp_posts table for some reason. So if the post has 3 revisions, the delete function will be called 4 times (the original post + 3 revisions). This is really weird behavior.


title: wp_nav_menu doesn't show on index page

text: I'm using calls to wp_nav_menu() in my header.php file. They're conditional, based on whether a user is logged in. This is in header.php:               <?php if ( is_user_logged_in() ) :             wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'user' ) );      else :              wp_nav_menu( array( 'container_class' => 'menu-header',  'theme_location' => 'visitor' ) );     endif; ?>      The menus are defined in functions.php:               add_action('init', 'menus_register');     function menus_register() {        if ( function_exists( 'register_nav_menus' ) )         register_nav_menus(array(                 'user' => __('Logged In'),                 'visitor' => __('Logged Out')         ));     }      The menus are defined and assigned in the admin. On every page, they work as I would expect them to, but not on the home page. On the home page, the correct container shows up, based on the condition, but the container is empty. What would cause the same function call in header.php to return an empty container just on the home page? -- edit -- Perhaps the menus_register() function in function.php is being called at the wrong time? Maybe there's some override in the theme that only applies to the homepage? I'm hoping folks with more experience can guide me in what to look for here.


title: Can I display a list of categories in a post?

text: Using the List Category Posts plugin by Fernando Briano is it possible to display a list of all the posts in a particular category and have the titles of posts as links to the posts? I am using that plugin to do this in the side bar as a widget but was hoping I could also do it on a post or page. Or if there is another plugin that can do that that would be good. Thanks.


title: How to get full content including template HTML

text: I'm looking to get the page content between the header and footer (as Wordpress already does) that includes the template HTML (as this is going to be an AJAX request). Is there a function that will allow me to do this? The only things I have found so far all relate to just getting the content straight from the database. It would also be great to get this content via the pages' permalink.


title: Create a link to a yearly archive of post for a custom post type?

text: I've got a custom post type, and I'm building an archives.php for it. I'd like the archive page to link to sub-pages. Each sub-page would list the CPT's by year. How can do this?


title: How to customize read more link

text: Situation is I have some posts which are showing in my home page there are some read more links(excerpts) after clicking on those links they go to the complete post page, now the issue is i want to open a pdf on one of the read more link, it is not working right now what i have done is I pasted the pdf url on the post page and thought it will open the pdf after clicking it but shows the page with the same url and not opening the pdf I know i am doing wrong what I am supposed to do. In nutshell how can i open any file such as .doc,image,pdf on read more link (excerpts) **I am using latest wp3.4 tweenty-eleven theme** I am complete beginner so don't laugh over any silly mistake of mine


title: Contact form 7 select box different value-text then content-text in option

text: DSoes anyone know how I can set a different valute in the select-options in contact form 7 plugin? Here is an HTML example of what I'm trying to do               <selct>     <option value="1">My car</option>     <option value="2">Your car</option>     </select>


title: Good methodology for upgrading a large/complex sites?

text: Imagine you have a large wp site that is on 3.1 and uses like all features wordpress has (lots of CPTs, is a network-install, has lots of pages/posts with different post-templates, has child themes for the blogs in the network) and also has +30 plugins installed - which are of course all outdated. You now need to upgrade to the current version. The upgrade task itself is done within 5 minutes, but how do you know everything is working afterwards? Basically you haven't developed the whole stuff by yourself and are just in charge of performing the upgrade. Clearly it will take you weeks to visit every post of the site and to try every little nifty backend feature to make sure it still works. So what I'm asking is: Can anyone describe his methodology of performing this kind of tasks? Are there any tools that can aid in this process? I'm looking for general advises or something like a step by step workflow like:   * let tool x index the whole site,   * perform the upgrade,   * run wp core unit tests,   * let tool x index the site again and diff the whole html output for unwanted changes,    * ....


title: Redirect after deleting post and keep track of pagination

text: I have a custom post list in the admin panel. This list is paginated, so this is it's url :   * `wp-admin/edit.php?post_type=xxx`, if I open the default page   * `wp-admin/edit.php?post_type=xxx&paged=n`, if I go to the nth page of the list Each time I delete permanently an item of that list I would like to be redirected to the same page of the list if this page still exists or to the previous page of the list if the same page is no longer relevant. Let's say I have three pages for a total of 22 items where page one has 10 items, page two has 10 items and page three has 2 items.   * if I delete the last item of page three, I should be redirected to page three (as there is still one item left there after deletion)   * If I delete the last item of page three now, I should be redirected to page two (as now, page three doesn't exist anymore)   * If I delete any item of page two, I should be redirected to page two (as page two still exists)   * If I delete any item of page one, I should be redirected to page one (as page one still exists) So far I'm just able to redirect to the default first page of the list like this:               function my_deleted_post_handler()      {         global $post;         $post_type = $post->post_type;          wp_redirect("http://www.xxxxxx.com/wp-admin/edit.php?post_type=".$post_type);         exit;        }     add_action('deleted_post','my_deleted_post_handler');      But I don't know how to get the page number I'm on after deletion (or I was on before deletion), so I can't redirect to the relevant page afterwards. I tried to retrieve `$_GET['paged']`, but the function above is triggered after the deletion when the "paged" variable is not part of the url anymore so it doesn't return any value. How to achieve this?


title: Display specific widgets in different area's around the page

text: I've installed the Jigoshop plugin to create an e-commerce site. It has several built in widgets that I want to use. Is it possible to pull out specific widgets and display them within a page template? Within Jigoshop it's specifically the cart, product search and layered nav. I don't just want to display them one under another. I want the cart in the top right of the page with the product search and nav on the left of the page so I need control of each one really.


title: Automatically tag posts based on user-defined words

text: 1. I want to systematically add tags (/custom taxonomy terms) to all previous posts, from a predefined set of tags (i.e., not Yahoo tags or tags from 3rd-party APIs).    2. For future posts, I would like tags to be either suggested or added based on the content of posts.   3. Ideally: I would like a more customized way of recommending/adding tags than simply looking for the tag text in an entry; ideally I'd be able to specify a set of related words (such as with a term meta field) so that, for example, a tag of `Education` is added not just when "education" appears in a post but when some of a specified list appear in the post: `teachers, school, standardized tests, math`, etc. Can you recommend a plugin or strategy that would help achieve this? I'm open to ideas both simple and complex.


title: how can display a post on home screen without images

text: When i post something with an image, its also displayed over homepage.. And my post has image some images inside the content of the post.. and I am not using any featured image.. How can we display on the custom fields on home screen.. like I want to display 'Post title' and 'Post Date' and some 'post content' without images with limited characters. And when i click on post title, it should redirect to the original post where it has all details of the post.


title: Override a theme's WooCommerce template files with plugin

text: A plugin I'm working on, has it's own WooCommerce template files which override the default WooCommerce templates. I know I could make a child theme with a woocommerce folder but I'm trying to make these changes in a plugin to send to a client. This is what I tried, thinking that if my plugin folder contained a similar woocommerce folder structure I could override a specific template when it loads. For example with the checkout page:               add_filter( 'template_include', 'wc_template_check' );     function wc_template_check( $template ) {         if ( is_checkout() ){             return get_stylesheet_directory() . '/woocommerce/checkout/form-checkout.php';         }     }      My plugin form-checkout.php file contains a single string being echoed out for testing purposes.               <?php     /**      * Checkout Form      *      * @author      WooThemes      * @package     WooCommerce/Templates      * @version     2.0.0      */          echo "TEST";          ?>      This seems to override the entire checkout page template and displays `TEST` and nothing else. So clearly this method is wrong. How can I override the default woocommerce template files from my plugin?


title: Authors to be able to customize their author pages?

text:
I'm trying to implement a sliding control panel where logged in users can change background colors, fonts, etc. the point being that they should only be able to do it on their own author pages, nowhere else. So to put it simply: User logs in, goes to his author page and the slider appears from where he can customize the appearance of the said author page. I have the slider working, but how can I save the customizations for each author page, so every user can have customized author page? Usually these kind of control panel sliders are used for the whole site where admin can do the customizations for the whole site and they are saved to a cookie. This one works the same way currently, but should I save the selections to database for each user or what? All recommendations, suggestions and everything else is most welcome. Here's how the control panel works from functions.php:                   add_action('header_top','control_panel');function control_panel(){         $admin_access = apply_filters( 'showcontrol_panel', current_user_can('switch_themes') );         if ( !$admin_access ) return;         if ( get_option('show_control_panel') <> 'on' ) return;         global $bg_texture_urls, $google_fonts; ?>

Example Colors

                          <?php                          $sample_colors = array( '6a8e94', '8da49c', 'b0b083', '859a7c', 'c6bea6', 'b08383', 'a4869d', 'f5f5f5', '4e4e4e', '556f6a', '6f5555', '6f6755' );                         for ( $i=1; $i<=12; $i++ ) { ?>                             <a class="et-sample-setting" id="et-sample-color<?php echo $i; ?>" href="#" rel="<?php echo $sample_colors[$i-1]; ?>" title="#<?php echo $sample_colors[$i-1]; ?>">                     <?php } ?>
Texture Overlays

                          <?php                          $sample_textures = $bg_texture_urls;                         for ( $i=1; $i<=count($bg_texture_urls); $i++ ) { ?>                             <a title="<?php echo $sample_textures[$i-1]; ?>" class="et-sample-setting et-texture" id="et-sample-texture<?php echo $i; ?>" href="#" rel="bg<?php echo $i+1; ?>">                     <?php } ?>                          <?php                          $google_fonts = $google_fonts;                         $font_setting = 'Lobster';                         $body_font_setting = 'Droid+Sans';                         if ( isset( $_COOKIE['header_font'] ) ) $font_setting = $_COOKIE['header_font'];                         if ( isset( $_COOKIE['body_font'] ) ) $body_font_setting = $_COOKIE['body_font'];                     ?>
Fonts

                          Header                         <select name="control_header_font" id="control_header_font">                             <?php foreach( $google_fonts as $google_font ) { ?>                                 <?php $encoded_value = urlencode($google_font); ?>                                 <option value="<?php echo $encoded_value; ?>" <?php selected( $font_setting, $encoded_value ); ?>><?php echo $google_font; ?></option>                             <?php } ?>                         </select>

                          Body                         <select name="control_body_font" id="control_body_font">                             <?php foreach( $google_fonts as $google_font ) { ?>                                 <?php $encoded_value = urlencode($google_font); ?>                                 <option value="<?php echo $encoded_value; ?>" <?php selected( $body_font_setting, $encoded_value ); ?>><?php echo $google_font; ?></option>                             <?php } ?>                         </select>

      <?php     }     add_action( 'template_redirect', 'load_scripts' );     function load_scripts(){         $slider_type = apply_filters( 'slider_type', get_option('slider_type') );         $template_dir = get_bloginfo('template_directory');         wp_enqueue_script('jquery_cycle', $template_dir . '/js/jquery.cycle.all.min.js', array('jquery'), '1.0', false);         $admin_access = apply_filters( 'showcontrol_panel', current_user_can('switch_themes') );         if ( $admin_access && get_option('show_control_panel') == 'on' ) {             wp_enqueue_script('colorpicker', $template_dir . '/js/colorpicker.js', array('jquery'), '1.0', true);             wp_enqueue_script('eye', $template_dir . '/js/eye.js', array('jquery'), '1.0', true);             wp_enqueue_script('cookie', $template_dir . '/js/jquery.cookie.js', array('jquery'), '1.0', true);             wp_enqueue_script('control_panel', get_bloginfo('template_directory') . '/js/control_panel.js', array('jquery'), '1.0', true);         }     }     add_action( 'wp_head', 'set_bg_properties' );     function et_bg_properties(){         global $bg_texture_urls;         $bgcolor = '';         $bgcolor = ( isset( $_COOKIE['bgcolor'] ) && get_option('show_control_panel') == 'on' ) ? $_COOKIE['bgcolor'] : get_option('bgcolor');         $bgtexture_url = '';         $bgimage_url = '';         if ( get_option('bgimage') == '' ) {             if ( isset( $_COOKIE['texture_url'] ) && get_option('show_control_panel') == 'on' ) $bgtexture_url =  $_COOKIE['texture_url'];             else {                 $bgtexture_url = get_option('bgtexture_url');                 if ( $bgtexture_url == 'Default' ) $bgtexture_url = '';                 else $bgtexture_url = get_bloginfo('template_directory') . '/images/body-bg' . ( array_search( $bgtexture_url, $bg_texture_urls )+2 ) . '.png';             }         } else {             $bgimage_url = get_option('bgimage');         }         $style = '';         $style .= '';         if ( $bgcolor <> '' || $bgtexture_url <> '' || $bgimage_url <> '' ) echo $style;     }          add_action( 'wp_head', 'font_properties' );     function font_properties(){         $font_style = '';         $font_color = '';         $font_family = '';         $font_color_string = '';              if ( isset( $_COOKIE['header_font'] ) && get_option('show_control_panel') == 'on' ) $header_font =  $_COOKIE['header_font'];         else {             $header_font = get_option('header_font');             if ( $header_font == 'Lobster' ) $header_font = '';         }              if ( isset( $_COOKIE['header_font_color'] ) && get_option('show_control_panel') == 'on' )                $header_font_color =  $_COOKIE['header_font_color'];         else              $header_font_color = get_option('header_font_color');              if ( $header_font <> '' || $header_font_color <> '' ) {             $header_font_id = strtolower( str_replace( '+', '_', $header_font ) );                  if ( $header_font <> '' ) {                  $font_style .= "<link id='" . $header_font_id . "' href='http://fonts.googleapis.com/css?family=" . $header_font . "' rel='stylesheet' type='text/css' />";                 $font_family = "font-family: '" . str_replace( '+', ' ', $header_font ) . "', Arial, sans-serif !important; ";             }                  if ( $header_font_color <> '' ) {                 $font_color_string = "color: #" . $header_font_color . " !important; ";             }                  $font_style .= "";             $font_style .= "";                  echo $font_style;         }              $font_style = '';         $font_color = '';         $font_family = '';         $font_color_string = '';              if ( isset( $_COOKIE['body_font'] ) && get_option('show_control_panel') == 'on' ) $body_font =  $_COOKIE['body_font'];         else {             $body_font = get_option('body_font');             if ( $body_font == 'Droid+Sans' ) $body_font = '';         }              if ( isset( $_COOKIE['body_font_color'] ) && get_option('show_control_panel') == 'on' )                  $body_font_color =  $_COOKIE['body_font_color'];         else              $body_font_color = get_option('body_font_color');              if ( $body_font <> '' || $body_font_color <> '' ) {             $body_font_id = strtolower( str_replace( '+', '_', $body_font ) );                  if ( $body_font <> '' ) {                  $font_style .= "<link id='" . $body_font_id . "' href='http://fonts.googleapis.com/css?family=" . $body_font . "' rel='stylesheet' type='text/css' />";                 $font_family = "font-family: '" . str_replace( '+', ' ', $body_font ) . "', Arial, sans-serif !important; ";             }                  if ( $body_font_color <> '' ) {                 $font_color_string = "color: #" . $body_font_color . " !important; ";             }                  $font_style .= "";             $font_style .= "";                  echo $font_style;         }} ?>


title: Getting custom taxonomy from custom post type

text:
I have a custom post type called email_block and have a custom taxonomy called block_type. I need to loop through all the email blocks find out what custom taxonomy (block_type) they have. I know how get all the email block custom post types, it's finding the what block_type they belong to is what I'm struggling with. This is the code I have so far. I'm using a relationship field from advanced custom fields to filter what email blocks I want to display.               <?php          $posts = get_field('block_selector');          if( $posts ): ?>
         <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>             <?php setup_postdata($post); ?>
                 <a href="<?php the_permalink(); ?>"><?php the_title(); ?>                 Custom field from $post: <?php the_field('author'); ?>
         <?php endforeach; ?>
         <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly          endif; ?>


title: adsense code showing on random post thumb

text:
I've followed the guide below, but have made a few edits to it and now i need some help: Add Adsense code in index.php I removed the following line from my code `if ( ! is_front_page() ) return;` and for the most part it works as intended, however i do have one problem. I use the plugin "random posts thumbnail" on my site.I also use a snippet of code to inject absence modules in between my posts like so:                if ( 7 === $count )             dynamic_sidebar( 'ad_widget_1' );      Thus after every 6 posts it should show an adsense module. However, for some reason they are being adsense modules are being injected after every 3 posts, which incidentally is right after where my "random posts thumbnails" plugin inserts it's content. Is it possible that my counting code is including the content generated by the plugin and if so how can i fix it?                   add_action( 'widgets_init', 'wpse_84250_register_ad_widgets' );              function wpse_84250_register_ad_widgets()         {             // used on the first page of main loop only             register_sidebar(                 array (                     'name'          => 'Ad Widget 1',                     'id'            => 'ad_widget_1',                     'before_widget' => '
',                     'after_widget'  => '
'                 )             );             register_sidebar(                 array (                     'name'          => 'Ad Widget 2',                     'id'            => 'ad_widget_2',                     'before_widget' => '
',                     'after_widget'  => '
'                 )             );         }          add_action( 'loop_start', 'wpse_84250_show_ad_widgets' );          function wpse_84250_show_ad_widgets()     {         static $count = 0;              if ( ! is_front_page() )             return;              if ( 'loop_start' === current_filter() )             return add_action( 'the_post', __FUNCTION__ )                 && add_action( 'loop_end', __FUNCTION__ );              $count += 1;              if ( 6 === $count )             dynamic_sidebar( 'ad_widget_1' );              if ( 11 === $count or 'loop_end' === current_filter() ) {             dynamic_sidebar( 'ad_widget_2' );             remove_action( 'the_post', __FUNCTION__ );         }     }


title: Jetpack Mobile Theme not active on iPhone

text: I have installed and activated the Jetpack plugin, and activated the Mobile Theme module. However, the mobile theme does not display on my iPhone. I have cleared the cache on Safari. Site is here.


title: Including wp-load.php redirects the whole site to wp-admin/install.php

text: I want to give access of pages for a site that is not actually in wordpress. Client already have the wordpress website. I know that if i include the wp- load.php file outside from wordpress then i can use all the wordpress functionality into that site. I tried with               define('WP_USE_THEMES', true);     require("../foldername/wp-load.php");      but when i tried to access the url(`http://example.com/page`), it goes to `http://example.com/page/wp-admin/install.php`, I don't know why it needs installation, even the wordpress already installed.