title: Plural Category Base Slug On Category Archive Page

text: I've got a little problem with the category base slugs. Say I have got a category called 'Resources', with the category slug set to 'resource'. So any post in the category resource will appear with this kind of permalink: example.com/resource/test-post I have set the base category slug to be just the category slug. Hence, the category archive for the 'resource' category is like this: example.com/resource/ However, I want the category archive slug to be in plural form like this: example.com/resources/ Any way to achieve this? I have found nothing re. this problem on Google...


title: How to include stylesheet in custom admin using parent_slug

text: Using this code from codex:               function my_enqueue($hook) {     if( 'edit.php' != $hook )         return;     wp_enqueue_script( 'my_custom_script', plugins_url('/myscript.js', __FILE__) );     }     add_action( 'admin_enqueue_scripts', 'my_enqueue' );      this will add a custom stylesheet into wp-admin on the edit page, how can we change this so that we can use a slug from a custom admin options page which has submenus, is there a way we can use the parent menu item slug? [b]EDIT[/b]: This is how i have adapted the above code:               function auctionwp_custom_admin_style($hook) {     if( 'edit.php' != $hook )         return;     wp_enqueue_style( 'my_custom_script',  get_bloginfo( 'stylesheet_directory' ) .  '/css/custom_style.css', false, '1.0.0' );     }     add_action( 'admin_enqueue_scripts', 'auctionwp_custom_admin_style' );      what im now trying to do is change the if statement to use parent menu slug rather than edit.php thanks


title: Modifying the HTML Output of Inserted Images

text: I've used Wordpress for years. Whenever I would add an image to an article, I manually would write out all of the HTML for every image. I also used an image lightbox plugin called Highslide for people to enlarge my thumbnails. An example thumbnail that links to a larger image looks like this in my manual HTML:                     But now I've installed the latest version of Wordpress and see how easy it is to add images directly into the article without having to write any HTML out at all. The output I get is this:                     What I would like to do is modify Wordpress to add the rel="highslide" and class="highslide" automatically to the link whenever I insert a linked image so that the highslide plugin works. I guess the final result would look like this:                     I've looked through the core files but can't figure out where Wordpress generates the HTML when it inserts images. So does anyone know how to modify Wordpress to add these two attributes? I would really appreciate your help! :) Thank you!


title: get_userdata() not working in my plugin

text: i am using **get_userdata()** function in my plugin but it is not showing any values, it is showing blank result. I am able to see the value present in phpmyadmin. I am using it in a plugin **add_action('user_register','user_sf_lead')** , but it is showing any value in my code.               $user_info = get_userdata($user_id);     'Name' => $user_info->ID,     'First_Name__c' => $user_info->first_name,      I am able to get id value using **$user_info->ID** but no values for **$user_info->first_name** i getting all values of table **users** but no values from table **usermeta** I tried all possible function get_current_user_id, get_user_by, wp_get_current_user but nothing works. Below is my code               add_action( 'profile_update', 'user_sf_lead');     add_action('user_register','user_sf_lead');          // Function to store User profile in Salesforce     function user_sf_lead($user_id){          $SOAP_CLIENT_BASEDIR = plugin_dir_path(__FILE__).'Force.com-Toolkit-for-PHP/soapclient/';     require_once ($SOAP_CLIENT_BASEDIR.'/SforcePartnerClient.php');     require_once ($SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php');     require_once ('Force.com-Toolkit-for-PHP/Samples/userAuth.php');          $user_info = get_userdata($user_id);     echo "*****".$current_user->usertype;          try {       $mySforceConnection = new SforcePartnerClient();       $mySoapClient = $mySforceConnection->createConnection($SOAP_CLIENT_BASEDIR.'/partner.wsdl.xml');       $mylogin = $mySforceConnection->login("username", "password");            echo "*****".$user_info->usertype;       $fields = array (         'Name' => $user_info->ID,         'First_Name__c' => $user_info->first_name,         'Email__c' => $user_info->user_email,         'Last_Name__c' => $user_info->last_name,         'Description__c' => $current_user->usertype,         'User_Name__c' => $user_info->user_login,       );            $sObject = new SObject();       $sObject->fields = $fields;       $sObject->type = 'Capability__c';            echo "**** Creating the following:\r\n";       $upsertResponse = $mySforceConnection->upsert("name", array ($sObject));       //print_r($upsertResponse);           $ids = array();       foreach ($createResponse as $createResult) {         print_r($createResult);         array_push($ids, $createResult->id);       }          } catch (Exception $e) {         echo $mySforceConnection->getLastRequest();         echo $e->faultstring;          }      But whenever i am updating user record in wordpress , i am able to get all values. But i need them for the first when user register. **I am Using this code in my custom plugin**. Any solution??


title: How to add the author search in the default wordpress search?

text: I would like to include the author search in the default WordPress search. Is there any way of doing this? right know it retrieves all the posts with the permalinks and author names. same way i need the authors search. is it possible?


title: Include a file that has a function in it

text: I am using `include 'filename.php'` to load a php file into a template file, simply because the original PHP template file was getting huge and I wanted to split up the sections into different files for easy reference later. Include works great until I try to use a function inside the included file, then it stops working. I searched around the web and it seems like since the included file is run on the remote server (is that right?) it does not pick up my function from functions.php as if it were running normally. What is the correct way to do this? It seems I shouldn't use `include` and maybe should be using something else? Simplified code example: HTML:               <div id="section">         <?php include 'codesnippet.php'; ?>     </div>      codesnippet.php:               <ul>         <li>         <?php the_title(); ?>         </li>     </ul>      When any function is inside the included file, I get the error that the stream cannot be opened when trying to include it. The same type of error you would get if you mis-typed the filename in the include function.


title: Any idea on how to fix this error when forcing SSL on a certain page?

text: I'm in the process of forcing a few pages with forms to use SSL. After setting up the SSL, I opened up the console and begin debugging the errors. I ended up installing WordPress HTTPS plugin and force SSL in each specific pages. It did help fix a few errors except one.               [blocked] The page at 'https://www.yourdomain.com/something/' was loaded over HTTPS,      but ran insecure content from 'http://www.yourdomain.com/?mcsf_action=main_css&ver=3.8':              this content should also be loaded over HTTPS.      I'm bummed out after a few hours and research trying to get rid of the last error. The Style Sheet is from the Mail Chimp plugin. I'm also generating another error when I try to submit the Mail Chimp form:               XMLHttpRequest cannot load http://www.yourdomain.com/.      No 'Access-Control-Allow-Origin' header is present on the requested resource.      Origin 'https://www.yourdomain.com' is therefore not allowed access.       Besides these errors, in the general settings, the WordPress/Site URL is set to http://www.yourdomain.com (dummy url). If anyone could please help me, It would be greatly appreciated.


title: Using nonce external of WP Admin

text: All, I've got two wordpress pages. One wordpress page displays a form to do some registration stuff for the website. The second wordpress page actually processes the data and inserts it into a custom MySQL table that I have. I'd like to use the nonce functionality inherit to Wordpress. The user doesn't have to be a Wordpress admin or have any type of permissions to be able to do it. Can anyone give me an example or show me how to do this outside of the WP Admin in a Wordpress page? Thanks for any advice in advance!


title: Advanced Custom Fields: wp_get_attachment_url not working, attachment page says "Missing Attachment"

text: I used Advanced Custom Fields to add a file upload field to a custom post type. I have the following code in the template for this custom post type:               $file = get_field('file');     echo wp_get_attachment_url($file['id']);      But this doesn't display anything. I have verified that $file['id'] is the correct value (and have even tried hardcoding that value as the argument to `wp_get_attachment_url()`). If I use `get_attachment_link()` instead, it does output a URL. But if I then go to that URL, the resulting page says "Missing Attachment".


title: Is altering a default WordPress database table update safe?

text: I want to add some table columns to the `wp_terms` table. Is it safe to use the `dbDelta` function with a modified `CREATE`-MySQL query for this? Or will I run into problems in the long turn? Is it update safe? As a database rookie I hope someone with more experience can help me out here. ## Background For a plugin I'm currently working on, I need to add some metadata to a taxonomy term. The first thing is an ordering number and the second is the type of the term. Both are used to sort the posts in the frontend. In the WordPress codex I've found the action hooks `{taxonomy}_add_form_fields` and `{taxonomy}_edit_form_fields` for this, but unfortunately these saves the metadata in the `wp_options` table as a serialized array. It's probably possible to use the `WHERE REGEXP` syntax to query the correct option, but this seems slow and a bit hackish. Performance matters in the project (A ton of posts assigned to a ton of taxonomy terms) and therefore I'm looking for a way to sort and order the resultset directly on the database layer. Thanks in advance Roman


title: Customising rewrite rules for CPT single post URL to work as paged URL

text: I've got a CPT called `Service` registered as following:               $args = array(         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'has_archive' => false,         'rewrite' => array('slug' => 'services', 'with_front' => false),         'query_var' => true,         'capability_type' => 'post',         'hierarchical' => false,         'show_in_nav_menus' => false,         'menu_position' => 20,         'supports' => array(           'title'           'editor',           'thumbnail',           'author',           'revisions'         )     );     register_post_type('service', $args);      I have a page called "Services" that has got a custom template assigned to it that displays all of the services with their permalinks of type `services/copywriting` (where 'copywriting' is the name of the Service). So far so good. I've got another CPT called `Case Study`. Now, the `Case Studies` are connected to `Services` posts via Posts 2 Posts plugin. I'm trying to do the following: to use a single `Service` post URL of type `/services/copywriting` to display all `Case Studies` associated with that `Service`. For that purpose I've added the template redirect rule as following: so that instead of `single.php` template the `archive.php` template will be displayed.               add_action("template_redirect", 'template_redirect');     function template_redirect(){         global $wp, $wp_query;              // if Service CPT and it's a single page URL then redirect to archive.php template         if($wp->query_vars["post_type"] == "service" && is_single()){             include(TEMPLATEPATH . '/archive.php');                 exit; //thanks to @kaiser's comment         }     }      In the `archive.php` template I've got:   * a custom SQL that gets all the `Case Studies` associated with current `Service` (that I determine by looking at the URL `services/copywriting` where 'copywriting' is the current service).   * a function that creates links for pagination of type `services/copywriting/page/<page_num>` However, those links of type `services/copywriting/page/<page_num>` don't work and they always get redirected to the single `Service` URL link `services/copywriting`. Is there something I can add to re-write rules or filters or something to make the paged links work in that manner? So that `services/copywriting/page/2` will work and would be directed to `archive.php` template where my custom SQL will kick in and display the correct `Case Studies`. Do I have to have a dedicated template rather than `archive.php`? I would really appreciate any tips and help! Many thanks, Dasha    **EDIT** I've installed Rewrite Analyzer plugin. And the test for `services/copywriting/page/2` matched the following pattern:               services/([^/]+)/page/?([0-9]{1,})/?$       with the following substitution:               service: copywriting     paged: 2      I've no idea what it means though :(    **EDIT 2** OK, I've tried adding a rewrite rule as following in the `functions.php`:               add_action('init', 'my_rewrite_add_rewrites');     function my_rewrite_add_rewrites(){              //rewrite rule for Service single post, make it work as paged         add_rewrite_rule(             '^services/(.+?)/?(page/([0-9]+))?/?$',             'index.php?post_type=service&service=$matches[1]&paged=$matches[3]',             'top'         );     }      I've flushed the rewrite rules. However, when I go to URL of type `services/copywriting/page/2` it always just displays the URL without the page bit `services/copywriting/`. I can't figure out what's wrong. Is my regexp wrong or the `index.php` construction or both? I would really appreciate any help!


title: Multisite installation combining subdomains and subdirectories

text: I need to create a complex WordPress-powered set up, which I would like to run from a single code base. My setup is complicated by a number of factors. First of all I already have software running the site's homepage, so I cannot install WordPress in the root of the domain.               example.com // <- site powered by a non-WordPress engine      To this, I would like to add a multisite installation running in a sub- directory structure:               example.com/multisite/      // <- multi-site installation of WordPress     example.com/multisite/site1     example.com/multisite/site2     (...)      So far, this is easily done. The complexity arises when I want to also power some sub-domains with this WordPress installation:               site3.example.com   // <- subdomain sites I would also like to power with WordPress     site4.example.com     (...)      I would be grateful if anyone could tell me if this is possible or not. If it is possible, have you managed to get something like this up and running? What's the right way to go about this? Are additional plugins helpful? I will appreciate any help.


title: Content over 10,000 characters won't display with the_content()

text: A friend of mine just noticed that their site wasn't displaying pages that had a lot of content. For some reason they are just blank, and if he removes some content from the page it will display again. The 10,000 character mark seems to be the threshold - anything above and it goes blank. I played with his templates and noticed that the content would be displayed if I used `echo get_the_content()` rather than `the_content()`, but then he loses the auto-formatting. Has anyone run into this issue before? I've googled around and searched this site but haven't been able to find anything. Thanks in advance for any light you can shed on this!


title: get_option('sticky_posts') returns stickies that are in trash

text: The value of get_option('sticky_posts') includes those that are in the trash. How can I get a value minus stickies that are in the trash?               var $stickies = count(get_option('sticky_posts'));


title: How to show a popular post in wordpress in last 24 hours?

text:
I have the query_post on my codes. This will display the popular post of all time. But I want to dispaly the popular post in past 24 hours. How do I do that?               <?php query_posts('orderby=comment_count&order=DESC&paged=' . get_query_var('paged'));?>      I have seen many answer here related to this topic, But not exactly this code. Following is my full code.               <?php     /*     Template Name: try     */     ?>     <?php get_header(); ?>

Blog Archieves

             <?php if ( ! dynamic_sidebar( 'Alert' ) ) : ?>                              <?php endif ?>
                <?php query_posts('showposts=15&orderby=comment_count&order=DESC&paged=' . get_query_var('paged'));?>       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

                         <?php if(has_post_thumbnail()) :?>
                                 <?php the_post_thumbnail(); ?>
                         <?php endif; ?>
                          <?php the_excerpt(); ?>

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

                             <?php the_category(', ') ?>

                            <?php echo get_the_date(); ?>at<?php echo get_the_time(); ?>
                      <?php if(function_exists(kkLikeButton())){kkLikeButton();}?>

                     <?php endwhile; else: ?>

<?php _e('There has been an error.'); ?>

<?php _e('We apologize for any inconvenience, please hit back on your browser or use the search form below.'); ?>
                 <?php get_search_form(); /* outputs the default Wordpress search form */ ?>
             <?php endif; ?>

<?php next_posts_link('« Older Entries') ?>

<?php previous_posts_link('Newer Entries »') ?>

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


title: How to retrive the text : No movie by this actor

text:
Hy, im building a cinema site, in movie page i have a Custom Field that link's the actor page, when i add a movie and i link the actor, on the actor page i get the movie, now the problem is how can i add in this code the text "No movie by this actor", if no movie is selected i want to retrive automate That Text. To retrive the movies i have this code.               <?php      //create new loop query for films by this actor     $movies = $wpdb->get_col("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'distributie' AND meta_value LIKE '%".get_the_ID()."%'");     $the_query = new WP_Query( array( 'post__in' => $movies) );               // The Loop     while ( $the_query->have_posts() ) : $the_query->the_post();         echo '
';         ?>         <img class="actor-img" src="/scripts/timthumb.php?src=<?php the_field('img'); ?>&h=110&w=75&zc=1" alt="<?php the_title(); ?>"  title="<?php the_title(); ?>"/>              <?php the_title();         echo '
';     endwhile;          // Reset Post Data     wp_reset_postdata();     ?>      Anny help would be apreciate. Thanks in advance!


title: How to choose email recipient in Contact Form 7 based on address state input in form and save to database

text: Using Contact Form 7 **Situation** When a visitor fills out a form on the website, they enter:   * Name   * Email   * Phone   * Address (Street, City, State, Zip Code)   * Message I need to save this information to the database for future reference and I need to send an email to a central email address and to a specific email address, which changes depending upon the state of the visitor. Basically, salespeople have territories and contacts from the website need to be sent to the main website email address as well as the person in charge of the territory. Not all states have an assigned salesperson. **Steps Taken** I installed Contact Form DB to save all submissions to the database. I am using the method described on the Contact Form 7 website to select the recipient - Selectable Recipient with Pipes. I am using the state name as the selectable dropdown and the salesperson's email address following the pipe.               [select* state      "Alabama|john@example.com"     "Alaska"     "Arizona|john@example.com"     "Arkansas|mary@example.com"     "California|mary@example.com"     "Colorado"     ]      I set up CF7's "Mail" to send to the website's central email address and to the salesperson's email address who operates in the selected state.               central@example.com,[state]      **The Problems** When a visitor selects a state that has an assigned salesperson, the salesperson's email address is entered into the database, not the state. When a visitor selects a state name that does not have a designated salesperson, the state name is entered into the database, but no email is sent. I also tried setting up "Mail" to send to `central@example.com` and "Mail (2)" to send to `[state]` (salesperson's email address), however no email was sent to `central@example.com` when an email address was not provided for the state name in the dropdown. Lastly, I tried entering the state name in this format - `"Alaska|"`. In this case, nothing was entered into the database for `state` and no email was sent. I tested this using both of the "Mail" options listed above. **The Solution?** Now, I understand, I can simply enter `central@example.com` for all state names without a designated salesperson - and that's fine. The problem with this - the email address is still entered into the database for `state`. I imagine I need a way to take the state name ([_raw_state]) and pass it into a hidden CF7 field, so it can be saved to the database, but I cannot seem to figure out how.


title: Correct check for any admin page with editor

text: I have read the codex, but found it a bit incomplete. I like to load stuff only on pages where the post editor is visible. This should include custom post types and everything. I am a bit insure about the `get_current_screen()` Object. When to use `base`, `parent_base` ... Would this be the right check? Tested it on pages and posts and seem to be working. Just asking because I am curious if I could to this better.               $screen = get_current_screen();          if ( 'post' == $screen->base || 'page' == $screen->base ) {     // Load stuff     }


title: How to add a post without assigning to a category?

text: Can any one please explain how to add a post in WordPress without assigning it to any category. Actually I want to display some news or some quick information. So, it does not come to any category in my blog. In this type of time, I do not want to assign to any category. for example, http://www.someSiteURL.com/this-is-news-about-something-awesome/ http://www.someSiteURL.com/wordpress-themes/Anan-wordpress-theme-review/ The first url is what i want to have. But by default, it automatically add "uncategorized". My permalink structure is "/%category%/%postname%/" and I use Yoast to hide the word "category" in the urls. Any one can help on this situation please? And kindly i would like to let you know that, I do not want to add page for such things. Also, I do not want to add categories like "news" or "info" for this. Thanks for your time,


title: detect the language a post is written in

text: Is there any way to evaluate the language a post/page is written in? I am building a multilingual site and am almost pulling my hair out trying to get the front-end navigation to take the chosen language into account. So far the polylang plugin http://wordpress.org/extend/plugins/polylang/ has worked fine for everything else.


title: Unable to pass variable on theme cusomizer add_settings()

text: I have theme options saved as serialized data. And I have named the option name by getting theme name.               $theme = wp_get_theme();     $settings = sanitize_title($theme).'-options'; // do not change!      But when I am trying to pass the $settings variable with or without concatenation. It ends up with this fatal error.               Fatal error: Call to a member function check_capabilities() on a non-object in C:\Users\SISIR\Dropbox\wamp\www\l\wp-includes\class-wp-customize-control.php on line 160      Check the `$settings.'[skin']` section which doesn't work but when I replace that part of the code with `'lead_capture_theme_option[skin]'`, it works. The fatal error itself is also puzzling.                   add_action( 'customize_register', 'lead_capture_theme_customize_register', 11 );              function lead_capture_theme_customize_register($wp_customize) {                  $theme = wp_get_theme();             $settings = sanitize_title($theme).'-options'; // do not change!         //  var_dump($settings);                  $wp_customize->add_section( 'lead_cap_color_scheme', array(                                             'title'          => __( 'Color Scheme', 'themename' ),             'priority'       => 35             )         );                  $wp_customize->add_setting( $settings.'[skin]', array(                                              'default'        => 'light',             'type'           => 'theme_mod',             'capability'     => 'edit_theme_options'                                            )         );                  $wp_customize->add_control( 'lead_capture_theme_option[skin]', array(                                               'label'        => 'Select a Color Scheme',             'type'           => 'select',             'choices' => array('default', 'custom'),             'section' => 'lead_cap_color_scheme',             'settings' => 'lead_capture_theme_option[skin]'         )     );                                                     $wp_customize->add_setting( 'lead_capture_theme_option[logo]', array(                     'type'           => 'theme_mod',                     'capability'     => 'edit_theme_options'                     )             );              $wp_customize->add_control(                                                                      new WP_Customize_Image_Control( $wp_customize, 'lead_capture_theme_option[logo]', array(                         'label'   => 'Upload Logo',                         'section' => 'lead_cap_color_scheme'                         )                         )                                                         );                                                   }


title: Echo the featured image of page assigned to blog in index.php

text: I have my posts page set to a page named Blog. This is set to use the Template: Default template. So index.php is rendering this page. I want to be able to set the Featured image of this page I've called Blog and have this output at the top of the blog posts page on my site. For every other page on my site I am able to acheive this with               <div style="background-image: url('<?php echo $featured_src[0]; ?>');">      Does anyone have any idea why the featued image would work for page.php but not index.php?


title: twenty thirteen header size

text: I am new to wordpress so I am really sorry for asking such silly question. I just want to know that where is the css of header image. I checked in style.css but there is no css of header image. Please help. Thanks


title: What's the policy for building a theme that doesn't support widgets/menus?

text: I'm developing a minimalistic theme, and my plan is not to include menus or widgets in it. The Theme Review page on wordpress.org states: > Whether implementing required, recommended, or optional features, Themes are > required to support proper WordPress core implementation of all included > features. This is quite fuzzy for me. Does this mean I have to include all WordPress core features? What's considered a core feature? Are Widgets and Menus core features?


title: Count all comments of a custom post type

text: I know how to count comment per post, user and in total but i am   having problems getting **the total amount of comments post in a specific post type**. I guess i can loop trough all the posts and count each one   comments but i am looking for something faster and less   resource expensive Appreciate your help **I got this so far (i think this is a bad way but i might be wrong):**               /*** ALL COMMENTS COUNT BY POST TYPE ***/     function countCptCommentsTotal() {              // FAQ ARGS         $faqStatsArgs = array(             'post_type'         =>  'some_post_type',             'post_status'       =>  'publish',             'posts_per_page'    =>  -1         );         $faqstats_query = new WP_Query($faqStatsArgs);              // THE LOOP         $allAnswers = 0;         while ($faqstats_query->have_posts()) {             $faqstats_query->the_post();                  $curfaqid       =   get_the_ID();             $allAnswers =   $allAnswers + countPostComments($curfaqid);              }              wp_reset_query();         return $allAnswers;     }


title: Pagination on custom post type not working if permalinks set to rewrite url

text: When rewriting the url like this: .../%postname%/ This is the relevant part of my post type registration arguments:               'rewrite' => array( 'slug' => 'haendler', 'with_front' => false )      My pagination on the custom post type does not work. The pagination is there but when I click on page two the link `http://www.example.com/%postname%/page/2` always changes back to `http://www.example.com/%postname%/` If I disable permalinks to the default querystring style pagination is fine. What can be the reason for the url automatically removing the `page/2` value? Thanks in advance


title: No subfolder for posts on Multi Sites

text: I suspect the answer is no, but I thought I'd double check. I'm in the process of converting a WordPress blog into a string of Multi Sites where each site represents a category of posts in the original blog. I know you have to have a subfolder or subdomain for each Multi Site, e.g. www.domain.com/multisite, but is it possible to remove this for posts so that all posts on all Multi Sites have the format www.domain.com/this-is-a-post- could-be-on-any-multi-site I need the posts to still technically belong to their respective Multi Site because I'm using plugins for each to tweet to their own separate Twitter account and display that feed as a widget.


title: How to create manually a fancybox gallery?

text:
premise i don't really know anything about wordpress framework, i only know how to use it. I need to change an already exists gallery with loooots of images, with a simple gallery like fancybox (the plugin..). The older programmer built a page with wp native functions, but i really don't know how to move there. I've installed the plugin (fancybox) by adding it with the tools "add plugin" in the backend, but now i need to edit an existing page called "taxonomy-lookbook-cat.php", and here's the source code of it:               <?php     /*     Template Name: Lookbook     */     ?>          <?php get_header(); ?>

                             <?php $cat = get_query_var('lookbook-cat'); ?>                                   <?php $catargs = array(                                      'orderby'            => 'name',                                 'order'              => 'ASC',                                 'style'              => 'list',                                 'show_count'         => 0,                                 'hide_empty'         => 0,                                 'use_desc_for_title' => 0,                                 'title_li'           => __( '' ),                                 'echo'               => 0,                                 'taxonomy'           => 'lookbook-cat',                                 'walker'             => null                             ); ?>

<?php echo wp_list_categories( $catargs ); ?>

                             <?php                                      $args = array(                                     'post_type' => 'lookbook',                                     'order'     => 'ASC',                                     'lookbook-cat'      => $cat,                                  );                                      $items_small = new WP_Query($args);                             ?>                             <?php   if( $items_small->have_posts()): ?>

                             <?php while( $items_small->have_posts() ) : $items_small->the_post(); ?>                                 <li id="small-<?php the_ID(); ?>">                                     <?php the_post_thumbnail( 'carousel-small' ); ?>
                             <?php endwhile; ?>

                                  <?php else: ?>                                     Oh ohm no products!                             <?php endif; ?>                             <?php wp_reset_query(); ?>                                       <?php                                      $items_big = new WP_Query( $args );                             ?>                             <?php   if( $items_big->have_posts() ): ?>

                             <?php $counter = -1; ?>                                  <?php while( $items_big->have_posts() ) : $items_big->the_post(); ?>                                 <?php $counter++; ?>                                     <li id="big-<?php the_ID(); ?>">                                     <?php                                           $attributes = array(                                             'id'    => 'img-' . $counter,                                         );                                     ?>                                     <?php the_post_thumbnail( 'carousel-big', $attributes); ?>
<?php the_content(); ?>

                             <?php endwhile; ?>

                                                               <?php else: ?>                                     Oh ohm no products!                             <?php endif; ?>

                              <div class="fb-like" data-href="<?php echo bloginfo('url') . $_SERVER["REQUEST_URI"]; ?>" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false">

           <?php get_footer(); ?>      it is divided in "two gallery" a big and a small. I need to rewrite that page and in a while or a foreach cicle it should show something like this:

      Thanks for the support, i need it!


title: Why does Wordpress redirect when I separate wp-core and wp-content?

text: I'm trying to setup my Wordpress projects so that I can have `http://www.example.com/` as my site URL, say mapped to `/var/www/vhosts/www.example.com/` and in there, I would like to use the following structure:               /var/www/vhosts/www.example.com/wp-core/     /var/www/vhosts/www.example.com/wp-content/     /var/www/vhosts/www.example.com/wp-config.php      I would like `wp-core/` to contain the Wordpress core installation as an `svn:external` and with `wp-content` and `wp-config.php` stored in my SVN repo, containing themes, config, etc. for each site. The following article appears to explain how to go about setting the above structure up: http://codex.wordpress.org/Installing_WordPress_With_Clean_Subversion_Repositories However, I'm hitting an issue where the site loads up correctly, reads it's config from the `wp-config.php` file above `wp-core` as intended, however when I attempt to log in, Wordpress redirects the request from `http://www.example.com/wp-login.php` to `http://www.example.com/wp- login.php/` - note the trailing slash. Here's a confirmation of the extra lines in `wp-config.php` I've added for this:               define('WP_CONTENT_DIR', dirname(__FILE__) . '/wp-content');     define('WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-content' );      Here's the relevant rows from `wp_options` in my DB:               SELECT option_name,option_value FROM wp_options WHERE option_name = 'home';     home,http://www.example.com          SELECT option_name,option_value FROM wp_options WHERE option_name = 'site url';     siteurl,http://www.example.com      Here's my .htaccess:               # BEGIN WordPress     <IfModule mod_rewrite.c>         # Hey-ho let's go!         RewriteEngine On         # Base is the URL path of the home directory         RewriteBase /         # Base goes to WordPress         RewriteRule ^$ /wp-core/index.php [L]         # Skip real files and directories         RewriteCond %{REQUEST_FILENAME} !-f         RewriteCond %{REQUEST_FILENAME} !-d         # Otherwise send it to WordPress         RewriteRule .* /wp-core/index.php [L]     </IfModule>     # END WordPress      Tracing this in Chrome, I can see that a `HTTP 301` from the correct address to the address with the trailing slash is returned by the server, so it would point to the `.htaccess` above, however the first line of the following excerpt contradicts this somewhat:               127.0.0.1 - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (2) init rewrite engine with requested uri /wp-login.php/     127.0.0.1 - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (1) pass through /wp-login.php/     127.0.0.1 - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (3) [perdir /Users/joe/tmp/example.com/trunk-new/] add path info postfix: /Users/joe/tmp/example.com/trunk-new/wp-login.php -> /Users/joe/tmp/example.com/trunk-new/wp-login.php/     127.0.0.1 - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (3) [perdir /Users/joe/tmp/example.com/trunk-new/] strip per-dir prefix: /Users/joe/tmp/example.com/trunk-new/wp-login.php/ -> wp-login.php/     127.0.0.1 - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (3) [perdir /Users/joe/tmp/example.com/trunk-new/] applying pattern '^$' to uri 'wp-login.php/'     127.0.0.1 - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (3) [perdir /Users/joe/tmp/example.com/trunk-new/] add path info postfix: /Users/joe/tmp/example.com/trunk-new/wp-login.php -> /Users/joe/tmp/example.com/trunk-new/wp-login.php/     127.0.0.1 - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (3) [perdir /Users/joe/tmp/example.com/trunk-new/] strip per-dir prefix: /Users/joe/tmp/example.com/trunk-new/wp-login.php/ -> wp-login.php/     127.0.0.1 - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (3) [perdir /Users/joe/tmp/example.com/trunk-new/] applying pattern '.*' to uri 'wp-login.php/'     127.0.0.1 - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (2) [perdir /Users/joe/tmp/example.com/trunk-new/] rewrite 'wp-login.php/' -> '/wp-core/index.php'      Specifically: `requested uri /wp-login.php/` indicates that Apache receives a request for `/wp-login.php/` and not `wp-login.php` and `mod_rewrite` passes through the request. Can anyone offer any suggestions on how I can set this up so that I can have WP core files in one directory in the doc root and `wp-config/` alongside the WP core directory?


title: Custom Download Link

text: How can I set up wordpress to recognize               www.example.com/wp-content/uploads/2010/12/history.pdf      as something like               www.example.com/about/pdf-download/      I also want the user not to see the actual link but the new one.


title: Are page/post IDs unique across a whole network?

text: If I have a page with ID 123, I know my template file `page-123.php` will be called to render it, but if my theme is used across a network, could a page in a different site _also_ have ID 123? I assume, if so, that I'll need to sniff `$current_site` and requiring an alternate template file if it's not the site I'm targeting. I already assume slugs aren't unique across a network.


title: Make blogroll links no-follow?

text: How can I add a nofollow option to my blogroll links editor? Attempted to just type "nofollow" into the "rel" input box, but its auto deleted onblur. If I turn javascript off (thanks to Matt's suggestion below), It works, but when I check the source on my site, the rel attribute looks like this... rel="nofollow"onclick="javascript:pageTracker._trackPageview('/outbound/blogroll/www.site.com');


title: Jquery based image accordian plugin

text: I found a image accorian menu plugin based on mootools farework. Please suggest if any based on jquery framework.


title: Load custom post type in a different WordPress installation

text: I am trying to display a list of posts (custom post types) coming from a different WordPress installation (to make things more clear, my client wants has two separate sites, and they want to list their listings on both sites, but only add them once). I have tried to implement this with PHP/MySQL and I am able to grab the post title, content, ID and date from specific custom post type, however all the added fields are stored in *wp_postmeta* under the field '*meta_key*', so as you can imagine this will be nightmare to sort out. I was hoping someone has a quicker and easier solution to displaying full date of any given post on a different WordPress installation.


title: How to paginate a list of child pages

text:
I am using the following code to list the child pages of the current page being viewed. But it only outputs the last 5 child pages; i want it to list all pages in blocks of 5 with "next" and "previous" links. Such as it works on normal posts. The code I am using is the following:               <?php      $ancestors = array();     $ancestors = get_ancestors($post->ID,'page');     $parent = (!empty($ancestors)) ? array_pop($ancestors) : $post->ID;     if (!empty($parent)) {       $kids = new WP_Query(         array(           'post_parent'=>$parent,           'post_type' => 'page',           'ignore_sticky_posts' => true         )       );       if ($kids->have_posts()) {         while ($kids->have_posts()) {           $kids->the_post();           echo '
' . '
' . '' . get_the_post_thumbnail() . '' . '' . '' . get_the_title() . '' . '
';           echo '
';           echo the_field("info_add");             echo '
';           echo '

';         }       }     }     ?>      The page in question is this one: http://dedos.info/flavioc/trabalhos/ Now I'm wondering if I should have used Custom Post Types to manage this but now it's too late. Any help will be appreciated, thanks.


title: BuddyPress | How to merge the "setting" & "profile" pages into one page?

text: In BuddyPress I would like to merge the _register.php_ and _setting.php_ files into one " _register.php_ ".   Is that possible? I don't want to change my Name, City and Address then go to the _setting page_ to change email and password again.   Thanks for your answers :)


title: Is there a WordPress widget for my webpage?

text: I'd like to show a summary of my recent posts on my homepage. (Like the headlines and perhaps a few lines of text.) My site is _not_ running on WordPress. Is there a code snippet for that? **Edit:** When I said "widget", I didn't mean it in the WordPress sense. I meant a code snippet.


title: Allow user to select a theme to install when they signup

text: Is it possible to allow a user to select which theme they would like installed from the new site signup page? And once the site is created, it obviously installs whichever theme they chose. I found wp_get_themes. Is this how you would go about pre-populating a dropdown menu with all the available themes? How do you pass the theme's information to the actual signup process so the site is created with the correct theme? If someone knows how to do this with Gravity Forms, that would be great also. _**Update:_** Here's what I have so far, it doesn't take into account child themes, will work on that after This function will output a list of themes with radio buttons, storing the selected theme in $_POST['custom_theme']               /**     * Show list of themes at bottom of wp-signup.php (multisite)     */     function 70169_add_signup_extra_fields() { ?>          Themes<br />     <?php     $themes = wp_get_themes();          foreach ( $themes as $theme ) {         $theme_name = $theme['Name'];         $theme_stylesheet = $theme->stylesheet;     ?>         <label>             <input id="<?php echo $theme_stylesheet; ?>" type="radio" <?php if ( isset( $_POST['custom_theme'] ) ) checked( $_POST['custom_theme'], $theme_stylesheet ); ?> name="custom_theme" value="<?php echo $theme_stylesheet; ?>" ><?php echo $theme_name; ?>         </label>          <?php } ?>          <?php }     add_action( 'signup_extra_fields', '70169_add_signup_extra_fields' );      I thought I'd add a hidden field as a way to pass the theme's value onto the site creation. There's something wrong with this though - at the last step it loses it's value, not sure why yet.               /**      * Add a hidden field with the theme's value      */     function 70169_theme_hidden_fields() { ?>          <?php         $theme = isset( $_POST['custom_theme'] ) ? $_POST['custom_theme'] : null;     ?>     <input type="hidden" name="user_theme" value="<?php echo $theme; ?>" />     <?php }     add_action( 'signup_hidden_fields', '70169_theme_hidden_fields' );      And finally a function to pass the theme name to the newly created site. This works if I hardcode the variables, but I'm unable to pass the value of the custom_theme yet. The site gets created fine but the template and stylesheet options are blank. It's just not getting the value no matter what I try. I guess I have to use $_GET to access the hidden field I created earlier. Again, all I want to do at this point is pass the same theme name to the template and stylesheet options, I'll figure out how to differentiate them after I get it working.               /**           * Create the new site with the theme name     */     function 70169_wpmu_new_blog( $blog_id ) {          // need to get this working, use $_GET?     //    $theme = ???              update_blog_option( $blog_id, 'template', $theme );  // $theme works if I hardcode it with a theme name         update_blog_option( $blog_id, 'stylesheet', $theme );     }          add_action( 'wpmu_new_blog', '70169_wpmu_new_blog' );


title: Run a php function if a predefined page is visited

text: I use the CubePoints plugin that rewards users with 1000 points via the following function:               if( function_exists(‘cp_alterPoints’) && is_user_logged_in() ){         cp_alterPoints(cp_currentUser(), 1000);     }      Now, I would like to reward a user 1000 points for viewing one specific custom page that I created with with a page template.   Lets call it landingpage.php and the post ID of this page is 24122. Is there any way to accomplish this?   Something like "if is page landingpage" (or "if is post=24122"), then perform the above function.


title: 404 Issue w/ Custom Post Type - using Meta for Permalink rewrite

text: I'm trying to rewrite my permalinks using meta data from my post. The permalink rewrite works- but I'm getting the 404 issue when I try to view the post. I've flushed by visiting the permalink settings page, and still no dice. Could someone offer a clue as to why this wouldn't work?               add_filter('post_type_link','calendar_link_filter',1,3);          function calendar_link_filter( $post_link, $id = 0, $leavename = FALSE ) {         $post = get_post($id);         if($post->post_type != 'super_duper') {                 return $post_link;         }         $date = get_post_meta($post->ID,'event_start_date',true);         $date = strtotime($date);         $str = $post_link;         $str = str_replace('%cal_year%',date("Y",$date),$str);         $str = str_replace('%cal_month%',date("m",$date),$str);         $str = str_replace('%cal_day%',date("d",$date),$str);         return $str;          }               add_action( 'init', 'create_my_post_types' );          function create_my_post_types() {     register_post_type( 'super_duper',         array(             'labels' => array(                 'name' => __( 'Super Dupers' ),                 'singular_name' => __( 'Super Duper' )             ),             'hierarchical' => false,             'show_ui' => true, // UI in admin panel             'publicly_queryable' => true,             'rewrite' => true,             'public' => true,             'rewrite' => array('slug' => 'events8/%cal_year%/%cal_month%/%cal_day%'),                   )     );     flush_rewrite_rules();     }


title: WordPress Custom Post Type Navigation + Children

text: UPDATED: 5/08/2010 WordPress has now added an additional technique to display the items from a custom post-type if the post-type is set to Hierarchical. What I would like to do though is make it so the post items have the .current_page_item class when selected in the navigation. Does anyone know of a function to achieve this?                   <?php          $args = array(           'post_type'=>'testimonials',           'title_li'=> __('Testimonials')         );         wp_list_pages( $args );          ?>       Thanks, George


title: Seperating custom post type comments from regular blog posts comments

text:
I have a custom post type (gs_index) with commments enabled, and would like to display a list of recent comments only from that particular post type (outside of the loop) I would also like to display the standard blog posts' comments without the comments from the custom post type. Here is the code I am currently using
       <?php         $comments = get_comments('number=10&status=approve');         $true_comment_count = 0;         foreach($comments as $comment) :       ?>            <?php $comment_type = get_comment_type(); ?>       <?php if($comment_type == 'comment') { ?>         <?php $true_comment_count = $true_comment_count +1; ?>         <?php $comm_title = get_the_title($comment->comment_post_ID);?>       <?php $comm_link = get_comment_link($comment->comment_ID);?>       <?php $comm_comm_temp = get_comment($comment->comment_ID,ARRAY_A);?>       <?php $comm_content = $comm_comm_temp['comment_content'];?>
                        <?php echo($comment->comment_author)?>            on            <a href="<?php echo($comm_link)?>" title="<?php echo $comm_title?>">             <?php echo $comm_title?>
             <?php } ?>       <?php if($true_comment_count == 5) {break;} ?>       <?php endforeach;?>


title: How to query two meta fields and display results between them

text: I am making a search form that searches for posts within two meta box values and display results between them. I have this set               $prefix = 'ghes_'; // start with an underscore to hide fields from custom fields list     add_filter( 'ghes_meta_boxes', 'ghes_sample_metaboxes' );     function ghes_sample_metaboxes( $meta_boxes ) {         global $prefix;         $meta_boxes[] = array(             'id' => 'event_meta',             'title' => 'Event Metabox',             'pages' => array('event'), // post type             'context' => 'normal',             'priority' => 'high',             'show_names' => true, // Show field names on the left             'fields' => array(                  array(                     'name' => 'Event Start Date',                     'desc' => 'field description (optional)',                     'id' => $prefix . 'event_start_timestamp',                     'type' => 'text_date_timestamp'                 ),                                   array(                     'name' => 'Event End Date',                     'desc' => 'field description (optional)',                     'id' => $prefix . 'event_end_timestamp',                     'type' => 'text_date_timestamp'                 )                         How will the query look like if I want to search for posts between the "Event Start Date" and the "Event End Date". Thanks.


title: preg_replace not removed "class"

text: Use this code to remove the label "class" of the images, but does not work. The label does not disappear in the new post.               function the_post_thumbnail_remove_class($output) {             $output = preg_replace('/class=".*?"/', '', $output);             return $output;     }     add_filter('post_thumbnail_html', 'the_post_thumbnail_remove_class');      It only works on the main page with highlighted images(thumbnail).


title: str_replace not responding in functions.php

text: I'm tring to use `str_replace` within a wordpress function but its not working. My code:               function fields($content) {         if(is_feed()) {           $post_id = get_the_ID();         $url = str_replace('http://', '', '' . get_post_meta($post_id, 'book-author', true) . '');          $output = '<div>';         $output .= '' .url. '';         $output .= '</div>';         $content = $content.$output;           }           return $content;       }     add_filter('the_content','fields');      What I'm getting in result of `' .url. '` is just "url" printed in my feed. Please help. Thank you.


title: Fast way to copy a Blog x to another domain/server without deleting it

text: Let's say I have a Wordpress blog named **X** , and I want another blog **Y** What is the best way to have the exact same copy of **X** on another domain, so I can create my **Y** blog with the same plugins, themes, without having to download them again from the WordPress admin panel. What I've found is :   * Either copying the whole wp folder and upload it to the other domains server.   * Or using some plugins, but I don't really know which one and if it's a good practice. So is there a good practice to copy a Blog **X** to another domain/server without deleting it.It's not really a migration as I don't want to migrate, just copying it **X** and it's themes, plugins on **Y**


title: Why does get_post_status display published when attachment is in trash?

text: Is there a reason why using get_post_status() on an attachment page returns 'published' when the media item is actually in the trash? I'm trying to figure out if this is a bug or if not how to display the status of the attachment. Thanks!


title: get_option() fails to return binary result

text: For some reason, `get_option()` started to fail when returning binary results when I moved my website from localhost to the web server. I migrated my WordPress using an upload of the files on the FTP Everything else works perfectly however. Even the `wp-admin` works right: I can edit, post, etc. It's just a single line of code that is giving me the blues. It comes from a theme I'm using, but there is no theme-specific behavior: it crashes way before that. That line of code tries to do this:               $sqbtn_1 = unserialize(get_option('magaling_ads_468060_1')); //returns null.     $sqbtn_1 = $sqbtn_1->is_empty() ? $ad_def : $sqbtn_1;  //CRASHES: is_empty on a non-object.      If I create a simple PHP file, I can prove myself that the data comes correctly from MySQL. I have the 'magaling_ads_468060_1' field in my WordPress options table and here is what it contains:               mysql_query('SET NAMES utf8');     $result = mysql_query("select * from wp_options WHERE option_name = 'magaling_ads_468060_1'");     //prints out the following value of the option_value field:     s:376:"O:18:"Padd_Advertisement":5:{s:27:"Padd_Advertisementimg_url";s:88:"http://www.echysttas.org/wp-content/themes/magaling/images/advertisement-468x060_1.jpg";s:28:"Padd_Advertisementalt_desc";s:15:"Axonn Echysttas";s:27:"Padd_Advertisementweb_url";s:24:"http://www.echysttas.org";s:26:"Padd_Advertisementtarget";s:4:"_new";s:29:"Padd_Advertisementcss_class";s:0:"";}";      So the MySQL returns the data! However, get_option returns **nothing**. I echo-ed it and it's empty. On the other side...               get_option('magaling_installed'); //works and returns "1"      Everything else works fine, even returning other theme-specific (integer or string) values.               var_dump( get_option('magaling_ads_468060_1') ); //shows bool(false)      var_dump( get_option('magaling_installed') ); //shows string(1) "1"      var_dump( get_option('blogname') ); //string(9) "Echysttas"


title: StackExchange-like flag system for WordPress

text: Is there a plug-in that can incorporate a StackExchange-like flag system on a WordPress blog? Then registered users can flag an article/post so that the admin or moderator can review the post later and decide whether the post should be published or not.


title: Of thumbnails and folder permissions

text: I am trying to make TimThumb work on my domain. After having tried and tested every step on this troubleshooting guide, it finally came down to folder permissions. The thumbnail cache is owned by my `accountname`, while the processes trying to access the folder (i.e. WordPress) are `nobody`. The solution suggested by the author of the linked post is to `chown` the folder to nobody. What are the implications of this? Will it affect how WordPress works or my FTP?


title: intellisense in wp search

text: Is it possible to bring intellisense (autocomplete) in the search box of the website????


title: List a current posts' taxonomy terms in a widget in Wordpress

text: I would very much like to know if there is a widget that exists that would let me show the current page's associated taxonomy terms (preferably hierarchically) in a widget. For example, if the current post has a Taxonomy term "Tom Hanks" in the Taxonomy of "Actor", the widget would list "Actor" then "Tom Hanks". Even though there are many other actors in the taxonomy of "Actors", only the ones from the current page, are listed.


title: How to display custom message for (Genesis) featured posts if no posts

text:
I'm using the Genesis Framework, and the custom post types featured post widget (code below). I need to display a custom error message for a particular post type if there are no post present for that post type. Currently, the plugin displays nothing if there are no post, but still displays the widget title. I don't know where to begin.               <?php     /**      * Genesis Featured Custom Post Type Widget      *      * @package GenesisFeaturedCustomPostTypeWidget      * @author  StudioPress      * @author  Jo Waltham      * @license GPL-2.0+      *      */           /**      * Register Genesis Featured Custom Post Type Widget      *       * @package GenesisFeaturedCustomPostTypeWidget      * @author  StudioPress      * @author  Jo Waltham      */           /**     * Please note that most of this code is from the Genesis Featured Post Widget included in the Genesis Framework.     * I have just added support for Custom Post Types     */               class Genesis_Featured_Custom_Post_Type extends WP_Widget {              /**          * Holds widget settings defaults, populated in constructor.          *          * @var array          */         protected $defaults;              /**          * Constructor. Set the default widget options and create widget.          *          * @since 0.1.8          */         function __construct() {                  $this->defaults = array(                 'title'                   => '',                     'post_type'               => 'post',                 'posts_cat'               => '',                 'posts_num'               => 1,                 'posts_offset'            => 0,                 'orderby'                 => '',                 'order'                   => '',                 'exclude_displayed'       => 0,                 'show_image'              => 0,                 'image_alignment'         => '',                 'image_size'              => '',                 'show_gravatar'           => 0,                 'gravatar_alignment'      => '',                 'gravatar_size'           => '',                 'show_title'              => 0,                 'show_byline'             => 0,                 'post_info'               => '[post_date] ' . __( 'By', 'genesis-featured-custom-post-type-widget' ) . ' [post_author_posts_link] [post_comments]',                 'show_content'            => 'excerpt',                 'content_limit'           => '',                 'more_text'               => __( '[Read More...]', 'genesis-featured-custom-post-type-widget' ),                 'extra_num'               => '',                 'extra_title'             => '',                 'more_from_category'      => '',                 'more_from_category_text' => __( 'More Posts from this Category', 'genesis-featured-custom-post-type-widget' ),             );                  $widget_ops = array(                 'classname'   => 'featured-content featuredpost',                 'description' => __( 'Displays featured custom post types with thumbnails', 'genesis-featured-custom-post-type-widget' ),             );                  $control_ops = array(                 'id_base' => 'featured-custom-post-type',                 'width'   => 505,                 'height'  => 350,             );                  parent::__construct( 'featured-custom-post-type', __( 'Genesis - Featured Custom Post Types', 'genesis-featured-custom-post-type-widget' ), $widget_ops, $control_ops );              }              /**          * Echo the widget content.          *          * @since 0.1.8          *          * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.          * @param array $instance The settings for the particular instance of the widget          */         function widget( $args, $instance ) {                  global $wp_query, $_genesis_displayed_ids;                  extract( $args );                  //* Merge with defaults             $instance = wp_parse_args( (array) $instance, $this->defaults );                  echo $before_widget;                  //* Set up the author bio             if ( ! empty( $instance['title'] ) )                 echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title;                  $query_args = array(                 'post_type' => $instance['post_type'],                 'cat'       => $instance['posts_cat'],                 'showposts' => $instance['posts_num'],                 'offset'    => $instance['posts_offset'],                 'orderby'   => $instance['orderby'],                 'order'     => $instance['order'],             );                  //* Exclude displayed IDs from this loop?             if ( $instance['exclude_displayed'] )                 $query_args['post__not_in'] = (array) $_genesis_displayed_ids;                  $wp_query = new WP_Query( $query_args );                  if ( have_posts() ) : while ( have_posts() ) : the_post();                      $_genesis_displayed_ids[] = get_the_ID();                      genesis_markup( array(                     'html5'   => '
',                     'xhtml'   => sprintf( '
', implode( ' ', get_post_class() ) ),                     'context' => 'entry',                 ) );                      $image = genesis_get_image( array(                     'format'  => 'html',                     'size'    => $instance['image_size'],                     'context' => 'featured-post-widget',                     'attr'    => genesis_parse_attr( 'entry-image-widget' ),                 ) );                      if ( $instance['show_image'] && $image )                     printf( '%s', get_permalink(), the_title_attribute( 'echo=0' ), esc_attr( $instance['image_alignment'] ), $image );                      if ( ! empty( $instance['show_gravatar'] ) ) {                     echo '';                     echo get_avatar( get_the_author_meta( 'ID' ), $instance['gravatar_size'] );                     echo '';                 }                      if ( $instance['show_title'] )                     echo genesis_html5() ? '' : '';                          if ( ! empty( $instance['show_title'] ) ) {                              if ( genesis_html5() )                             printf( '
%s
', get_permalink(), the_title_attribute( 'echo=0' ), get_the_title() );                         else                             printf( '
%s
', get_permalink(), the_title_attribute( 'echo=0' ), get_the_title() );                          }                          if ( ! empty( $instance['show_byline'] ) && ! empty( $instance['post_info'] ) )                         printf( genesis_html5() ? '
%s
' : '
%s
', do_shortcode( $instance['post_info'] ) );                      if ( $instance['show_title'] )                     echo genesis_html5() ? '' : '';                      if ( ! empty( $instance['show_content'] ) ) {                          echo genesis_html5() ? '
' : '';                          if ( 'excerpt' == $instance['show_content'] ) {                         the_excerpt();                     }                     elseif ( 'content-limit' == $instance['show_content'] ) {                         the_content_limit( (int) $instance['content_limit'], esc_html( $instance['more_text'] ) );                     }                     else {                              global $more;                              $orig_more = $more;                         $more = 0;                              the_content( esc_html( $instance['more_text'] ) );                              $more = $orig_more;                          }                          echo genesis_html5() ? '
' : '';                      }                      genesis_markup( array(                     'html5' => '
',                     'xhtml' => '
',                 ) );                  endwhile; endif;                  //* Restore original query             wp_reset_query();                  //* The EXTRA Posts (list)             if ( ! empty( $instance['extra_num'] ) ) {                 if ( ! empty( $instance['extra_title'] ) )                     echo $before_title . esc_html( $instance['extra_title'] ) . $after_title;                      $offset = intval( $instance['posts_num'] ) + intval( $instance['posts_offset'] );                      $query_args = array(                     'post_type' => $instance['post_type'],                     'cat'       => $instance['posts_cat'],                     'showposts' => $instance['extra_num'],                     'offset'    => $offset,                 );                      $wp_query = new WP_Query( $query_args );                      $listitems = '';                      if ( have_posts() ) {                     while ( have_posts() ) {                         the_post();                         $_genesis_displayed_ids[] = get_the_ID();                         $listitems .= sprintf( '
%s
', get_permalink(), the_title_attribute( 'echo=0' ), get_the_title() );                     }                          if ( mb_strlen( $listitems ) > 0 )                         printf( '
%s
', $listitems );                 }                      //* Restore original query                 wp_reset_query();             }                  if ( ! empty( $instance['more_from_category'] ) && ! empty( $instance['posts_cat'] ) )                 printf(                     '
%3$s
',                     esc_url( get_category_link( $instance['posts_cat'] ) ),                     esc_attr( get_cat_name( $instance['posts_cat'] ) ),                     esc_html( $instance['more_from_category_text'] )                 );                  echo $after_widget;              }              /**          * Update a particular instance.          *          * This function should check that $new_instance is set correctly.          * The newly calculated value of $instance should be returned.          * If "false" is returned, the instance won't be saved/updated.          *          * @since 0.1.8          *          * @param array $new_instance New settings for this instance as input by the user via form()          * @param array $old_instance Old settings for this instance          * @return array Settings to save or bool false to cancel saving          */         function update( $new_instance, $old_instance ) {                  $new_instance['title']     = strip_tags( $new_instance['title'] );             $new_instance['more_text'] = strip_tags( $new_instance['more_text'] );             $new_instance['post_info'] = wp_kses_post( $new_instance['post_info'] );             return $new_instance;              }              /**          * Echo the settings update form.          *          * @since 0.1.8          *          * @param array $instance Current settings          */         function form( $instance ) {                  //* Merge with defaults             $instance = wp_parse_args( (array) $instance, $this->defaults );                  $args = array(                 'public' => true             );             $output = 'names';             $operator = 'and';             $post_type_list = get_post_types( $args, $output, $operator );                       ?>
                 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'genesis-featured-custom-post-type-widget' ); ?>:                 <input type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" />

                         <label for="<?php echo $this->get_field_id( 'post_type' ); ?>"><?php _e( 'Post Type', 'genesis-featured-custom-post-type-widget' ); ?>:                         <select id="<?php echo $this->get_field_id( 'post_type' ); ?>" name="<?php echo $this->get_field_name( 'post_type' ); ?>">                                  <?php                             foreach ( $post_type_list as $post_type_item )                                  echo '<option style="padding-right:10px;" value="'. esc_attr( $post_type_item ) .'" '. selected( esc_attr( $post_type_item ), $instance['post_type'], false ) .'>'. esc_attr( $post_type_item ) .'</option>';                                   echo '<option style="padding-right:10px;" value="any" '. selected( 'any', $instance['post_type'], false ) .'>'. __( 'any', 'genesis-featured-custom-post-type-widget' ) .'</option>';                              ?>                                   </select>

                         <label for="<?php echo $this->get_field_id( 'posts_cat' ); ?>"><?php _e( 'Category', 'genesis-featured-custom-post-type-widget' ); ?>:                         <?php                         $categories_args = array(                             'name'            => $this->get_field_name( 'posts_cat' ),                             'selected'        => $instance['posts_cat'],                             'orderby'         => 'Name',                             'hierarchical'    => 1,                             'show_option_all' => __( 'All Categories', 'genesis-featured-custom-post-type-widget' ),                             'hide_empty'      => '0',                         );                         wp_dropdown_categories( $categories_args ); ?>

                         <label for="<?php echo $this->get_field_id( 'posts_num' ); ?>"><?php _e( 'Number of Posts to Show', 'genesis-featured-custom-post-type-widget' ); ?>:                         <input type="text" id="<?php echo $this->get_field_id( 'posts_num' ); ?>" name="<?php echo $this->get_field_name( 'posts_num' ); ?>" value="<?php echo esc_attr( $instance['posts_num'] ); ?>" size="2" />

                         <label for="<?php echo $this->get_field_id( 'posts_offset' ); ?>"><?php _e( 'Number of Posts to Offset', 'genesis-featured-custom-post-type-widget' ); ?>:                         <input type="text" id="<?php echo $this->get_field_id( 'posts_offset' ); ?>" name="<?php echo $this->get_field_name( 'posts_offset' ); ?>" value="<?php echo esc_attr( $instance['posts_offset'] ); ?>" size="2" />

                         <label for="<?php echo $this->get_field_id( 'orderby' ); ?>"><?php _e( 'Order By', 'genesis-featured-custom-post-type-widget' ); ?>:                         <select id="<?php echo $this->get_field_id( 'orderby' ); ?>" name="<?php echo $this->get_field_name( 'orderby' ); ?>">                             <option value="date" <?php selected( 'date', $instance['orderby'] ); ?>><?php _e( 'Date', 'genesis-featured-custom-post-type-widget' ); ?></option>                             <option value="title" <?php selected( 'title', $instance['orderby'] ); ?>><?php _e( 'Title', 'genesis-featured-custom-post-type-widget' ); ?></option>                             <option value="parent" <?php selected( 'parent', $instance['orderby'] ); ?>><?php _e( 'Parent', 'genesis-featured-custom-post-type-widget' ); ?></option>                             <option value="ID" <?php selected( 'ID', $instance['orderby'] ); ?>><?php _e( 'ID', 'genesis-featured-custom-post-type-widget' ); ?></option>                             <option value="comment_count" <?php selected( 'comment_count', $instance['orderby'] ); ?>><?php _e( 'Comment Count', 'genesis-featured-custom-post-type-widget' ); ?></option>                             <option value="rand" <?php selected( 'rand', $instance['orderby'] ); ?>><?php _e( 'Random', 'genesis-featured-custom-post-type-widget' ); ?></option>                         </select>

                         <label for="<?php echo $this->get_field_id( 'order' ); ?>"><?php _e( 'Sort Order', 'genesis-featured-custom-post-type-widget' ); ?>:                         <select id="<?php echo $this->get_field_id( 'order' ); ?>" name="<?php echo $this->get_field_name( 'order' ); ?>">                             <option value="DESC" <?php selected( 'DESC', $instance['order'] ); ?>><?php _e( 'Descending (3, 2, 1)', 'genesis-featured-custom-post-type-widget' ); ?></option>                             <option value="ASC" <?php selected( 'ASC', $instance['order'] ); ?>><?php _e( 'Ascending (1, 2, 3)', 'genesis-featured-custom-post-type-widget' ); ?></option>                         </select>

                         <input id="<?php echo $this->get_field_id( 'exclude_displayed' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'exclude_displayed' ); ?>" value="1" <?php checked( $instance['exclude_displayed'] ); ?>/>                         <label for="<?php echo $this->get_field_id( 'exclude_displayed' ); ?>"><?php _e( 'Exclude Previously Displayed Posts?', 'genesis-featured-custom-post-type-widget' ); ?>

                         <input id="<?php echo $this->get_field_id( 'show_gravatar' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'show_gravatar' ); ?>" value="1" <?php checked( $instance['show_gravatar'] ); ?>/>                         <label for="<?php echo $this->get_field_id( 'show_gravatar' ); ?>"><?php _e( 'Show Author Gravatar', 'genesis-featured-custom-post-type-widget' ); ?>

                         <label for="<?php echo $this->get_field_id( 'gravatar_size' ); ?>"><?php _e( 'Gravatar Size', 'genesis-featured-custom-post-type-widget' ); ?>:                         <select id="<?php echo $this->get_field_id( 'gravatar_size' ); ?>" name="<?php echo $this->get_field_name( 'gravatar_size' ); ?>">                             <option value="45" <?php selected( 45, $instance['gravatar_size'] ); ?>><?php _e( 'Small (45px)', 'genesis-featured-custom-post-type-widget' ); ?></option>                             <option value="65" <?php selected( 65, $instance['gravatar_size'] ); ?>><?php _e( 'Medium (65px)', 'genesis-featured-custom-post-type-widget' ); ?></option>                             <option value="85" <?php selected( 85, $instance['gravatar_size'] ); ?>><?php _e( 'Large (85px)', 'genesis-featured-custom-post-type-widget' ); ?></option>                             <option value="125" <?php selected( 105, $instance['gravatar_size'] ); ?>><?php _e( 'Extra Large (125px)', 'genesis-featured-custom-post-type-widget' ); ?></option>                         </select>

                         <label for="<?php echo $this->get_field_id( 'gravatar_alignment' ); ?>"><?php _e( 'Gravatar Alignment', 'genesis-featured-custom-post-type-widget' ); ?>:                         <select id="<?php echo $this->get_field_id( 'gravatar_alignment' ); ?>" name="<?php echo $this->get_field_name( 'gravatar_alignment' ); ?>">                             <option value="alignnone">- <?php _e( 'None', 'genesis-featured-custom-post-type-widget' ); ?> -</option>                             <option value="alignleft" <?php selected( 'alignleft', $instance['gravatar_alignment'] ); ?>><?php _e( 'Left', 'genesis-featured-custom-post-type-widget' ); ?></option>                             <option value="alignright" <?php selected( 'alignright', $instance['gravatar_alignment'] ); ?>><?php _e( 'Right', 'genesis-featured-custom-post-type-widget' ); ?></option>                         </select>

                         <input id="<?php echo $this->get_field_id( 'show_image' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'show_image' ); ?>" value="1" <?php checked( $instance['show_image'] ); ?>/>                         <label for="<?php echo $this->get_field_id( 'show_image' ); ?>"><?php _e( 'Show Featured Image', 'genesis-featured-custom-post-type-widget' ); ?>

                         <label for="<?php echo $this->get_field_id( 'image_size' ); ?>"><?php _e( 'Image Size', 'genesis-featured-custom-post-type-widget' ); ?>:                         <select id="<?php echo $this->get_field_id( 'image_size' ); ?>" class="genesis-image-size-selector" name="<?php echo $this->get_field_name( 'image_size' ); ?>">                             <option value="thumbnail">thumbnail (<?php echo get_option( 'thumbnail_size_w' ); ?>x<?php echo get_option( 'thumbnail_size_h' ); ?>)</option>                             <?php                             $sizes = genesis_get_additional_image_sizes();                             foreach( (array) $sizes as $name => $size )                                 echo '<option value="'.esc_attr( $name ).'" '.selected( $name, $instance['image_size'], FALSE ).'>'.esc_html( $name ).' ( '.$size['width'].'x'.$size['height'].' )</option>';                             ?>                         </select>

                         <label for="<?php echo $this->get_field_id( 'image_alignment' ); ?>"><?php _e( 'Image Alignment', 'genesis-featured-custom-post-type-widget' ); ?>:                         <select id="<?php echo $this->get_field_id( 'image_alignment' ); ?>" name="<?php echo $this->get_field_name( 'image_alignment' ); ?>">                             <option value="alignnone">- <?php _e( 'None', 'genesis-featured-custom-post-type-widget' ); ?> -</option>                             <option value="alignleft" <?php selected( 'alignleft', $instance['image_alignment'] ); ?>><?php _e( 'Left', 'genesis-featured-custom-post-type-widget' ); ?></option>                             <option value="alignright" <?php selected( 'alignright', $instance['image_alignment'] ); ?>><?php _e( 'Right', 'genesis-featured-custom-post-type-widget' ); ?></option>                         </select>

                         <input id="<?php echo $this->get_field_id( 'show_title' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'show_title' ); ?>" value="1" <?php checked( $instance['show_title'] ); ?>/>                         <label for="<?php echo $this->get_field_id( 'show_title' ); ?>"><?php _e( 'Show Post Title', 'genesis-featured-custom-post-type-widget' ); ?>

                         <input id="<?php echo $this->get_field_id( 'show_byline' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'show_byline' ); ?>" value="1" <?php checked( $instance['show_byline'] ); ?>/>                         <label for="<?php echo $this->get_field_id( 'show_byline' ); ?>"><?php _e( 'Show Post Info', 'genesis-featured-custom-post-type-widget' ); ?>                         <input type="text" id="<?php echo $this->get_field_id( 'post_info' ); ?>" name="<?php echo $this->get_field_name( 'post_info' ); ?>" value="<?php echo esc_attr( $instance['post_info'] ); ?>" class="widefat" />

                         <label for="<?php echo $this->get_field_id( 'show_content' ); ?>"><?php _e( 'Content Type', 'genesis-featured-custom-post-type-widget' ); ?>:                         <select id="<?php echo $this->get_field_id( 'show_content' ); ?>" name="<?php echo $this->get_field_name( 'show_content' ); ?>">                             <option value="content" <?php selected( 'content', $instance['show_content'] ); ?>><?php _e( 'Show Content', 'genesis-featured-custom-post-type-widget' ); ?></option>                             <option value="excerpt" <?php selected( 'excerpt', $instance['show_content'] ); ?>><?php _e( 'Show Excerpt', 'genesis-featured-custom-post-type-widget' ); ?></option>                             <option value="content-limit" <?php selected( 'content-limit', $instance['show_content'] ); ?>><?php _e( 'Show Content Limit', 'genesis-featured-custom-post-type-widget' ); ?></option>                             <option value="" <?php selected( '', $instance['show_content'] ); ?>><?php _e( 'No Content', 'genesis-featured-custom-post-type-widget' ); ?></option>                         </select>
                         <label for="<?php echo $this->get_field_id( 'content_limit' ); ?>"><?php _e( 'Limit content to', 'genesis-featured-custom-post-type-widget' ); ?>                             <input type="text" id="<?php echo $this->get_field_id( 'image_alignment' ); ?>" name="<?php echo $this->get_field_name( 'content_limit' ); ?>" value="<?php echo esc_attr( intval( $instance['content_limit'] ) ); ?>" size="3" />                             <?php _e( 'characters', 'genesis-featured-custom-post-type-widget' ); ?>

                         <label for="<?php echo $this->get_field_id( 'more_text' ); ?>"><?php _e( 'More Text (if applicable)', 'genesis-featured-custom-post-type-widget' ); ?>:                         <input type="text" id="<?php echo $this->get_field_id( 'more_text' ); ?>" name="<?php echo $this->get_field_name( 'more_text' ); ?>" value="<?php echo esc_attr( $instance['more_text'] ); ?>" />

<?php _e( 'To display an unordered list of more posts from this category, please fill out the information below', 'genesis-featured-custom-post-type-widget' ); ?>:

                         <label for="<?php echo $this->get_field_id( 'extra_title' ); ?>"><?php _e( 'Title', 'genesis-featured-custom-post-type-widget' ); ?>:                         <input type="text" id="<?php echo $this->get_field_id( 'extra_title' ); ?>" name="<?php echo $this->get_field_name( 'extra_title' ); ?>" value="<?php echo esc_attr( $instance['extra_title'] ); ?>" class="widefat" />

                         <label for="<?php echo $this->get_field_id( 'extra_num' ); ?>"><?php _e( 'Number of Posts to Show', 'genesis-featured-custom-post-type-widget' ); ?>:                         <input type="text" id="<?php echo $this->get_field_id( 'extra_num' ); ?>" name="<?php echo $this->get_field_name( 'extra_num' ); ?>" value="<?php echo esc_attr( $instance['extra_num'] ); ?>" size="2" />

                         <input id="<?php echo $this->get_field_id( 'more_from_category' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'more_from_category' ); ?>" value="1" <?php checked( $instance['more_from_category'] ); ?>/>                         <label for="<?php echo $this->get_field_id( 'more_from_category' ); ?>"><?php _e( 'Show Category Archive Link', 'genesis-featured-custom-post-type-widget' ); ?>

                         <label for="<?php echo $this->get_field_id( 'more_from_category_text' ); ?>"><?php _e( 'Link Text', 'genesis-featured-custom-post-type-widget' ); ?>:                         <input type="text" id="<?php echo $this->get_field_id( 'more_from_category_text' ); ?>" name="<?php echo $this->get_field_name( 'more_from_category_text' ); ?>" value="<?php echo esc_attr( $instance['more_from_category_text'] ); ?>" class="widefat" />

             <?php              }          }


title: WP sql query to extend Groups shortcode to return list of users AND usermeta

text:
This is a question related to an answer posted here The above solution outputs a list of a specified Group members' display names. I need to extend it to show 2 user fields and 1 usermeta field. So I have tried to alter the SQL select statement to do 2 left joins with 2 where conditions, however it isn't working. I am wondering if someone can check my SQL statement and steer me in the right direction please? NB. mobile_phone is a custom usermeta field that I have defined and populated.               add_shortcode( 'groups_group_user_mobiles', 'groups_group_user_mobiles' );          function groups_group_user_mobiles( $atts, $content = null ) {     global $wpdb;     $output = "";     $options = shortcode_atts(         array(             'group' => '',             'show' => '',             'format' => '',             'single' => '1',             'plural' => '%d'         ),         $atts     );     $group = trim( $options['group'] );     $current_group = Groups_Group::read( $group );     if ( !$current_group ) {         $current_group = Groups_Group::read_by_name( $group );     }          if ( $current_group ) {                 $user_group_table = _groups_get_tablename( "user_group" );                 $users = $wpdb->get_results( $wpdb->prepare(                     "SELECT * FROM $wpdb->users,$wpdb->usermeta                       LEFT JOIN $user_group_table ON $wpdb->users.ID = $user_group_table.user_id                      LEFT JOIN $user_group_table ON $wpdb->usermeta.user_id = $user_group_table.user_id                       WHERE $user_group_table.group_id = %d                        AND $wpdb->usermeta.meta_key = 'mobile_phone'",                      Groups_Utility::id( $current_group->group_id )                 ) );                 if ( $users ) {                     $output .= '
';                     foreach( $users as $user ) {                         $output .= '
' . wp_filter_nohtml_kses( $user->display_name ) ." - ". wp_filter_nohtml_kses( $user->user_email ) ." - ". wp_filter_nohtml_kses( $user->meta_value ) . '
';                     }                     $output .= '
';                 }     }     return $output;     }


title: Absolute Path (ABSPATH) in WordPress is not working

text: I am currently working on a small task that store a plugin information into database, but I have problem regarding to include the file that has the functions to run the query. Here is the line that includes the file: `require_once(ABSPATH . 'wp-admin/includes/upgrade.php');` but I got the following when I run the code: > **Warning:** `require_once(ABSPATHwp-admin/includes/upgrade.php)`: failed to > open stream: No such file or directory in > `/home/najam/dev/project1/wordpress/wp-admin/admin-insert.php` on **line > 18** I searched a lot but can't find anything useful or helpful. ### EDIT Here is my code:               global $wpdb;          $table_name = $wpdb->prefix . 'table_form';          $sql = "CREATE TABLE $table_name (       id int(11) NOT NULL AUTO_INCREMENT,       rows int(11) DEFAULT NULL,       cols int(11) DEFAULT NULL,       UNIQUE KEY id (id)     );";          require_once(ABSPATH . 'wp-admin/includes/upgrade.php');     dbDelta( $sql );`


title: Solution for database version control and deployment?

text: Currently i use a dump script and commit the database to the git repo. `\--skip-extended-insert --skip-comments --skip-dump-date` means that a diff can give me a fair idea of what has changed, but it all falls down if I try to merge. The WP_SITEURL, WP_HOME and all the other places wordpress stores full URLs need updating when importing to another host (testing,staging,production) Is anyone using a better method? **Main issues:**   * Wordpress stores full URLs all through the database (non-portable)   * Lots of other, non-relevant records change      * auto_increment values (i just strip these out, but have run into ID issues)     * timestamps (can also strip out, potentially)     * _transient_ * records ... no idea what to do with them A process that created timestamped migrations, with only the things added or removed, would be ideal... but i'm not sure if it's even possible?


title: Get post id in Post Page within Wp-admin

text: I want to get post ID within Post page. I need this for custom meta box so i can set the id in shortcode. I can show the result in notices but don't know how to make it global to use for meta input. What i got till now is :               function foo(){     global $post;     $nid = $post->ID;     var_dump($nid);     }     add_action( 'admin_notices', 'foo' );      which show the id but i need it as a variable so i can use it later. so i tried to make `$nid` global then echo it but it show nothing.


title: mini loops and qtranslate (localization mini loop url)

text:
I have both mini loops and qtranslate, everything works fine but i have some problems with urls. I mean, let's say i have an article, in 2 languages, **IT** and **EN**. so, for this article there are two different urls: http://www.mysite.com/ **it** /article http://www.mysite.com/ **en** /article now, i have a loop that display certain articles on the homepage, but the `[url]` shortcode gives always the "default" url which is in this case: http://www.mysite.com/article so, the default language is displayed, is there a way to localize the url in some way? **edit** some code:

[ml_image from=thumb width=115 height=115 crop=0]

[ml_title]

View productsVedi prodotto

      ![widget setup](http://i.stack.imgur.com/tRguI.png)


title: How to disable posts and use pages only

text: I am new to Wordpress theming and I would like to set up a Website that only has static content. Therefore would it make sense to disable posts and only use static pages? If so, is there an easy way to do that?


title: How to remove Filters from post admin page?

text: On a custom post type, I want to remove the filters that show up on /edit.php (where all of the posts are listed out). I have a custom taxonomy that shows up as a filter that I WANT to keep, but I want to REMOVE the 'Show all dates' and 'View all categories' filters. Any ideas?


title: Do I need to include a textdomain if my theme doesn't support translation?

text: According to the codex > Themes are required to use theme-slug (or a reasonable facsimile) as > textdomain for translation Does this mean that my theme needs to include a textdomain even if my theme doesn't support translation? ... and also is there any harm in including a textdomain in `style.css` if there are no translation options.


title: Why is a 500 error generated by admin-ajax.php not going into the Apache error log?

text: I'm getting 500 errors with AJAX on the admin side. However, these errors aren't being logged in the Apache logs so they're rather hard to debug. Is there some way I can find out what they are? Thanks


title: wp_list_pages - Using a Walker to customize output order

text: I'm using wp_list_pages to create a navigation menu. I've run into a challenge with the menu order, though, and I am trying to figure out a way to take more control over the order of the menu. Is it possible to customize the order of the wp_list_pages output using a Walker? For example, I'd like to check if a given page in wp_list_pages results has a `post_meta` value of `page_x` and output that _first_ , then do the same for another page, then, if none of the rules match, continue as normal.


title: How to add active class on current menu item page?

text: I have two links: Products and News. When i click on Products or News, it returns me an archive page that contains some posts, when i click on a post it returns me a single page of this post. In the menu I use this code on `<li>` to add a class called active if the page is home:               <li<?php if(is_home()) {?> class="active"<?php } ?>>      But i dont know how to do it when I have two archive pages and two singles pages. If i use `if( is_archive() || is_single() )` it'll add class on both menu itens. Some help would be appreciated.


title: Does Wordpress provide themes_api function?

text: http://wp.tutsplus.com/tutorials/plugins/communicating-with-the-wordpress-org- plugin-api/ From the link above, we can see the Wordpress.org provide a function that can access the Wordpress.org plugins and get the plugins information from there...      But I search on google for few days already...still cannot found any information about the wordpress.org themes api. Is Wordpress provide a function like plugins_api? And the usage of the themes_api(if available)? That is my question.


title: wp_kses enable HTML comment code.filter

text: Is there a way to enable the category description to allow HTML comment EX:               <!-- example of the HTML comment -->      How it looks in the category description.               <!-- This story is about the dot -->      `This is a story of .....` How it looks when others see it in the category page There is a space here `This is a story of .....` How I want it to show: no more space should be here. `This is a story of .....` I apologize if I was not clear enough but am pretty sure. You get where am going with this.


title: Cannot query custom post type taxonomy from theme options array

text:
I am having no luck with querying a custom post type taxonomy from an array in theme options. My full code is below, would be grateful for some feedback to get it working correctly as I cannot get this to work.               // Pull all the custom taxonomies into an array     // options.php          $options_taxonomies = array();     $taxonomies_terms_obj = get_terms('portfolio_category');       foreach ($taxonomies_terms_obj as $taxonomy) {     $options_taxonomies[$taxonomy->term_id] = $taxonomy->name;     }          // Select a Featured Homepage Category           $options[] = array(     'name' => __('Featured Homepage Category', 'options_framework_theme'),     'desc' => __('Choose a category to feature on your homepage.', 'options_framework_theme'),     'id' => 'homepage_feature',     'type' => 'select',     'options' => $options_taxonomies);      }          // WP_Query and Loop     // front-page.php          <?php           $num_cols = 3; // set the number of columns here          if ( function_exists( 'of_get_option' ) ) :             $args = array(        'posts_per_page' => 3,         'tax_query' => array(          array(             'taxonomy' => 'portfolio',             'field' => 'id',             'terms' => of_get_option( 'homepage_feature' )              )          )       );            $my_qry = new WP_Query($args);             if (have_posts()) :       for ( $i=1 ; $i <= $num_cols; $i++ ) :       echo '
';       $counter = $num_cols + 1 - $i;       while (have_posts()) : the_post();           if( $counter%$num_cols == 0 ) : ?>                 <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail-home', array('class' => 'image-fade')); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
       <?php endif;       $counter++;     endwhile;     rewind_posts();         echo '
'; //closes the column div     endfor;     else:        echo '
Please create a post.
';       endif;       endif; rewind_posts(); wp_reset_query();      ?>


title: Hook Widget to Woo Theme in functions.php

text:
Right now I am adding a sidebar above my woocommerce products. How can I hook the sidebar to my theme. Have registered sidebar and it works.               register_sidebar(          array(              'name'          => __( 'Filters', 'woothemes' ),              'id'            => 'filters',              'description'   => __( 'Optional widgetized shop page (displays only if widgets are added here).', 'woothemes' ),              'before_widget' => '
',              'after_widget'  => '
',              'before_title'  => '
',              'after_title'   => '
'          )      );      This is the hook I have used without success.               add_action( 'woo_main_before', 'woo_sidebar' );     function woo_sidebar() {     if (is_woocommerce()) {          echo '
';             woo_sidebar( 'filters' );         echo '
';     }      *Update: Using the code below adds this widget area to all other widget areas. Example: In the footer of www.lne.net.au.               add_action( 'woo_main_before', 'woo_sidebar' );     function woo_sidebar() {     if (is_woocommerce()) {          echo '
';         dynamic_sidebar( 'filters' );         echo '
';     }     }


title: Show last post of employee in his profile page

text: I have built a wordpress theme in which I have listed employees of the organization via custom post type. And I am displaying each employee via custom post type. The employees listed are authors in my website too and they regularly write posts. When I am viewing each employees Profile page, I want to show the lst post written by that employee. I hope I am clear in my explanation. Please help me...


title: How to back-up a database on IIS

text: I've been having trouble finding a good tutorial on how to back-up a WordPress database using IIS as the web server. I installed WordPress using IIS's web platform installer and now I can't even find where the database file resides. I've been doing everything under a local development if that helps. So my question is, how exactly do I back-up the database file associated with IIS?


title: Arrange custom fields with drag and drop?

text: I am making theme for hotel and i made custom metabox with list of various custom fields that i would need in posts. What i did is i made a list of fields like   * booking   * wifienabled   * coffe   * pool   * spa and so on... Problem is that currently i can show those custom fields in website frontend only by order how i added them in array, if i change places in my list custom fields will change places in website frontend. Is it possible that custom fields have specific order? Some kind of drag and drop to rearange those fields and change order of display in frontend?


title: Contact Form 7 - Debugging email send failres

text: I am getting the red failed error when trying to send a message. I referred to the FAQ and this is the extent of help available: "There are really various reasons for server side problems, so I can’t explain exactly what yours is. But experiences of other users who solved their problem might be helpful for you." Not helpful at all! I don't really want or expect someone else to solve my problem, all I want is some debugging guidance to see the error that is being produced so I can debug it myself! How can I see the actual error that is occurring instead of the generic "failed" message?


title: Scheduled posts: set default time?

text: I want to be able to set the default time in the options for a Scheduled Post to be a specific time of the day, as opposed to it defaulting to the current time. Is there a plugin or some code I can add/tweak to accomplish this? I was unable to find anything here or on Google to do this.