Resizing images failing

I have recently added theme support for post_thumbnails with three new sizes, I wanted to resize all the old images uploaded previously. I have written my own script as follows:               function resizeImages()     {              require ( ABSPATH . 'wp-admin/includes/image.php' );              global $wpdb;         $images = $wpdb->get_results( "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type LIKE 'image/%' ORDER BY ID DESC");              foreach ($images as $image)         {             $fullsizepath = get_attached_file( $image->ID );                  $metadata = wp_generate_attachment_metadata( $image->ID, $fullsizepath );             // If this fails, then it just means that nothing was changed (old value == new value)             if (wp_update_attachment_metadata( $image->ID, $metadata ))                     {                         echo $fullsizepath . " resized" . "<br/>";                     }         }          }      The images that have been uploaded through wordpress work fine, but I have added some of my images by php. The images in question were picked up from our old site with a crawler and added to the database as children of the correct ID. I can retrieve all the images using get_children on the index.php page and on single.php, but for some reason they are not being resized. Can anyone help here?


WordPress Cumulus

How to install WP-cumulus add-on into WordPress ? Thanks,


Custom post type with custom taxonomy

My WP site has 2 custom post types, "Projects" and "People". There can be unlimited number of "People" per project and I'm thinking about a way to integrate the projects section with "People" section. My first impression was using custom taxonomies. But the problem is, is there a way to set a relationship between these 2? If custom taxonomy is the only way, is there a way to make it so when adding new people custom taxonomy get created as well?


Post Format Archive template name for theme folder?

What should I call the archive file for a post format? Ex archive-gallery.php? (doesn't work) I would like to create a list of all the gallery formats with a preview and some custom taxonomies thrown in.


WordPress eCommerce plugin for books

I am looking for a WordPress plugin or helping resource which I can use to build up a eCommerce website for books which has "View Inside" feature, payments to be handled with paypal. Heard of anything like that or used something similar? Any ideas how do I go about building an eCommerce site of such scope? Also any theme which will be a good fit? P.S. - I am new to building a eCommerce website with WordPress & a bit confused on which are good platforms to build it. What do you guys use and recommend?


Need help with simple rewrite rule (shouldn't this be easy?)

All I need is a rewrite that will change `example.com/anyphrase` into `example.com`. Here is what I am using:               RewriteCond %{HTTP_HOST} ^example\.com     RewriteCond %{SCRIPT_FILENAME} !wp-admin     RewriteCond %{SCRIPT_FILENAME} !activity     RewriteCond %{SCRIPT_FILENAME} !members     RewriteCond %{SCRIPT_FILENAME} !groups     RewriteRule ^([A-Za-z0-9-]+)/?$ index.php [L]      Notes:   I added the above to the top of my `.htaccess` file (in WP root). I am running WordPress 3.1.3 multisite (subdomains), WP MU Domain Mapping plugin, and buddypress on `example.com`. The mapped domain name is `example.com`, not the actual subdomain. I was assuming that my rewrite rule would load `example.com/index.php`, which would load the homepage for the WordPress site. However, I get a "page not found" response shown in my buddypress skin (not a full-blown error 404 page).


Pagination : How to remove /page/x/ after a 'POST' action on a form returning to page 1

I have the following query, what it does is get a list of "Books" (custom post type). This list is displayed on a page which also has a small form with a dropdown populated with the terms of "Editors" (custom taxonomy). When a user chooses an "Editor", it reloads the page and the query returns the corresponding "Books".               // Taxonomy query     $tax_query = array('relation' => 'AND');     if($_POST['editor']) array_push($tax_query,array('taxonomy' => 't_editor','terms' => array($_POST['editor']),'field' => 'slug'));          // Pagination     if($_POST['reset_pagination'] || !get_query_var('paged')){         $paged = 1;     }else if (get_query_var('paged')) {         $paged = get_query_var('paged');     }          // Query     $myquery = array(         'post_status' => 'publish',         'post_type' => 'books',         'orderby' => 'title',         'order' => 'ASC',         'tax_query' => $tax_query,         'paged' => $paged     );      As there are many many "Books", I use pagination. Now, the problem. Lets say I'm on the general list (non-filtered by "Editor"), I have 200 results, with a pagination of ten per page. Let's say I browse until page 8. Then, if I decide to filter my choice by "Editor", the page reloads and displays only those results. The problem is that as I was on page 8, my URL has /page/8/ attached to it. I found how to reset "paged" to 1 after a filtering has been made (with a hidden "reset_pagination" field on the form), it works and I have the results of page 1 after a filtering, BUT in the URL the pagination (/page/8/) remains. How can I remove "/page/x/" from the URL ? Edit : Here's the code for the form               <form action="" method="post" id="filter">     <ol>         <li>             <?php include(TEMPLATEPATH . '/includes/forms/filter_editors.php'); ?>         </li>         <li>             <input type="hidden" name="reset_pagination" value="1"/>             <input type="submit" class="submit" value="<?php _e('Ok'); ?>" />         </li>     </ol>


Insert First Image into post (full-width)

I am looking for a simple PHP function to insert the first image from the gallery into the post, full width (I am using custom post types btw). So the syntax will be:               <img src="xxxxx" />      any ideas? many thanks Andy


content of the page is not displaying getting empty page

1stWebDesigner PHP Template

          <?php wp_list_pages('title_li=');?>

               <?php if(have_posts()) :while (have_posts()) : the_posts();?>
<?php the_title(); ?>
     <?php the_content(); ?>     <?php endwhile; endif;?>

     Navigation          Home     About Us     Links     Portfolio     Contact     Box Two          Link Here     Link Here     Link Here     Link Here     Link Here     Box Three          Link Here     Link Here     Link Here     Link Here     Link Here
      Copyright &copy 2010 1stWebDesigner.com PHP Template
                 i used this code to display the content but am getting blank page


Handle registrations in WordPress when user doesn't have any email?

Here's my problem. I have a WordPress installation that has about 30 users with duplicates of emails in the users table. That's ok, because that's how I had to do it for the time being. I wanted users to register with exactly the same email because parents had to register their children into the system and their children did not have any email addresses (could be children from age 4 and up). An example of the database could look like               x@gmail.com (parent)     x@gmail.com (where this is child1 to parent)     x@gmail.com (where this is child2 to parent)      I solved this temporarily (because I had to get this fixed quickly), but now I would like the users be able to login and change some stuff in their profile. Usernames and passwords are created and are totally unique so it's possible to login - but no one has received usernames or passwords because the initial thought was not to give them ability to login. I could solve the issue by sending usernames and passwords to the user (parent and the parent's children) to`x@gmail.com` and go through all the 30 users (parents) and do the same. But **my issue lays in how to handle future registrations**. Each user must be unique cause each user has some custom fields related to itself. Any ideas? **UPDATE** It's about registrering different dance-courses. The dance academy wants to keep track of how many pupils (users) there are at any course and wants to keep to track of user has payed the course or not. Sometime the user can be set as reserve and sometimes not. To complicate it further it's not always this relationship between parent/child. Sometimes- let's say an 18-year old wants to register at 3 dance-courses and the user is "child" (or could at least handle the registration him/herself)


Custom WP_Query for current category (in category.php)?

I'm using a small code to display a tag list for the current categories like below:               <?php     $custom_query = new WP_Query('posts_per_page=-1&category_name=overnachten');     if ($custom_query->have_posts()) :     while ($custom_query->have_posts()) : $custom_query->the_post();         $posttags = get_the_tags();         if ($posttags) {             foreach($posttags as $tag) {                 $all_tags[] = $tag->term_id;             }         }     endwhile;     endif;          $tags_arr = array_unique($all_tags);     $tags_str = implode(",", $tags_arr);          $args = array(     'smallest'  => 12,     'largest'   => 12,     'unit'      => 'px',     'number'    => 0,     'format'    => 'list',     'include'   => $tags_str     );     wp_tag_cloud($args);     ?>      It currently displays the tags used by the posts in one certain category. I want to use the above code to display all the tags from the category I'm currently in. How would this be possible, with the above code or a better way?


When does a function assigned to the content_filtered_edit_pre filter hook fire?

I added a function to the filter hook tag `'content_filtered_edit_pre'`, but it doesn't seem to fire no matter what I do. I am also aware of `'content_edit_pre'`, but I am curious as to when this filter hook is called. The following does not result in 'filtered ' being added to the front of my post when I open it in the edit screen, even after another filter has been run:               function test_of_content_filtered_edit_pre( $content, $post_id ) {         return "filtered ".$content;     }     add_filter( 'content_filtered_edit_pre', 'test_of_content_filtered_edit_pre', 10, 2 );      The only documentation I can find on the Internet seems to be from the wordpress codex or copies of it.


get plugin directory url

I am trying to use SMOF Options Framework in a plugin and i have this problem. SMOOF use this constants to get theme directory url:               if( !defined('ADMIN_PATH') )         define( 'ADMIN_PATH', get_template_directory() . '/admin/' );     if( !defined('ADMIN_DIR') )         define( 'ADMIN_DIR', get_template_directory_uri() . '/admin/' );      But i want to use SMOF in a plugin, not in theme, how can i get the plugin directory url? What to put in order to get_template_directory() and get_template_directory_uri() to use it in a plugin?


in network setup super admin has the tinyMCE buttons and the regular admin has not

in mine network setup, the super admin has the ability to see the tinyMCE editing buttons in the option page, but when i switch to a regular adimin, i can see only the HTML editing buttons (the "rich text"). what can be the reason for that? i can find any thing in the functions.php that indicates that i registered a enqueue script just for super admins...


WP Gallery Image Page Issue When 2 galleries share one image

All attached images are stored in WP_POST table and have PARENT_POST which is only one. So if I put some image in one gallery the image will belong to that gallery(post). If I add the same Image in another gallery(post) and open the image page, than all next and prev image links will be from the first gallery. How Can I have 2 galleries and when I open the image page to fetch only the images which are in that gallery(post). Thank You


do_action in header, add action later?

I want to include the facebook JSSDK only on pages where I want to use it. On the facebook dev site it sais that ideally its included right after the opening body tag, which sits in header.php My thought was to add in header.php               <?php do_action( 'topofthetop'); ?>      right after the opening body tag. And then later (in comments.php just before `<?php if ( have_comments() ) : ?>`), if I need to call               add_action( 'topofthetop', array('someclass','FB_JS_SDK') );      FB_JS_SDK simply echoes the code needed to included the FB-JSSDK. But the code doesn't appear after the body tag. I guess because header.php is allready output before my add_action call? How could I solve this?


Creating Pages that show specific blog categories

How do you: 1) create a page and select "Blog Template" and also choose which category for the Blog's you want. 2) Then create a blog post and choose the category for that page....resulting in a page that shows all the blog posts for that category? Thanks!


WordPress Plugin: Where should I put my cookies for cURL?

Currently creating a plugin with cURL and I need a place that will work for most WordPress servers (Unix or Windows) to store my cookie file. Anyone have a suggestion or best practices? I've been googling for a while now and I think I found something about wp_temp_dir, but googling that keyword gives me only a thousand and one results about solving some install error.


Faulty restore of the database, encoding issue

I messed up the settings with W3 Total Cache (tried to import all the media to my library, didn't work out well, broke all my links to every picture). So I took my latest backup of the database, copy/paste the _post and _postmeta tables inside my phpmyadmin. It brought back the links and pictures as expected, but now all the french characters (à,é,è etc) are not displayed properly. I took the backup from the plugin WP-DBManager, which doesn't seem to handle UTF-8 properly. What's the fastest way to correct the issue ? Thanks Edited for more details: The SQL backup header is               DROP TABLE IF EXISTS `hojd_posts`;     SET @saved_cs_client     = @@character_set_client;     SET character_set_client = utf8;      However I have those characters badly encoded coming directly in my sql commands (eg: franÃ§ais for "français")...


Paging with category page

I have created my category.php to display all the posts (i am using custom post) in the category. By default, it's displaying 10 entries, and when i scroll down, i wanna fetch the next 10 entries with jquery infinite scroll. The problem is when i added the following lines to my template, it shows the link(href) to "/category/category_name/page/2" which returns 404.               <?php if($loop->max_num_pages > 1) : ?>     <nav id="page-nav" class="navigation" role="navigation">         <?php previous_posts_link('≪ Previous', $loop->max_num_pages); ?>         <?php next_posts_link('More ≫', $loop->max_num_pages); ?>     </nav>     <?php endif; ?>      How should i set my link (href) so that it fetch the next 10 entries in the same category? Thank you.


how can authors to define custom pages?

I have a options page and i use this code. I want this, I add author id on sometext field (e.g 3,2,5,11 ) and my author.php redirect custom author page. My author.php               <?php $post = $wp_query->post;     $options = get_option('sample_theme_options');      if (is_author( array($options['sometext']) ) ) {      include(TEMPLATEPATH . '/brand.php');     }     else { include (TEMPLATEPATH . '/customauthor.php');     }     ?>      Im adding Some Text field number like this 3,2,5,11                <?php echo  $options['sometext']; ?>      And code Output: 3,2,5,11 But my author.php not working good. Just first id working other id not working. How can i fix it?


Remote Image (from URL) as Media Library element

I have slow upload on my wordpress server and I want to export two very big image to external server. So I need Media Library Image to use in other component. I cant edit URL of Image. Is any plugin or solution for using remote image as Media Library? Tnaks for help. Marcin


customizing TwentyEleven comments template

Typically I don't utilize comments on my sites, however I'm using the comments functionality as a sort of live-feed testimonials page. To do this, I've borrowed `comments.php` and the comments portion of `functions.php` from the TwentyEleven theme. What I'm currently struggling with is how the comments/form are displaying on the site Ideally, I'd like the form to be on the left (inside `.content-left`) and the list of comments to be on the right (inside `.content-right`). Currently, the list of comments is both above the form in `.content-left` and where I'd like it to be in `.content-right`. How do I remove it from the left? share.php               <?php     /*     Template Name: Share     */     ?>          <?php get_header(); ?>
We're All Ears.

              <?php comments_template(); ?>

              <?php wp_list_comments( array( 'callback' => 'twentyeleven_comment' )); ?>

          <?php get_footer(); ?>      comments.php               <?php     /**      * The template for displaying Comments.      *      * The area of the page that contains both current comments      * and the comment form. The actual display of comments is      * handled by a callback to twentyeleven_comment() which is      * located in the functions.php file.      *      * @package WordPress      * @subpackage Twenty_Eleven      * @since Twenty Eleven 1.0      */     ?>
         <?php if ( post_password_required() ) : ?>
<?php _e( 'This post is password protected. Enter the password to view any comments.', 'twentyeleven' ); ?>

         <?php                 /* Stop the rest of comments.php from being processed,                  * but don't kill the script entirely -- we still have                  * to fully load the template.                  */                 return;             endif;         ?>              <?php // You can start editing here -- including this comment! ?>              <?php if ( have_comments() ) : ?>                  <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
<?php _e( 'Comment navigation', 'twentyeleven' ); ?>

<?php previous_comments_link( __( '← Older Comments', 'twentyeleven' ) ); ?>

<?php next_comments_link( __( 'Newer Comments →', 'twentyeleven' ) ); ?>
                          <?php endif; // check for comment navigation ?>
                 <?php                     /* Loop through and list the comments. Tell wp_list_comments()                      * to use twentyeleven_comment() to format the comments.                      * If you want to overload this in a child theme then you can                      * define twentyeleven_comment() and that will be used instead.                      * See twentyeleven_comment() in twentyeleven/functions.php for more.                      */                     wp_list_comments( array( 'callback' => 'twentyeleven_comment' ) );                 ?>
                  <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
<?php _e( 'Comment navigation', 'twentyeleven' ); ?>

<?php previous_comments_link( __( '← Older Comments', 'twentyeleven' ) ); ?>

<?php next_comments_link( __( 'Newer Comments →', 'twentyeleven' ) ); ?>
                          <?php endif; // check for comment navigation ?>              <?php             /* If there are no comments and comments are closed, let's leave a little note, shall we?              * But we don't want the note on pages or post types that do not support comments.              */             elseif ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) :         ?>
<?php _e( 'Comments are closed.', 'twentyeleven' ); ?>
         <?php endif; ?>              <?php comment_form(); ?>
      functions.php               <?php           if ( ! function_exists( 'twentyeleven_comment' ) ) :     /**      * Template for comments and pingbacks.      *      * To override this walker in a child theme without modifying the comments template      * simply create your own twentyeleven_comment(), and that function will be used instead.      *      * Used as a callback by wp_list_comments() for displaying the comments.      *      * @since Twenty Eleven 1.0      */     function twentyeleven_comment( $comment, $args, $depth ) {         $GLOBALS['comment'] = $comment;         switch ( $comment->comment_type ) :             case 'pingback' :             case 'trackback' :         ?>

<?php _e( 'Pingback:', 'twentyeleven' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( 'Edit', 'twentyeleven' ), '', '' ); ?>
         <?php                 break;             default :         ?>         <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">             <article id="comment-<?php comment_ID(); ?>" class="comment">
                         <?php                             $avatar_size = 68;                             if ( '0' != $comment->comment_parent )                                 $avatar_size = 39;                                  echo get_avatar( $comment, $avatar_size );                                  /* translators: 1: comment author, 2: date and time */                             printf( __( '%1$s on %2$s said:', 'twentyeleven' ),                                 sprintf( '%s', get_comment_author_link() ),                                 sprintf( '<time pubdate datetime="%2$s">%3$s</time>',                                     esc_url( get_comment_link( $comment->comment_ID ) ),                                     get_comment_time( 'c' ),                                     /* translators: 1: date, 2: time */                                     sprintf( __( '%1$s at %2$s', 'twentyeleven' ), get_comment_date(), get_comment_time() )                                 )                             );                         ?>                              <?php edit_comment_link( __( 'Edit', 'twentyeleven' ), '', '' ); ?>
                          <?php if ( $comment->comment_approved == '0' ) : ?>                         <?php _e( 'Your comment is awaiting moderation.', 'twentyeleven' ); ?>
                     <?php endif; ?>
<?php comment_text(); ?>

                     <?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply ↓', 'twentyeleven' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>

              <?php                 break;         endswitch;     }     endif; // ends check for twentyeleven_comment()          ?>      Also, how can I go have the comment list display the user name as well as the info from the other fields?


Content-type return text/plain instead of text/html after login as admin

I have a website at http://blog.rhinoera.com/. Hosted at Webfaction, which uses nginx as reverse proxy to serve php. Everytime I login as administrator, the http header that webserver returns "text/plain" instead "text/html", result in raw html text in the whole screen. I think the reason is because of W3 Total Cache, but I have no clue what it did. Could someone help me check what cause the problem? PS. The .htaccess of this site could retrieved at http://blog.rhinoera.com/htaccess.html


Importing WordPress Attachments Into Custom Directories In wp-content/uploads/

I am hoping that someone can shed light on this problem I am trying to solve, even if simply changing my thought process as to how I could solve this. I am importing a custom CakePHP based CMS web application into WordPress by means of traversing the database, making numerous SQL queries, building arrays and finally outputting the necessary XML file for import using the WordPress import tool. Currently I have managed to import categories, tags, and posts / pages just fine, no hiccups, however it is the images that seem to be the issue. The current format of images in the CakePHP based CMS is **images/year/month/day/post_id/image_name.ext** As far as I understand, but default WordPress can only store media inside **wp-content/uploads** or **wp-content/uploads/year/month** What I have done is copied over all the image folders from the CakePPH app directory into my WordPress wp-content/uploads directory, so an example image will have this path: `http://localhost/wordpress_site/wp- content/uploads/2013/01/01/12345/image.jpg` Inside my WordPress XML file that I am generating, I have set the attachment_url as well as GIUD to be as it is above, referencing the new image I place inside my uploads directory. I even set the file path in the serialzied meta data of the attachment element in the XML. If I run the import process and DO NOT check the 'Download and import attachments' option in WordPress, I get errors that the media cannot be imported... If I DO check the 'Download and import attachments' option, the images ARE located inside the custom path I specified above, but they are resized according to the thumbnail dimensions etc, and the image is still put inside a **year/month/image.jpg** path. So all WordPress did was read the file at that (custom) location, but still set the final path to a standard WordPress one, moving the image and its generated thumbnails over and away form the desired location. Does anyone know of a way to simply have the media in a custom path inside the uploads folder AND force WordPress to accept and use that path when running an import? I understand that via actions and hooks I can change the upload path structure, but only within WordPress and only when uploading media via the post / page / media manager, not during an import. The last thing I want to do is hack the import script. Any help, guidance, words of advice will be more than appreciated.


Add html after the first widget in a sidebar

Just wondering is it possible to add HTML code after the fisrt widget in a sidebar so that it would only show once and not repeat after a second or third widget is added? This is what I have so far:                     if (function_exists('register_sidebar')) {     register_sidebar(array(         'id' => 'sidebar2',         'name' => __('Sidebar 2'),         'description' => __('The Second sidebar (Magazine link).'),         'before_widget' => '
',         'after_widget' => '

Here only once
',         'before_title' => '
',         'after_title' => '
',     ));      } Thanks


How do I query a custom post type with a custom taxonomy?

For some reason I'm finding it a struggle to grab any posts using a custom taxonomy... can anyone unravel my stupidity?                $args = array(         'post_type' => 'adverts',         'advert_tag' => 'politics' // Doesn't seem to work.       );          query_posts($args);           while ( have_posts() ) : the_post();      //Show Posts     endwhile;      Taxonomy Declaration:               add_action( 'init', 'add_custom_taxonomy', 0 );     function add_custom_taxonomy() {     register_taxonomy('advert_tag', 'Adverts', array(       'hierarchical' => true,       'labels' => array(         'name' => _x( 'Advert Tags', 'taxonomy general name' ),         'singular_name' => _x( 'Advert Tag', 'taxonomy singular name' ),         'search_items' =>  __( 'Search Advert Tags' ),         'all_items' => __( 'All Advert Tags' ),         'parent_item' => __( 'Parent Advert Tag' ),         'parent_item_colon' => __( 'Parent Advert Tag:' ),         'edit_item' => __( 'Edit Advert Tag' ),         'update_item' => __( 'Update Advert Tag' ),         'add_new_item' => __( 'Add New Advert Tag' ),         'new_item_name' => __( 'New Advert Tag Name' ),         'menu_name' => __( 'Advert Tags' ),       ),       'rewrite' => array(         'slug' => 'advert-tags',         'with_front' => false,         'hierarchical' => true       ),     ));       }      Custom Post Type Declaration:                 add_action( 'init', 'create_post_type' );       function create_post_type() {         register_post_type( 'Adverts',         array(             'labels' => array(                 'name' => __( 'Adverts' ),                 'singular_name' => __( 'Advert'),                 'add_new' => __( 'Add New' ),                 'add_new_item' => __( 'Add a New Advert' ),                 'edit' => __( 'Edit' ),                 'edit_item' => __( 'Edit Advert' ),                 'new_item' => __( 'New Advert' ),                 'view' => __( 'View' ),                 'view_item' => __( 'View Advert' ),                 'search_items' => __( 'Search Adverts' ),                 'not_found' => __( 'No Adverts found' ),                 'not_found_in_trash' => __( 'No Adverts found in Trash' ),                 ),             'supports' => array(                     'title',                     'thumbnail',                 ),             'has_archive' => true,             'menu_position' => 10,             'public' => true,             'rewrite' => array( 'slug' => 'adverts' ),             'taxonomies' => array('advert_tag')         )     );      }


Title image is missing ( but is not the WP 3.5 issue )

I use Wp 3.4.2 and Featured Image. After I feel the Title, Alternate Text and publish the post, html code looks like this:               <img width="214" height="300" title="" alt="Test" class="frame wp-post-image" src="http://www.website.com/wp-content/uploads/2013/02/Test-214x300.jpg">      Is there a way to fix this?


Multiple relationships for multiple tax_query in WP_Query

I want to use the WP_Query class to filter some of the posts. The website was built without using the "normal" wp posts but using a convoluted way to allow the users to easily add blog posts to various blogs within the site (think of it as a way to have two blogs, each with their own categories, tags, etc within one wp site) I need to pull all of the posts within each blog from particular categories and containing a particular tag. I need to use both an AND and an OR statement within this query as below:               $economy_posts = new WP_Query(array( 'relation' => 'OR',          array ('post_type' => ec_prefix('ec_ny-torch-post'),             'tax_query' => array(              'taxonomy' => ec_prefix('ec_tag'),             'field' => 'term',             'terms' => 'economy',                  ),             array ('post_type' => ec_prefix('publication'),                               'tax_query' => array(         'relation' => 'AND',             array(                     'taxonomy' => ec_prefix('category'),                 'field' => 'id',                 'terms' => array('7', '41')                  ),             array(                             'taxonomy' => ec_prefix('pub-issue-area'),                             'field' => 'slug',                             'terms' => 'economy',                              ),                  ),                                 ),                          ),                                      'orderby'   => 'date',                                     'order'     => 'DESC',                                     'posts_per_page' => EC_POSTS_PER_PAGE,                                     'paged' => $paged));            ?>      The problem is that the query above is not giving me the correct results. If I break the query apart Query 1:               array ('post_type' => ec_prefix('ec_ny-torch-post'),             'tax_query' => array(              'taxonomy' => ec_prefix('ec_tag'),             'field' => 'term',             'terms' => 'economy',                  ),      Query 2:                      array ('post_type' => ec_prefix('publication'),                               'tax_query' => array(         'relation' => 'AND',             array(                     'taxonomy' => ec_prefix('category'),                 'field' => 'id',                 'terms' => array('7', '41')                  ),             array(                             'taxonomy' => ec_prefix('pub-issue-area'),                             'field' => 'slug',                             'terms' => 'economy',                              ),                  ),               Each gives me a portion of the correct result I want. I need to combine these two with an OR statement so that if either criteria is met, is gives me those posts. Any ideas as to what I am doing wrong?? Thanks!


Humanmade | Custom meta box class: How to display a repeatable meta box group?

I'm using the Humanmade | Custom meta box class to add meta boxes to my themes admin pages. I have integrated the class and have been enjoying the use of adding meta box's to my current projects immensely. I've now come into an area where I'm very stuck. ## I have a created a repeatable meta box group.               $featurettes = array(              array( 'id' => 'a_feat_img', 'name' => 'Featurette Illustration or image',                'type' => 'image', 'cols' => 4, 'show_size' => true ),              array( 'id' => 'a_feat_head',  'name' => 'Featurette heading', 'type' => 'text', 'cols' => 4 ),              array( 'id' => 'a_feat_sub',  'name' => 'Featurette subheading or description', 'type' => 'textarea', 'cols' => 4 )     );          $group_featurettes = $featurettes;     foreach ( $group_featurettes as &$featurette ) {         $featurette['id'] = str_replace( 'featurette', 'gfeaturette', $featurette['id'] );     }          $meta_boxes[] = array(         'title' => 'About Page Featurettes',         'pages' => 'page',         'show_on' => array( 'id' => array( 6 ) ),         'fields' => array(             array(                  'id' => 'a_f_gp',                  'name' => 'Featurette Panels',                  'type' => 'group',                  'repeatable' => true,                 'sortable' => true,                 'fields' => $group_featurettes,                 'desc' => 'Create featurettes.'             ),         )     );      **In the back end this works perfectly.** # As far as I've got with displaying the meta.
                           <?php echo wp_get_attachment_image( get_post_meta( get_the_id(), 'a_feat_img', true ), 'thumbnail', false, array( 'class' => 'vert-align-mid' ) ); ?>
             <?php                  $groups = get_post_meta( get_the_id(), 'a_f_gp', false );                      foreach ( $groups as $group ) {                             echo '
' . $group['a_feat_head'] . '
';                     echo '
' . $group['a_feat_sub'] . '
';                 }             ?>

      ## What I'd like to do I want to create a loop that displays a new `<section class="row featurette- wrap">` and everything in it for each repeated group made in the admin area. **What I have here**               <?php          $groups = get_post_meta( get_the_id(), 'a_f_gp', false );              foreach ( $groups as $group ) {                     echo '
' . $group['a_feat_head'] . '
';             echo '
' . $group['a_feat_sub'] . '
';         }     ?>      **Will display new information but I'd like to include the whole group and it's containing elements.** Can anyone point me in the right direction with this? Any suggestions or advice would be greatly appreciated. **Thanks**


Accidentally Changed Wordpress Url

So I have two different wordpress applications located at test/wordpress1 test/wordpress2 I wanted to switch between them under the same domain (localhost) so while on the wordpress1 application, I set the directory to localhost:8888/test/wordpress2. Didn't plan out as I have planned. I am still in the wordpress1 application but now its pointing to the wrong folder. Now everything is messed up. Any ideas on how i set the directory of wordpress1 application back to localhost:8888/test/wordpress1? And also what is the easier way to switch between 2 wordpress sites in localhost? Thank you.


Keeps asking Connection Information upon update to 3.5.1 (but not for plugins?)

for starters, I am using WordPress on a live server in which I can only login using sftp with an ssh key. I want to install and upgrade to the latest version of WordPress (currently at 3.4.2, but want to move to 3.5.1), but every time I try to hit "update now", it requires me to enter my ftp login credentials to install the latest update. This does not happen with plug-ins, as they update without any issues, but only with core WP updates. As a secondary FYI, my website resides under a "www" folder inside of a vhost that I have setup to run multiple sites within my Ubuntu installation. My folder hierarchy is as follows: var/www/vhosts/mywebsite.com/html <---where core WordPress site files reside. The "www" folder is owned by "webadmin" and in the "www-data" group, and from there, vhosts is owned by "root" and in the group "root". My website folder underneath the "Vhosts" folder is owned by "root" and in the group "root. And then from then on out, within the "html" folder, everything is owned by "www- data" and in the group "www-data" This may be too detailed, but I am trying to provide as much information as possible in-case it is a conflicting issue with my file permissions. How might I go upon fixing this issue and getting my WordPress installation updated? Thanks in advance! :)


Making $ globally accessible with jQuery.noConflict()

The Codex promotes this method of using `$` inside a plugin/theme JavaScript file:               jQuery(document).ready(function($) {         // $() will work as an alias for jQuery() inside of this function     });      But if you do that you only have access to `$` inside ready(). I think functions should be broken into small modules which are called from ready(), not all lumped together inside ready(), so if I use the Codex's method then I have to pass $ to each function, which is annoying and crude. Writing out `jQuery` all the time instead of just using `$` is also annoying. I can just do `$ = jQuery.noConflict();` at the start of my JavaScript file and then `$` is available everywhere, but I suspect that that might cause problems with other plugins/themes in some situations. My searches haven't turned up any thorough explanations or definitive answers. Does anyone have any thoughts?


Redirect wrong links Wordpress

I am using the following permalinks structure: /%postname%/ and I also have some multi-page posts that look like /%postname%/2. The problem is I see a lot of 404 errors in webmaster tools for urls like /post-name/random stuff here How can I redirect all wrong URLs to the correct ones ?


trying to enqueue script in wordpress

I've read the codex section on wp-enqeue, but am still struggling. Basically, I would like to get the following to display properly in my theme's widget area (on every page):               <link rel="stylesheet" type="text/css" href="/wp-content/uploads/social_counter/css/styles.css" />     <link rel="stylesheet" type="text/css" href="/wp-content/uploads/social_counter/css/tipTip.css" />          <div id="social_counter">     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>     <script type="text/javascript" src="/wp-content/uploads/social_counter/js/jquery.tipTip.minified.js"></script>     <script type="text/javascript" src="/wp-content/uploads/social_counter/js/social_counter.js"></script>     </div>      I created a text widget into which I pasted the code, but it breaks a few things in the template as there is likely a conflict since jquery is already loaded by the theme and/ or other plugins. Could someone show me how to best form this using wp_enqueue, and where to paste the subsequent code (functions.php of theme?)? Thanks. I've tried the following:               if(!is_admin()){     wp_deregister_script( 'jquery' );     wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');     wp_enqueue_script('custom_script',get_bloginfo('wpurl').'/wp-content/uploads/social_counter/js/jquery.tipTip.minified.js',false);     wp_enqueue_script('custom_script',get_bloginfo('wpurl').'/wp-content/uploads/social_counter/js/social_counter.js',array('jquery'),'1.4.2',false);     }      It seem to load two of the scripts when I view the page source, but not the google jquery, and the content does not show... now i have the following, still nothing (two scripts show up, but not the google jquery):               wp_deregister_script( 'jquery' );     wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');     wp_enqueue_script( 'jquery' );     wp_enqueue_script('custom_script',get_bloginfo('wpurl').'/wp-content/uploads/social_counter/js/jquery.tipTip.minified.js',false);     wp_enqueue_script('custom_script',get_bloginfo('wpurl').'/wp-content/uploads/social_counter/js/social_counter.js',array('jquery'),'1.4.2',false);      Latest Edit.. (i really wish stack overflow would adopt a mroe user-friendly threading system :/ )               function add_scripts(){     // Load jQuery     if ( !is_admin() ) {        wp_deregister_script('jquery');        wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"), false);        wp_enqueue_script('jquery');     }     // Your Scripts     wp_enqueue_script('custom_script',get_bloginfo('wpurl').'/wp-content/uploads/social_counter/js/jquery.tipTip.minified.js',false);     wp_enqueue_script('custom_script',get_bloginfo('wpurl').'/wp-content/uploads/social_counter/js/social_counter.js',array('jquery'),'1.4.2',false);     }     add_action('init','add_scripts');


unit testing admin password

I'm writing up unit tests for my plugin and I need a logged in user to test, but I can't find the admin password anywhere. Does anybody know what the default admin password is? I'm extending the `WP_UnitTestCase` and taking the tests from https://unit-tests.svn.wordpress.org/trunk. My code at the moment:               <?php     require_once('myPlugin.php');          class MyPluginTest extends WP_UnitTestCase{              function setUp(){             wp_signon(array(                 'user_login' => 'admin',                 'user_password' => 'no_idea'             ));         }     }      any help would be appreciated.


Sort by custom field value

I have a page where I only want to show posts from a specific category. At the same time, I want the posts to be sorted by a custom field value in my posts:               query_posts('category_name=' . str_replace(" ", "", $store_name) . '&meta_key=wpfp_favorites&orderby=meta_value_num');      The sorting is not working however. The posts are not sorted by the custom field value. Any ideas why? What do I need to make it work? Added: In a similar case, it is working perfectly:               query_posts('tag=' . $pagetitle . '&meta_key=wpfp_favorites&orderby=meta_value_num');


add_query_arg not working

I added a filter to append a parameter onto the URL when navigating in categories. This is used to sort posts by their votes when browsing a category only if a `sort` parameter is set. For instance when you click view all posts with most votes, posts with high votes are displayed. From there you can view most voted posts by category by appending a `sort=most_voted` or `sort=doleast_voted` to the URL with `cat=?`.               add_filter( 'category_link','append_parameter', 10, 2 );          function append_parameter( $link, $query ) {     $my_parameter = $query->query_vars['sort']; //get sort value     if ( isset($my_parameter) ) { //if browsing posts by votes         $link = add_query_arg( 'sort', $my_parameter, $link );     }         return $link;     }      I can't figure out why the sort parameter isn't appended to the URL. This works however without the if statements and a value instead of the `$my_parameter` in the add_query_arg. EDIT: New working code                   add_filter( 'category_link','append_parameter', 10, 2 );              function append_parameter( $link, $my_parameter ) {         $my_parameter = $_GET['sort']; //get sort value                if ( isset($my_parameter) ) {              $link = add_query_arg( 'sort', $my_parameter, $link );         }             return $link;         }


Best practices for A/B testing?

What do you guys use for A/B testing with WordPress? Knowing that WordPress has plugins for everything, I went looking for A/B testing plugin and didn't find any. It also looks like http://optimizely.com or similar solution may work together with WorpdPress. But I would much rather prefer managing everything in a single app. Any ideas/suggestions?


Are there any good ways to know the plugin I developed for WordPress is used by which websites?

Normally, contributors make a plugin for people to download. People download and install to use. That's it. If I can learn the types of websites that download and use my plugin, I would have a better picture for prioritizing my plugins to come that satisfies the larger chunk of my user base first. With less guesswork.


short code output too early

I'm trying to create a shortcode base on the following code:

Filter:

<a href="<?php echo get_permalink( 23 ); ?>">All
         <?php global $post; $thispage = $post->ID; // grabs the current post id from global and then assigns it to thispage ?>         <?php $pagekids = get_pages("child_of=".$thispage."&sort_column=menu_order"); // gets a list of page that are sub pages of the current page and assigns then to pagekids ?>              <?php if ($pagekids) { // if there are any values stored in pagekids and therefore the current page has subpages ?>
                 <?php wp_list_pages("depth=1&title_li=&sort_column=menu_order&child_of=".$thispage); // display the sub pages of the current page only ?>
                 <?php } elseif($post->post_parent)                    $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); if ($children) { // if there are no sub pages for the current page ?>
                 <?php echo $children; ?>
                 <?php } ?>
      **Out of the question** , this is a really good resource since it returns the child pages and even brother's pages. ok back to the game.... I trying to create a short code based on this, however if not working, so far I have this:               function filter_store ( $atts ) {     global $post; $thispage = $post->ID;     if ($pagekids) {        $output .= '
';           wp_list_pages("depth=1&title_li=&sort_column=menu_order&child_of=".$thispage);            $output .= '
';                    } elseif($post->post_parent)                 $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); if ($children) {            $output .= '
';                 echo $children;            $output .= '
';                 }             return $output;         }             add_shortcode('filter', 'filter_store');      I have spent around 3 hours trying to find where the error is, and my head is about to explode, I would appreciate any kind of help on this. Thank in advance.


Shortcode displaying at the top of the page

> **Possible Duplicate:**   >  The result of a shortcode appear BEFORE page content   >  short code output too early I got this shortcode for display my blog posts on my page, but the EXCERPT and the COMMENTS are displaying on the top of my page. Anyone has any ideia why is doing that?                   /// Recent Blog Posts     add_shortcode('recent_blog_posts', 'shortcode_recent_blog_posts');              function shortcode_recent_blog_posts($atts) {                      $str = '';                 $args = array( 'numberposts' => 3, 'post_status'=>"publish",'post_type'=>"post",'orderby'=>"post_date");                 $postslist = get_posts( $args );                      foreach ($postslist as $post) : setup_postdata($post);                      $str .= '
';                                     $str .= '
';                                          $str .= get_the_post_thumbnail($post->ID, '');                                     $str .= '
';                                           $str .='
'.get_the_title($post->ID,'').'
';                                     $str .='
13 Feb 2012 -
'.comments_popup_link('0 Comments', '1 Comment', '% Comments').';

';                                     $str .='
'.the_excerpt("child_of=8d").'
';                                     $str .='
';                 endforeach;                       return $str;         }


Random Image Shortcode

I have a great little shortcode for displaying random images. Works wonderflly --however, the output defaults to the upper corner of the main container element--as though it is being written after the entire page is done and the image path is written in that template (always shows below header but at the top of page). I have tried wrapping the image code and working with other fixes but am hitting my head against the wall as to why this won't write inline with my content. in functions.php:               function random_image() {          $dir = dirname(__FILE__)."/WHATEVERYOURPATHIS/";     if (is_dir($dir)) :              $dir_list = array_diff(scandir($dir), array(".", "..", ".svn"));              $dir_list = array_values($dir_list);          $output .= "<img src='".WP_CONTENT_URL."/WHATEVERYOURPATHIS/{$dir_list[mt_rand(0,count($dir_list)-1)]}'>";     echo $output;     endif;     }      add_shortcode('largerandomimage', 'random_image');      This is an easy way for my content editors to be able to insert a variety of random images from select galleries areas. Any thoughts/recommendations on why this code, in particular, is displaying incorrectly would be much appreciated.


wp shortcode cannot show on accurate place of content

function show_menu_list_func( $prams ) {             if(is_array($prams) && !empty($prams))             {                 $menuname = $prams['menu_name'];                 wp_nav_menu(                  array(                     'menu' => $menuname ,                     'container' => ''                     )                        );               }         }         add_shortcode( 'show_menu_list', 'show_menu_list_func');      function work fine . see image its cannot show where call it on page. http://s22.postimage.org/bnfutkogh/RESULT.jpg Noted: there no any issue of css HERE IS HTML EXAMPLE

Contact Us

ELECTRICAL

SCADA

INSTRUMENTATION

HVAC

FULL TIME AND PART TIME


The result of a shortcode appear BEFORE page content

I have a page, with a shortcode that get all the post from a categorie and put after the content of the page. For no apparent reason, the result of a WP_Query() in the shortcode APPEAR ALWAYS at the top of the page. If i put the shortcode a the top OR at the bottom, the post (3 of them) appear before the content of the page... on that one, i have NO IDEA why... shortcode is at the en of the page * * * after the comment i post the code the ECHO... this is the problem ?.. i to solve it ?               //Add a ShorCode to get a page/post content     add_shortcode ('post_cat2','get_post_cat2');        function get_post_cat2 ($att) {                 $mypost = array();                 $args = array( 'category' => 36 );            $myposts = get_posts( $args );                 foreach( $myposts as $post ) :   setup_postdata($post);            $mypost .= the_title();            endforeach;            return $mypost;             }


Shortcode output appears before post body

> **Possible Duplicate:**   >  short code output too early How can I insert my plugin code via shortcode inside post body in exact position? The problem is that wp engine inserts the plugin code **BEFORE** post body all the time. Can it be fixed? For example: I have some `[shortcode option="value"]`, that generates some text with image inside div container. When I put it inside the post **AFTER** the text, wp outputs this code: `<div> here is my plugin code </div> <p> here is the text of the post </p>` … and so it gets in the top of the post. Where is my fault?


Why do I have "category" in my permalinks?

I added two category pages to a site I am working on and I found out the permalink in the url is wrong. I set the permalink as `/%category%/%postname%` and I created two categories "News" and "Offers" I was supposed to get `mydomain.com/news` or `mydomain.com/offers` (I created the category links using the built-in menu system) but I get this instead: `mydomain.com/category/news` and `mydomain.com/category/offers` Why do I have "category" in the url? How can I remove it? Thanks


WP_Query() returns null when results exist!

I really, really don't get it. On my archive.php and category.php it doesn't find any content. I know the correct templates are loaded, but WP_Query just don't find any content. This is what i've got for archive.php:                   <?php              if($displayMobileTheme){             get_template_part('page', 'mobile');             exit;         }         get_header();              echo '
';         get_sidebar('blog');     ?>
Arkiv: <?php echo ucfirst(get_the_date('F Y')); ?>
         <?php         $blog = new WP_Query(array(             'post_type'     => 'post',             'year'          => get_the_date('Y'),             'monthnum'      => get_the_date('n')              ));         while($blog->have_posts()): $blog->the_post();             get_template_part('excerpt');         endwhile;         wp_reset_query();         ?>
      <?php         get_footer();     ?>      get_the_date() does return the correct year and monthnum, so why don't i get any results? Excerpt file, as requested:                   <?php if(!is_single(get_the_ID())) : ?>         <article class="hentry excerpt clearfix" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                                      <?php $post_categories = wp_get_post_categories(get_the_ID()); ?>                     Skrivet av <?php the_author(); ?> den <?php the_time('j F Y'); ?>,                      Kategorier:                      <?php                         $output = '';                         foreach($post_categories as $c){                             $cat = get_category($c);                             $output .= ''.$cat->name.', ';                         }                         echo substr($output, 0, -2);                     ?>
                 <?php if(has_post_thumbnail()): ?>                     <a class="left" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
                             <?php the_post_thumbnail('blog_thumb', 'thumbnail'); ?>
                                      <?php endif; ?>                      <?php the_excerpt();?>                 <a href="<?php the_permalink(); ?>">Läs mer

     <?php endif; ?>


Strategy for handling hierarchical pages with empty parent content

Let assume I have the following page structure               /about-us (used as a parent holder only)     /about-us/history (real page)     /about-us/team (real page)     /about-us/industry (real page)      There is no content in the page " **about-us** ", but it is needed for two purpose   1. Allow hierarchical structure in url   2. Allow hierarchical structure in menu But one of the issue is when user type " **/about-us** " then they will enter a blank page with non content. So, should I auto forward user to url say " **/about-us/history** " by default? Or it is the common way of handling hierarchical pages?


How do I add a custom body class for a specific page ID?

I have added this code to my child theme's `functions.php` file and use the new class but it styles the entire site, not the page I added to the code. What am I doing wrong?               add_filter('body_class','custom_body_class');          function custom_body_class($classes) {         if( is_page('38034') ) {             $classes[] = 'new-class';             return $classes;         }     }


Lightbox Plus ColorBox plugin and auto playing YouTube video

I'm using WP v3.6 and v2.6 of the plugin and using inline lightboxes to open a YouTube video embeded with an iframe. My boss wants the video to play when the lightbox opens. So originally I tried:               var tag = document.createElement('script');     tag.src = "https://www.youtube.com/iframe_api";     var firstScriptTag = document.getElementsByTagName('script')[0];     firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);          var player1;          function onYouTubeIframeAPIReady() {         console.log('api ready');         player1 = new YT.Player('player1', {});     }     jQuery(function()){         jQuery('.lbp-inline-link-1').click(function(){             player1.playVideo(); }         });     });      However, that didn't work. I eventually figured out that the plugin is stopping the video that is playing in lightbox when it's opened and closed, so my click event triggering play was too early. I then modified my call to:               var tag = document.createElement('script');     tag.src = "https://www.youtube.com/iframe_api";     var firstScriptTag = document.getElementsByTagName('script')[0];     firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);          var player1;          function onYouTubeIframeAPIReady() {         console.log('api ready');         player1 = new YT.Player('player1', {             events: {                 'onReady': onPlayerReady             }         });     }     function onPlayerReady(event){         console.log('player ready');         jQuery('.lbp-inline-link-1').click(function(){             console.log('click ready');             var fn = function(){ event.target.playVideo(); }             setTimeout(fn, 2500);         });     }      Current sample page at https://test-cms.salesgenie.com/salesgenie-data- quality/ That worked in Chrome, but in all other browsers it only auto plays the video the second time it's opened in lightbox. Any suggestions on an easier, more direct route to auto playing a YouTube video?


List posts in a select tag and display the_content of the selected option

I would like to create a select tag with posts from my custom post type and then, when an option is selected, I need to get the_content() from that selected post by its ID and display the content below. Esentially it would look like this:               <select name="menu" id="menu">         <option value="0">Please choose a food menu:</option>         // random IDs         <option value="5">Food menu 1</option>         <option value="11">Food menu 2</option>         <option value="19">Food menu 3</option>     </select>      (in PHP it might be like this, at least this is all that I can do)               $menu_loop = new WP_Query(         array(             'post_type' => 'menu',             'posts_per_page' => -1         )     );          if ($menu_loop->have_posts()) { ?>         <select name="menu" id="menu">             <option value="0">Please choose a food menu:</option>                  <?php while ($menu_loop->have_posts()) : $menu_loop->the_post();                 $the_id = get_the_ID(); ?>                 <option value="<?php echo $the_id; ?>"><?php the_title(); ?></option>             <?php endwhile; ?>         </select>     <?php } ?>      And then something like:               // get content by ID of the selected option     <?php the_content($post->ID); ?>      I know its much harder than what I wrote above, but I just dont know how to do this, any help is appreciated, Thank you.


Check if do_action('custom_action') is hooked into?

Is there a way to check if a custom hook gets called upon? I would like to display a placeholder if no output will be passed to it.


Custom blogroll-like section

I'm developing a wordpress.org site with a newspaper custom theme. I have a sidebar section named 'Opinion' working like a blogroll: a list of posts with title and author; the most recent post is at the top of the list and only one post per author is displayed. Authors are real wordpress users and the author name displayed is fetched from the wp user account. Currently, 'Opinion' is implemented as a heavy database query. I believe this is degrading performance, specially in common access to front page, where 'Opinion' is displayed. I need to change the implementation. My requirements: behave like currently it does, displaying post title, author name, updating as a blogroll and, importantly, being able to customize html/css. Perhaps, if possible, being able to display some extra meta data attached to the author posts. How can I do it? I can only think of taking advantage of wordpress feeds. I could use or create some blogroll and register 'blogs' using the author feed urls: www.mywpsite.com/author/john/feed www.mywpsite.com/author/smith/feed www.mywpsite.com/author/mary/feed and son forth. But I have no idea if I will be able to get the author name, and also customize the html/css. Is it possible to implement 'Opinion' this way or by any other means? Thank you!


Remove a metabox registered by another plugin - Woocommerce

I am trying to remove the gallery metabox which is added by WooCommerce - its been added in an update, but I already have a Gallery metabox, and I don't want to confuse the client. Obviously I can hack the plugin, but I'd like to do it from the functions.php I've tried:               function remove_my_meta_boxes() {         remove_meta_box( 'woocommerce-product-images',  'product', 'side');     }     add_action( 'admin_menu' , 'remove_my_meta_boxes', 40 );      It doesn't seem to work The code that's adding it seems to be               public function __construct() {     add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 30 );     }      and               public function add_meta_boxes() {         add_meta_box( 'woocommerce-product-images', __( 'Product Gallery', 'woocommerce' ), 'WC_Meta_Box_Product_Images::output', 'product', 'side' );     }      I've removed sections which aren't relevant - ie other metaboxes registered etc.


Blogger To WordPress Permalink Redirection

Is there any way to redirect following or anything permalink like this: http://www.example.com/2014/02/post-title.html to http://www.example.com/2014/02/post-title/ Any link with a .html in the end to / in the end.


Big side banners

I would like to have a big header side advertisements like this: What is the best way to achieve that? ![enter image description here](http://i.stack.imgur.com/XT1xd.jpg)


How to add banners in sidebar of my theme

I am new to word press. I need to add 2 banners in my right side bar. Could you help me?? How can I do it?? What is the code which I have to insert in a text widget? I am using zeesynergie theme. Please help me


Multiple custom post types on index page with custom templates

I've got (currently) 3 custom post types that I need to display on my sites' home page using a custom query. Each custom post type has a different layout (1 post across, 2 posts across and 4 posts across). What I am trying to do is call a different template for each layout. I've been working on this close to a month and can't figure it out. Any help would be appreciated. I'm using the following code, and it isn't working: `<?php if ( 'one_column' == get_post_type() ) { include 'inc-onecolumn.php'; } elseif ( 'two_column' == get_post_type() ) { include 'inc-twocolumn.php'; } elseif ( 'four_column' == get_post_type() ) { include 'inc-fourcolumn.php'; } else { echo 'Hello!' } ?>` I've created a couple of test posts but nothing is showing up on the homepage except 'Hello!'. First, am I on the right path? Second, if I am on the right path, is it the following code that's incorrect (it's my template for 1 across)? Template code: http://pastebin.com/5iGiRFPF


is_front_page only works in theme file, and does not work in functions.php

If I use is_front_page() in my front-page.php file it works as expected. However if I use the same function in my theme functions.php file it does not work. Is this normal behavior? If not can it be trouble shot somehow? In settings->reading I have my front page set to a page called "front page" so I think that is all set. **EDIT** adding the following to functions.php does not work, however I promise it does work as expected if I add is_home_page() to my header.php file               add_action('init', 'my_test');          function my_test(){         if(is_front_page())             echo 'is it?';     }


Why is wp_head() creating a top margin at the top of my theme header?

I am creating a custom theme, and elements behave as they should but when I place the `<?php wp_head() ?>` tag I get a top margin, at the top of my theme header. When I remove the `<?php wp_head(); ?>` the margin goes away. I have been at this for a while any help would be great.


Ajax takes 10x as long as it should/could

I have just hit my first serious issue with WordPress and for someone that enjoys Ajax this is a biggy. I have an Ajax request that is taking 1.5 seconds to complete while using the Ajax API. If I take the same exact code and run it with a custom script(no WordPress) the Ajax request takes merely 150 milliseconds. **This is not an exaggeration** If you look at the very first comment of http://wp.smashingmagazine.com/2011/10/18/how-to-use-ajax-in-wordpress/ and the conversation that follows you will see that this slowness is caused by the fact that on your request, all of WP is loaded... I am hoping that there is a solution out there that will make it possible to make Ajax requests while not loading all of WordPress. What are your experiences with speeding up Ajax requests with WordPress?


Multiple post types - share same ReWrite slug?

I've run into another wonderful 404 issue. I'm trying to have 2 seperate post types that share the same rewrite slug. I've flushed my rewrite rules, and when I test only 1 of the CPT works- the other gets a 404. My rewrite that I wish to use for both is:               'rewrite' => array('slug' => 'team/%teamtype%'),      Anyone know how to handle this?               add_action( 'init', 'create_rider_type' );          function create_rider_type() {          register_post_type('riders',      array(           'description' => 'rider custom post type',         'show_ui' => true,         'menu_position' => 5,         'menu_icon' => get_stylesheet_directory_uri() . '/images/riders.png',         'exclude_from_search' => false,         'labels' => array(             'name' => 'Team Riders',             'singular_name' => 'Rider',             'add_new' => 'Add New rider',             'add_new_item' => 'Add New rider',             'edit' => 'Edit riders',             'edit_item' => 'Edit rider',             'new_item' => 'New rider',             'view' => 'View rider',             'view_item' => 'View rider',             'search_items' => 'Search riders',             'not_found' => 'No riders found',             'not_found_in_trash' => 'No riders found in Trash',             'parent' => 'Parent rider',         ),         'hierarchical' => false,         'supports' => array('title','editor','excerpt', 'trackbacks','custom-fields', 'comments','revisions','thumbnail','author','page-attributes'),         'public' => true,         'rewrite' => array('slug' => 'team/%teamtype%'),         'taxonomies' => array('teamtype')         )      );               }                              add_action( 'init', 'create_sponsor_type' );          function create_sponsor_type() {          register_post_type('sponsors',      array(           'description' => 'sponsor custom post type',         'show_ui' => true,         'menu_position' => 5,         'menu_icon' => get_stylesheet_directory_uri() . '/images/sponsors.png',         'exclude_from_search' => false,         'labels' => array(             'name' => 'Team sponsors',             'singular_name' => 'sponsor',             'add_new' => 'Add New sponsor',             'add_new_item' => 'Add New sponsor',             'edit' => 'Edit sponsors',             'edit_item' => 'Edit sponsor',             'new_item' => 'New sponsor',             'view' => 'View sponsor',             'view_item' => 'View sponsor',             'search_items' => 'Search sponsors',             'not_found' => 'No sponsors found',             'not_found_in_trash' => 'No sponsors found in Trash',             'parent' => 'Parent sponsor',         ),         'hierarchical' => false,         'supports' => array('title','editor','excerpt', 'trackbacks','custom-fields', 'comments','revisions','thumbnail','author','page-attributes'),         'public' => true,         'rewrite' => array('slug' => 'team/%teamtype%'),         'taxonomies' => array('teamtype')         )      );          }      _**_** _*_ ** _*_ ** _*_ ****** _Update_ ** _*_ ** _*_ ** _*_ ** _*_ ** _*_ ** _*_ ** _*_ ** _*_ ** _*_ ** _*_ ** _*_ ** _*_ *** The original CPT rewrite code I posted was simplified so I could get more straight to the point- however maybe it makes more sense if you can see how i'm handling those permalinks with my custom Taxonomy. I've updated the code to show. I really wish to keep them as seperate post types- for organization as well as seperate metaboxes for each. Please check the updated rewrites for the CPT's, as well as my Taxonomy setup below:               add_action( 'init', 'create_team_taxonomies' );          function create_team_taxonomies() {     register_taxonomy(      'teamtype',      array('riders','sponsors'),     array(          'labels' => array(             'name' => 'Team Types',             'singular_name' => 'Team Type',             'search_items' =>  'Search Team Types',             'popular_items' => 'Popular Team Types',             'all_items' => 'All Team Types',             'parent_item' => 'Parent Team Type',             'parent_item_colon' => 'Parent Team Type:',             'edit_item' => 'Edit Team Type',              'update_item' => 'Update Team Type',             'add_new_item' => 'Add New Team Type',             'new_item_name' => 'New Team Type Name'         ),      'hierarchical' => true,      'public' => true,     'show_ui' => true,     'query_var' => 'teamtype',     'show_tagcloud' => true,     'rewrite' => array( 'slug' => 'team', 'with_front' => false)      )      );          }      And here is how I setup the rewrite when I select the Taxonomy, and publish the post:               add_filter('post_link', 'teamtypepermalink', 10, 3);     add_filter('post_type_link', 'teamtypepermalink', 10, 3);          function teamtypepermalink($permalink, $post_id, $leavename) {     if (strpos($permalink, '%teamtype%') === FALSE) return $permalink;              // Get post         $post = get_post($post_id);         if (!$post) return $permalink;              // Get taxonomy terms         $terms = wp_get_object_terms($post->ID, 'teamtype');             if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;         else $taxonomy_slug = 'not-specified';          return str_replace('%teamtype%', $taxonomy_slug, $permalink);     }


Display most recent posts in category with Twenty Ten theme widget

I am fairly new to WordPress, and I would like to have a list of the most recent posts in a certain category appear in a right-hand panel (I can do this with all posts, but not specific categories) I am using the Twenty Ten theme, on wordpress.com. I have found the following code, but unsure if or where this can be added:
     <?php $recent = new WP_Query("cat=10&showposts=5"); while($recent->have_posts()) : $recent->the_post();?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>
         <?php endwhile; ?>


Script to replace default blogroll with links to my social media URLs

I've got a plugin that I ship with my theme whose function is to jumpstart the process of launching site so that its optimized for the theme. It has all my default pages, plugins, settings, etc... For example, I'm using the following script to remove the default blogroll links...               $arr_args = array( 'hide_invisible' => 0 );     $arr_links = get_bookmarks( $arr_args );     foreach($arr_links as $obj_link){wp_delete_link($obj_link->link_id);}      However, now I want to create replacement links to go in this listing. I want my social media links to go here. Basically, I want to create a list of 4-5 links (YouTube, Facebook, Twitter, LinkedIn, etc) Once I know how to insert bookmark links via script, I can place the css bits in my theme that I need to effect the look. Any ideas or examples for doing this?


Insert images to post not working

I'm encountering an issue with wordpress 3.5.1 (french language). I can't insert images in posts/pages or whatever. When i access the media library from the button "insert a media" (while editing a post), the media library is empty, so i can choose an already upload image to insert. If i upload an image from my computer, the image loads well (and get upload in the uploads directory), but when i insert it in the post, the media box close and the image don' insert. On my local development environnement, all works fine, i've try all basic steps to identify the issue with no results. I wonder if it could be an issue from my web host. Any ideas?


Hook for plugin to insert into entry-meta

pretty simple. I'm creating a plugin and I want to dynamically insert some text that will change every hour into the line that is directly below the title of a post (So filters are no good). It's the `<div class="entry-meta">`. The `<div class="entry-utility">` at the bottom of the post would be good too. I can't seem to find a hook for this and I'm guessing there is none. Right now the solution I have is to hook into "the_content" and place it as a footer, but it looks reaaally bad because it's a small piece of text with an entire line to itself. It would look considerably better if I could insert it into those lines mentioned.


Can data from a Custom Field data be used by a shortcode on a per page/post basis?

I'm developing a site where better is very quickly becoming the enemy of the good. I would like to make updating as simple for the client as possible by enabling them to populate boilerplate and images text using a shortcode. However, there is one word within the boilerplate text which needs to be unique for each page and must be added by the client. I was thinking of using a specific custom field key and value, as a way of capturing the unique information. Is it possible and reasonable to use custom fields for this purpose within the shortcode? I'm having trouble thinking through the syntax. Is there a better way to do this?


get_terms not returning any custom taxonomies

I have a custom post type called `project` with custom taxonomy called `tagportfolio`   I use this code to generate both:                add_action('init', 'project_custom_init');              /*-- Custom Post Init Begin --*/       function project_custom_init()       {         $labels = array(         'name' => _x('Projects', 'post type general name'),         'singular_name' => _x('Project', 'post type singular name'),         'add_new' => _x('Add New', 'project'),         'add_new_item' => __('Add New Project'),         'edit_item' => __('Edit Project'),         'new_item' => __('New Project'),         'view_item' => __('View Project'),         'search_items' => __('Search Projects'),         'not_found' =>  __('No projects found'),         'not_found_in_trash' => __('No projects found in Trash'),         'parent_item_colon' => '',         'menu_name' => 'Project'       );            $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'show_in_menu' => true,         'query_var' => true,         'rewrite' => true,         'capability_type' => 'post',         'has_archive' => true,         'hierarchical' => false,         'menu_position' => null,         'supports' => array('title','editor','author','thumbnail','excerpt','comments')       );            // The following is the main step where we register the post.       register_post_type('project',$args);            // Initialize New Taxonomy Labels       $labels = array(         'name' => _x( 'Tags', 'taxonomy general name' ),         'singular_name' => _x( 'Tag', 'taxonomy singular name' ),         'search_items' =>  __( 'Search Types' ),         'all_items' => __( 'All Tags' ),         'parent_item' => __( 'Parent Tag' ),         'parent_item_colon' => __( 'Parent Tag:' ),         'edit_item' => __( 'Edit Tags' ),         'update_item' => __( 'Update Tag' ),         'add_new_item' => __( 'Add New Tag' ),         'new_item_name' => __( 'New Tag Name' ),       );            // Custom taxonomy for Project Tags       register_taxonomy('tagportfolio',array('project'), array(         'hierarchical' => true,         'labels' => $labels,         'show_ui' => true,         'query_var' => true,         'rewrite' => array( 'slug' => 'tag-portfolio' ),       ));            }       /*-- Custom Post Init Ends --*/            But when I use the `get_terms()` function it didn't shows any taxonomies Then is used the function below:               get_terms("tagportfolio",array('hide_empty'=>0));      It also didn't show any of my taxonomies


Redirect Custom Post Type after user submits update

I have a function for a custom post type that redirects NEW posts to a specific url after they are submitted by users:               function tribe_redirect_after_community_submission( $wp ) {         if ( isset( $wp->query_vars[WP_Router::QUERY_VAR] )         && $wp->query_vars[WP_Router::QUERY_VAR] == 'ce-add-route'         && !empty( $_POST ) ) {             wp_safe_redirect(home_url('http://www.myurl.com'));             exit();         }     }      I want to expand upon this so that when a user UPDATES a post, the user gets redirected to a different url. So just as I'm testing to see if `$wp->query_vars[WP_Router::QUERY_VAR]` is set to `ce-add-route`, I need to test against the possibility that it might be set to `ce-edit-route`. How can I edit my function above to achieve that? I'm a novice with php and didn't write the function on my own.


Pings and replies

If in a theme for WordPress comments were separated from pings, would it makes sense to keep the option of reply to them in the discussion? (ie visualize the reply link for pings too). Thanks for helping.


Is there a way to set the default active tab on Post UI Tab pluggin?

We've started using the Post UI Tabs pluggin but would like to be able to arbitrarily set the tab that is active when the page is loaded. For instance, in one example, we have a three-week process, each week being it's own tab and a fourth tab for resource information, and would like to default the week 3 tab to be active. Thanks, Tony


Only show top-level links in site navigation

This seems like it should be easy to do, but I've not been able to find or work out a solution. I'm using the Starkers theme and Wordpress 3.0.4, and my site auto-generates its navigation as per normal. I would like however the navigation to **only show the top level pages** , i.e. not display links to any pages that are children of other pages. This is the code I am currently using.               <?php wp_nav_menu( array( 'container' => 'nav', 'fallback_cb' => 'starkers_menu',     'theme_location' => 'primary' ) ); ?>      I would like to hide the child links programmatically, but I am prepared to use CSS if someone can instead advise how to assign specific classes to the child links. Thanks in advance for any help. _**_**edit 2**** I've tracked down the actual function I am using, called starkers_menu (below). However adding depth to this, or even removing the other exclusions and just using depth doesn't work either:               function starkers_menu() {         echo '
';         wp_list_pages('depth=1&exclude=4,19&title_li=');         echo '
';     }


The title says it all. What is the best page ordering plugin that works well with WPML? It seems that may are reporting issues with different plugins such as my page order and WPML page order. WordPress 3.1 RC3 WPML 2.0.4


wp_kses and magic quotes

n00b question - in the wp_kses codex page it says "You have to remove any slashes from PHP's magic quotes before you call this function." I am new(ish) to PHP and I wiki'd Magic Quotes and it was apparently recently deprecated/removed from the language - so is this something that I still have to worry about?


Custom Path for a Plugin

i developed a plugin (the backend at least) and now i want to add a frontpage to my blog. the url should look something like this               http://www.mywordpressblogalsoroot.com/mypluginname/param1/param2     http://www.mywordpressblogalsoroot.com/mypluginname/param1/     http://www.mywordpressblogalsoroot.com/mypluginname/      all this three urls should point to a plugins function or a php site with a loop, i dont know. the params should be readable , i think with `get_query_var` i played a bit with the following:               add_filter('rewrite_rules_array','gamecard_insertMyRewriteRules');     // Adding a new rule     function gamecard_insertMyRewriteRules($rules) {         $newrules = array();         $newrules['(gamecard)/(\d*)$'] = 'index.php?pagename=$matches[1]&gamecardslug=$matches[2]';         return $newrules + $rules;     }          // Adding the id var so that WP recognizes it     function gamecard_insertMyRewriteQueryVars($vars)     {         array_push($vars, 'gamecardslug');         return $vars;     }      something is happening, but i stuck a bit. somebody can give me a pointer how to get all this done? thanks


Custom Theme Design: do I need to "enable" jquery/javascript libraries?

When I build a theme from scratch I have to "enable" sidebars and specific menus in the functions.php. Similarly, do I need to "enable" access to the javascript and jquery libraries that come bundled with WordPress? I ask because 2 How-to books I've been using (WordPress 2.8 Theme Design, and Beginning WP 3) both talk about needing to do this and provide code, but neither of them makes explicit whether you need to do this just to make things work in general, or whether you need to do this only if you want to include your own "standalone" javascript(s) as opposed to a script that is part of a plugin/widget. I'm assuming the latter but want to confirm -


WP booking system plugin?

I'm a bit overwhelmed with the googling I'm doing and thought I'd turn to the community for recommendations: I need a booking engine which will :   1. Allow Events to be posted including dates, locations etc   2. Set a max ticket allocation   3. Have Paypal Integration   4. Ability to dump out sales data to a csv would be nice..   5. Perhaps handle returns or refunds Thanks very much indeed


Add Custom Post Type on the Fly or create an array

I have a unique problem I guess. I am working on a site and the client needs to have a way in Wordpress backend from where he can add a post, and from the same page (where he is creating a post) he can add sub posts to that post. He wants to be able to as many sub posts as he wants. And then he wants on the front end, the main content of the main post to be shwon as a paragraph and the sub posts to be shown as a tabbed window like this in the example: http://www.ricardoruiz.es/tratamientos/dermatologia- estetica/rejuvenecimiento-facial/radiesse I know how to do the tab thing on the front buy I am not getting an idea on how to have a sub post thing of a main post. Or this exists at all or not. Any help will be appreciated. Thanks in Advance


Wordpress Settings API error

Hi I am trying to creating some custom options for a template I am developing but I seem to be getting an error:               Warning: Illegal string offset 'show_header' in C:\xampp\htdocs\wordpress\wp-content\themes\01MyWork\includes\theme-options.php on line 62      This is the line that seems to be throwing the error:                $html = '<input type="checkbox" id="show_header" name="thanathos_theme_display_options[show_header]" value="1" ' . checked(1, $options['show_header'], false) . '/>';        And this is the entire code:                   <?php          function thanatos_theme_menu(){             add_theme_page(                            "Thanathos Theme Options",                             "Thanathos Theme",                             "administrator",                             "thanathos_theme_options",                            "thanathos_theme_display_callback"                           );         }         add_action('admin_menu' , 'thanatos_theme_menu');         function thanathos_theme_display_callback(){     ?>

Sandbox Theme Options
                            <?php settings_errors(); ?>                                          <form method="post" action="options.php">                         <?php settings_fields('thanathos_theme_display_options'); ?>                         <?php do_settings_sections( 'thanathos_theme_display_options' ); ?>                                      <?php submit_button(); ?>                     </form>
     <?php         }              add_action('admin_init' , 'thanatos_initializa_theme_options');         function thanatos_initializa_theme_options(){             if( false == get_option( 'thanathos_theme_display_options' ) ) {                     add_option( 'thanathos_theme_display_options' );               }              add_settings_section(                     'general_settings_section',                      'Thanatos Options',                      'thanatos_general_options_callback',                      'thanathos_theme_display_options'             );             add_settings_field(                     'show_header',                     'Header',                     'thanathos_field_header_callback',                     'thanathos_theme_display_options',                     'general_settings_section',                      array(                              // The array of arguments to pass to the callback. In this case, just a description.                           'Activate this setting to display the header.'                      )              );             register_setting('thanathos_theme_display_options', 'thanathos_theme_display_options');         }              function thanatos_general_options_callback(){             echo 'mergem la mare';         }         function thanathos_field_header_callback($args){              // First, we read the options collection               $options = get_option('thanathos_theme_display_options');             // Next, we update the name attribute to access this element's ID in the context of the display options array               // We also access the show_header element of the options collection in the call to the checked() helper function              $html = '<input type="checkbox" id="show_header" name="thanathos_theme_display_options[show_header]" value="1" ' . checked(1, $options['show_header'], false) . '/>';                // Here, we'll take the first argument of the array and add it to a label next to the checkbox               $html .= ' '  . $args[0] . '';                echo $html;         }     ?>


Disable the visibility options in WP

Is there a way to disable the public vs private vs password-protected visibility UI when editing or quick-editing a post? A quick scan in the code yields `#visibility`, which I could hide using jQuery, but I was wondering if there was a documented way to do this "properly".


How to post data to a word press site in case of a mobile app

I have a site made with word press. I came across a requirement where a developer tries to log in from an ipad or iphone into word press site. Is there any plugin to achieve this ?. there is a necessity to get back the data in json format and give to developer !!


Display posts from tagchildren of taxonomy tagparents

Firstly, I'm trying to display all tags from a taxonomy called 'group'. However, this taxonomy currently contains two tags, from which one of of them has multiple tagchildren. I'd lik to display all posts belonging to those children. So the final result should look something like this:   * Parent Tag A      * Child tag        * Post data     * Child tag        * Post data     * etc...   * "Parent" Tag B              <?php     $taxonomyName = "group";     $terms = get_terms($taxonomyName,array('parent' => 0));     foreach($terms as $term) {             echo 'slug,$taxonomyName).'">'.$term->name.'';             $term_children = get_term_children($term->term_id,$taxonomyName);             echo '
';             foreach($term_children as $term_child_id) {                     $term_child = get_term_by('id',$term_child_id,$taxonomyName);                     echo '
name, $taxonomyName ) . '">' . $term_child->name . '
';             }             echo '
';     }     ?>


Contributors should only access home page

My site's contributors are successfully registered. However, when they log in I want them to be directed directly to the home page of the site on not to their profile, because they do not need it. Is this possible? Thank you.


Pagination is somewhat working on frontpage, doesn't update when "prev" is clicked

I followed the very simple tutorial that's on this page: http://wp.tutsplus.com/tutorials/wordpress-pagination-a-primer/ (Scroll down to "A Better Solution") - He makes it seem so simple, and it works in that the pagination links are there and the URL changes in the address bar, but it doesn't actually update when clicking on 2 or 3.. Site - chrisayreswebdev.com/besh I know I'm missing something, just not sure what. Any ideas? Thanks! EDIT: functions.php:               function paginate() {     global $wp_query;      $total_pages = $wp_query->max_num_pages;            if ($total_pages > 1){             $current_page = max(1, get_query_var('paged'));             echo paginate_links(array(               'base' => get_pagenum_link(1) . '%_%',               'format' => 'page/%#%',               'current' => $current_page,               'total' => $total_pages,          ));       }     }      index.php:                       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

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

Posted on <?php the_time('F jS, Y') ?>

<?php the_content(__('(more...)')); ?>

                 <?php endwhile; else: ?>
<?php _e("Sorry, we couldn't find the post you are looking for."); ?>
                  <?php endif; ?>             <?php paginate(); ?>


Custom Post Type Permalinks Problem

looking for some help with a permalink structure problem. I am using this code here http://pastebin.com/QfgAMkfV as a plugin with hopes of creating a structure like so /films/   /films/film-name/   /films/genre/genre-name/   /films/topic/topic-name/ This works, but I cannot display normal pages (pages not posts). I don't get a 404 error, instead I am just getting the latest post, which is coming from the index.php file. If I disable permalinks everything works fine. I have tried changing to the default theme, updating permalinks, even changed server and re-installed wordpress. Is this possible without using a plugin?


How to set up WPLANG in wp-config.php for 4 languages?

Good day! I don't know much code so I've been researching on how to modify my wp-config.php file so that the content and widgets of my site will show in the four languages (aside from English) I have on there. I don't care about translating the WP interface, just the content. The WP .mo files in the languages in question are already in the wp-content/languages folder. How would I define 4 languages in wp-config.php? Like this? define ('WPLANG', 'es_ES'); ('WPLANG', 'de_DE'); ('WPLANG', 'fr_FR'); ('WPLANG', 'ca_CA') I've been trying things out (only way for me to learn) but ended up destroying the file and having to restore it. Besides, like I said, no reliable info on the net. Cheers :)


Exlude tag (but not whole post) from related posts list

I display related posts under each post, depending on tags. The problem is, I use tag 'featured' for my top featured slider. So 'featured' tag is the most popular tag on my website. And here is the problem: under posts tagged as "featured", related posts list do not show posts with unique (specific) tags, but the newest with tag 'featured' (as the most common one). I've tried to change my loop by using 'tag__not_in', but then every post that was featured was also excluded from the list. What I want is to ignore this certain tag in 'tag__in' array, and not to exlude featured posts from the loop. I have tried to achieve this in many ways but with no success. Could you please give me a hand with this? My code looks like this:               global $post;     $orig_post = $post;          $tags = wp_get_post_tags($post->ID);     if ($tags) {         $tag_ids = array();         foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;         $args=array(             'tag__in' => $tag_ids,             'post__not_in' => array($post->ID),             'posts_per_page'=> $count,              'ignore_sticky_posts'=>1,                'post_type' => array('post','event')         );                   $my_query = new WP_Query( $args );         (...here is the loop...)     $post = $orig_post;     wp_reset_query();


Display only my own files/images in media library

I just want to let user see only their own files in media library. I have 2 questions:   1. it works great on list of media library.              add_action('pre_get_posts','users_own_attachments');      function users_own_attachments( $wp_query_obj ) {           global $current_user, $pagenow;          //echo 'pagenow='.$pagenow;            if( !is_a( $current_user, 'WP_User') )        return;            if( 'upload.php' != $pagenow )         return;            if( !current_user_can('delete_pages') )        $wp_query_obj->set('author', $current_user->id );               return;     }      But when you upload files with modal (lightbox) media libray, it shows all of files. I have an avatar uploader in you profile page (`/wp-admin/profile.php`). when I click upload from media library. it popup a modal and shows all of files even not my own files. How can I make it the popup modal to show only my files/ pictures?   1. I have an avatar uploader on front-end too. I also need to make it show only own pictures on media modal. How I could add the page? I did `echo $pagenow;` it's all `index.php`. I believe that if my 1st question has a solution then it would be fine with front end as well.


Multiple emails for same user - outdated?

I've looked at this and tried it: _(the single site solution)_ How to use same email for multiple users I've tried it, but I could not get it working. I don't know if it's because the Wordpress don't care anymore or it is the fact I'm using a plugin called Profile Builder. I've read a bit of this and what I can understand it doesn't work in version above WP 2.8 (or something like that). I'm using Wordpress 3.7. I've also tried "Alllow Multiple users"-plugin, but everyone seems to say it does not work with Wordpress>2.8 (I still had to try it! :-)) So basically - my question is: Does the above work still work (or is it outdated)?


Getting template_include to work when allow_url_include is off?

I'm working on a plugin that creates a custom post type and I would like to display a custom template without modifying the theme. Here's the simplified code I'm working with:               add_filter('template_include', 'my_custom_template');          function my_custom_template($incFile) {         global $wp;         global $wp_query;              if ($wp->query_vars['post_type'] == 'custom-post-type') {                  $incFile = MY_PLUGIN_TEMPLATES . '/template.php';              }              return $incFile;          }       The problem I'm running into is that when allow_url_include is turned off in a server's php.ini file, this throws a fun little error: **Warning:** include() [function.include]: http:// wrapper is disabled in the server configuration by allow_url_include=0 in http://path\to\wp- includes\template-loader.php on line 43 So I guess the question is, is there a way to send a template through the template_include filter without triggering this allow_url_include error? Thanks!


How to count post type that has a particular term?

What is the best method to count the number of posts in a post type that have a particular term? I don't believe `get_posts` accepts a term query and I have had no luck with `new WP_Query`, though I might be doing something wrong. Usage example:               $posts = get_posts( array(         'post_type' => 'inventory',         array(             'taxonomy' => 'status',             'terms' => 'in-stock',             'field' => 'slug'         ),     ) );     $count =  count( $posts );     echo $count;


Adding the Admin Bar to a page with a custom template

I created a stripped-down page template to use for my landing pages. But I must have cut too much out of it, because I've lost the WordPress 3.1+ Admin Bar. What functions do I need to call to get the Admin Bar to appear at the top of the page again?


Are drop-in plugins a product of design

Were drop-in plugins - when you copy a plugin directly inside a theme - a product of design. Or did the practice arise "organically".