Why won't register_setting() create a setting?

I'm stumped. I've been researching this like crazy, but I can't seem to figure out why `register_setting()` isn't working for me. I'm new to WP plugin development (obviously), so it's probably just something silly that I'm missing. Check it out. I'm running this in the constructor function:               add_action( 'admin_init', array( $this, 'register_settings_and_fields') );      Then I have the following code which should execute what I need:               /**      * Register the settings and fields for the plugin settings page.      *      * @since    1.0.0      */     public function register_settings_and_fields() {              register_setting('my_plugin_settings', 'my_plugin_settings');              add_settings_section(             'my_plugin_main_section',                          // ID used to identify this section and with which to register options             'Main Settings',                                   // Title to be displayed on the administration page             array($this, 'my_plugin_main_settings_callback'),  // Callback used to render the description of the section             $this->plugin_slug                                 // Page on which to add this section of options         );              // Begin defining the fields         add_settings_field('my_plugin_data_1', 'Data 1', array( $this, 'my_plugin_data_1_setting' ), $this->plugin_slug, 'my_plugin_main_section');     }          // ... and of course other lines of code.      Of course, I have more code where I do things such as define the callback functions, etc. Everything seems to execute perfectly, and the settings section/field is displayed correctly. But when I go to `/wp- admin/options.php`, my_plugin_settings _has not been created_. I'm stumped. Any thoughts? Let me know if you'd like to see more code.


Read More link doesn't work with Custom Post Type

I came several times across the same solution to make `Read More` links work with CPTs: adding `global $more; $more = 0;` before `the_content('read more..')`. However it doesn't work in my case. To no avail I tried with `the_content()` without parameters and with `the_excerpt()`. In all cases, the whole CPT content is displayed as if my `Read More` link didn't exist. I'm running this from a template page displaying all my CPT posts. Just in case here's how I define my CPT:               function event_cpt() {         $labels = array(             'name'               => _x( 'Events', 'post type general name' ),             'singular_name'      => _x( 'Events', 'post type singular name' ),             'add_new'            => _x( 'Add New', 'book' ),             'add_new_item'       => __( 'Add New Event' ),             'edit_item'          => __( 'Edit Event' ),             'new_item'           => __( 'New Event' ),             'all_items'          => __( 'All Events' ),             'view_item'          => __( 'View Event' ),             'search_items'       => __( 'Search Events' ),             'not_found'          => __( 'No events found' ),             'not_found_in_trash' => __( 'No events found in the Trash' ),              'parent_item_colon'  => '',             'menu_name'          => 'Events'         );         $args = array(             'labels'        => $labels,             'description'   => 'Holds our events and event specific data',             'public'        => true,             'menu_position' => 5,             'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),             'has_archive'   => true,         );         register_post_type( 'event', $args );        }     add_action( 'init', 'event_cpt' );          function event_updated_messages( $messages ) {         global $post, $post_ID;         $messages['event'] = array(             0 => '',              1 => sprintf( __('Event updated. View event'), esc_url( get_permalink($post_ID) ) ),             2 => __('Custom field updated.'),             3 => __('Custom field deleted.'),             4 => __('Event updated.'),             5 => isset($_GET['revision']) ? sprintf( __('Event restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,             6 => sprintf( __('Event published. View event'), esc_url( get_permalink($post_ID) ) ),             7 => __('Event saved.'),             8 => sprintf( __('Event submitted. Preview event'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),             9 => sprintf( __('Event scheduled for: %1$s. Preview event'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),             10 => sprintf( __('Event draft updated. Preview event'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),         );         return $messages;     }     add_filter( 'post_updated_messages', 'event_updated_messages' );


WordPress Customize panel - accessing the values

Here is the code I'm using to add the section to the Customize panel.               function apple_customize_register($wp_customize){     $wp_customize->add_section('apple_footer', array(         'title'    => 'Footer',         'priority' => 120,     ));     //------ display copyright in footer     $wp_customize->add_setting('theme_options[copyright]', array(         'capability' => 'edit_theme_options',         'type'       => 'option',     ));     $wp_customize->add_control('theme_options[copyright]', array(         'settings' => 'theme_options[copyright]',         'label'    => __('Display Copyright'),         'section'  => 'apple_footer',         'type'     => 'checkbox',         'value' => '1'     ));     }     add_action('customize_register', 'apple_customize_register');      How do I use the values in my theme. I have tryed `get_option('theme_options[copyright]')`, `get_theme_mod('theme_options[copyright]')` and many more, but all var_dump out `bool(false)`. Please tell me what I'm missing.


Blog as a part of a Wordpress site?

I'm not sure how to word my search terms for this problem. I've created a site in WP. So, let's assume the URL is `http://example.org` The 'Contact' page would be `http://example.org/contact`, for example. I want to also have a blog on this site. The blog would reside at `http://example.org/blog` I have created a page named 'Blog'. I've gone to `Settings > Reading` and selected 'Blog' for the 'Posts page' select list. Now, when I visit the site, I don't see posts. How do I make my posts appear on `http://example.org/blog` given what I've done so far? I'm not quite sure how to do that the right way. Any recommendations would be appreciated!


Ads Refreshing with the Adsense Extreme Plugin

I installed the Adsense Extreme Plug-in on my blog and ads are loading with the page as they should, but then after the page fully loads, all the ads refresh. What could be causing this? I disabled all other plugins to see if one of my other plugins could be causing this, but this did not fix the problem. I'm on WordPress 3.5.1 using Adsense Extreme 1.1.4.


How to use function schedule post to integrate with date type (magic fields)?

Lately I'm developing a cinema website. The users are having problem setting movie on `coming-soon`, `release`, and `now showing` types. They need to do it in manual way. So I just saw WordPress function schedule and I think I want to use it with Magic Field plugin to set auto update movie to the three types I mentioned above.


Moved my site to new host now getting 404

I just moved my wordpress multisite to a new host and all the pages expect the homepage keep getting the follower error Not Found The requested URL was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. I have tried resetting the permalinks inside the wp admin that doesn't seem to work. Could does have something to do that the site was an addon domain on cpanel at my old hsot while its the primary domain in my current cpanel? Please let me know what i can do to solve this?


pagination not working for category.php (custom post types in categories)

it works everywhere on my site but it isnt working in category.php. When i click page to it goes to... domain.com/category/ _cat-slug_ /page/2 by the way this is showing custom post types within certain categories (no actual plain 'posts') But when the page loads its just the 404 page? When i go to /page/1 it works fine, just not for any other pages. In permalinks I have /%postname%/ although I have set category base to 'category' just to be safe. I also know this is kind of a convoluted way of doing it but i wasnt sure a better way.               <?php               get_header(); ?>

            <?php              $catID = get_query_var('cat');        $catName = strtolower(get_cat_name($catID));                   if ( get_query_var('paged') ) {         $paged = get_query_var('paged');       } elseif ( get_query_var('page') ) {         $paged = get_query_var('page');       } else {         $paged = 1;       }            $myquery = new WP_Query(array(             'post_type' => 'any',                 'paged' => $paged,                 'posts_per_page' => 1,           'category_name' => $catName)             );                  while ( $myquery->have_posts() ) : $myquery->the_post();                        $img_id = get_post_meta($post->ID,'main_image',true);             $img_url = wp_get_attachment_url($img_id);              ?>     blah blah code here for output              <?php            endwhile;        wp_pagenavi( array( 'query' => $myquery ) );        ?>


How to add a child item to a menu element (using wp_nav_menu_objects)

(1) I used the code given on answer to How to use logout function on custom menu link? to programmatically add a menu element to `wp_nav_menu_objects` (Say "Animals"). I give it an id, say 1000. (2) Similarly, I succesfully created elements that I wanted to be children of a preexisting element (fixing `menu_item_parent` to the id of the parent element) (like "Jonquil" to element "Flowers") (3) The problem comes when I try to add children elements (Say "Cats" and "Dogs") to my programmatically added element "Animals". Cats and Dogs appear on the same level as Animals, as if WP couldn't manage to find their parent... (Yes, I do 3 after 1...) An idea of what I can be missing ?


how to call new widgets in sidebar in custom theme?

I am developing a theme in which I want to call available widgets _ex. Calendar_ and the installed plugin, I have put it in the sidebar from widget panel but can't see in frontend. Sidebar.php Code->

News & Announcements

                    <?php dynamic_sidebar('sidebar'); ?>     You can color this theme as you wish, by its powerful theme options panel. It has great      documentation.

          <?php if (is_page(array('home', 'about-us', 'academics', 'admission', 'activities',  'hall-of-fame', 'alumni', 'photo-gallery', 'news' ))) ?>     <?php $menu=wp_nav_menu('menu=sidebar_menu'); ?>     <?php if ( ! dynamic_sidebar( 'Sidebar' )) : ?>     <?php //If dynamic sidebar not found show the default widgets  ?>     <?php endif; ?>

      functions.php Code->               <?php          if(function_exists('register_sidebar'))     {     // Sidebar Widget     register_sidebar(array('name'=>'Left-Sidebar',     'before_widget'=>'
',     'after_widget'=>'
',     'before_title'=>'
',     'after_title'=>'
'     ));     }     ?>


Isotope Drop Down Categories Filter Function

I have a code in my functions file that I am using to generate a list of categories so that I can use isotope to filter the current page. However I need to know how to - How to make it a drop down and how to make the isotope script work with it? How to populate the drop down with the terms/child terms of the current category being viewed? This is the code that I am referring to -                   function isotope_categories() {              $terms = get_terms('videoscategory');              $html = '
';         $html .= '
All items
';              foreach ($terms as $term) {                       $html .= "
slug}' class='current'>{$term->name}
";            }              $html .= '
';              echo $html;     }      Here is the script I need to make work with a drop down and isotope -                     **EDIT:** I was able to make the function into a drop down using this code -                function isotope_categories() {              $terms = get_terms('videoscategory');              $html = '<select class="option-set clearfix"  data-filter-group="leuchtenart">';         $html .= '<option value="*" data-filter-value="" class="selected">All items</option>';              foreach ($terms as $term) {                       $html .= "<option value='#filter-leuchtenart-{$term->slug}' data-filter-value='.{$term->slug}'>{$term->name}</option>";            }              $html .= '</select>';              echo $html;     }      And I changed the js using the following code, however it's not working and I am receiving a error on the last line "SyntaxError: Illegal Character"                     Any help is appreciated, thanks.


How to apply default post categories to link manager plugin

I have a project with several custom post types - all sharing the default WP post category taxonomy. I would like to add the link manager plugin (Formally built into WP pre 3.5) to manage links - also sharing the default WP post categories. By default, though, the plugin needs you to create separate (link specific) categories. Does anyone know of a simple way to get it to sync with the default wp categories. Something in the functions file. Ta. P.


changing host.. data loss

I changed my host from dreamhost to godaddy.. My menubar setup is not showing up.. all of the pages are visible when there is only supposed to be a couple visible .. the site is first in english but you have the option to change it to french and now all the french manu bars are displaying aswell as the english ones .. also i lost all of my sidebar data .. the custom sidebars/footers i created are showing up in the appearance: widgets section but the content is lost they are all empty ! please help ive been trying to fix all of this for 4days now with barely any seep in between and been on the phone with godaddy but they are clueless :( thank you


Sorting results from JSON-API on custom fields

Is there any way, out of the box, to sort results from the JSON-API plugin based on values in custom fields? The request is paged, so the results will need to be sorted server-side. I have an http request along the lines of:               http://www.example.com/wordpress/?json=get_author_posts&author_slug=user&post_type=custom     &include=title,custom_fields&custom_fields=date_value&count=10&page=1      I'd like to sort on the custom field `date_value`, ideally without having to create a new controller within the json plugin. Is this possible?


Addin plugin custom post type to members plugin

I am using the Wp-Leads plugin and Members plugin and I want to create a new user with the role leads-admin. When I go into the leads-admin role I added these capabilities:               edit_wp-leads     delete_published_wp-leads     delete_wp-leads     edit_published_wp-leads      But when I log in as a user with the role leads-admin and I try to view the leads I get this message: > You do not have sufficient permissions to access this page. Does anyone know how I can get this to work?


permalink changed, now getting 404 for every pages

i have my website with permalink, till now everything was fine, but few days before i changed my permalink, now everything is going wrong, now each and every page i am getting 404, even my about-us and contact us pages, they are giving me 404 page if i come to my site from google or any search engines, then also it gives me 404 i have 1000+ posts on my website, for each post & page from google i get 404 page, but within the website except pages i get no 404 page **my previous permalink:** `%postname%/%category%/` now i added custom taxonomy to my permalink,   **so now it is:**`%location%/%courses%/%postname%` I asked this question first also, but it was into wrong section i guess, thats why asking again and in detail. **Related Question:** custom taxonomies on permalink


Why does my functions.php cause white-screen and media-library issues?

## **Overview:** I was authoring a child-theme, and realized that functions.php was causing problems with the media-library and caused a "white-screen" to appear after editing a post. I fixed the issue by removing all content from my functions.php, but I don't know what was causing this. * * * ## Info: **Production Server:** multi-site, Wordpress 3.8.1 **Local development server** (aka "localhost"): Wordpress 3.8.1 with AMPPS v2.2(php v5.3) in Windows 7 Pro SP1. * * * ## **The Media-Library problem:**   * Upon going to appearance-->Header-->'select image'-->'choose an image from your media library'   * **AND** Upon going to posts-->'all posts'-->'edit post'-->'set-featured image'   * The media library did not show any content, as if my library were empty. This is in spite of going to dashboard-->media-->library, and verifying that there is media-content.   * Also, when attempting to upload a media file (using the above ways), I would always receive an error "an error occurred in the upload. Please try again later" * * * ## The White-Screen problem:   * Upon going to posts-->all posts-->edit post--> update, a white-screen would ensue when clicking the button to update/create a post.   * Using `CNTRL+s` to save the post from within the wysiwyg did not cause a white-screen. * * * ## functions.php This is what functions.php looked like before I fixed the problem by removing all the content.(It turns out that I no longer needed the functions within it anyways). Also on http://pastebin.com/KS66yfqK                    <?php          function cals_fetch_feed2($feed_uri,$num_items, $echo = 1, $length =-1, $exclude=''){     //NOTE: to disable cache, go to feed.php and replace timestamp in      // $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 43200, $url));      $i = rand(1,5);     // Get RSS Feed(s)     include_once(ABSPATH . WPINC . '/feed.php');          // Get a SimplePie feed object from the specified feed source.     $rss = fetch_feed($feed_uri);          if (!is_wp_error( $rss ) ) : // Checks that the object is created correctly               //enable order by date         $rss->enable_order_by_date(true);              // Figure out how many total items there are, but limit it to $num_items.          $maxitems = $rss->get_item_quantity($num_items);               // Build an array of all the items, starting with element 0 (first element).         $rss_items = $rss->get_items(0, $maxitems);      endif;          if($echo == 1){              if (count($rss_items) == 0) {             //echo '
No items.
';             echo 'no items';         } else {             foreach ( $rss_items as $item ) {                       //check for excluded posts                 if($exclude!='' && $exclude == $item->get_id()){                     continue;                 }                           $featuredImageSrc = $item->get_item_tags('', 'featuredimage');                            $featuredImage = $featuredImageSrc[0]['data'];                                ?>                      <?php                   /*if($featuredImage) {*/                          echo '
get_categories() as $category)                         {                             echo $category->get_label()." ";                                       /*$imageCat = $category->get_label();                              if($imageCat == "Agriculture" || $imageCat == "Food" || $imageCat == "Environment" || $imageCat == "Energy" || $imageCat == "Health" || $imageCat == "People" || $imageCat == "Communities" || $imageCat == "Events") {                                  break;                              } else {                                       echo "Announcements ";                             break;                         }*/                              }                          echo '">

';                          $notdisplayed = true;                      if($featuredImage1) {                     echo '';                 } else if($featuredImage) {                     echo '';                 } else {                     echo '

';                     /*foreach ($item->get_categories() as $category)                     {                         $imageCat = $category->get_label();                              if($imageCat == "Agriculture") {                                  echo '';                             break;                         } else if($imageCat == "Food") {                                  echo '';                             break;                         } else if($imageCat == "Environment") {                                  echo '';                             break;                         } else if($imageCat == "Energy") {                                  echo '';                             break;                         } else if($imageCat == "Health") {                                  echo '';                             break;                         } else if ($imageCat == "People" || $imageCat == "Communities") {                                  echo '';                             break;                         } else if ($imageCat == "Events") {                                  echo '';                             break;                         } else {                                       echo '';                             if($i < 5) {                                 $i = $i + 1;                             } else {                                 $i = 1;                             }                             break;                         }                                    }*/                           }                 echo '
';                          echo '

';                     $title = $item->get_title();                     if($length != -1){                         if(strlen($title)>$length){                              echo substr($title,0,$length).'...'; }                          else {                              echo $title;                          }                     } else {                          echo $title;                      }                 echo '

';                 $content = $item->get_description();                  echo $content;                 echo '

';                 echo $item->get_date('F j, Y');                 echo '

';                 echo "-".$item->get_date('Ymd');                 echo '

';                 $cattemp = $item->get_category();                 echo $cattemp->get_label();                 echo '
10
';                                      echo 'get_permalink();             echo '" class="highlight" title="';             echo 'Posted '.$item->get_date('j F Y | g:i a');             echo '">Read more about ';             echo $item->get_title();             echo '

';                       /*}  else {                      //What to display if no image is supplied by the article                      echo '
get_categories() as $category)                         {                             echo $category->get_label()." ";                         }                          echo '">

';                     $title = $item->get_title();                     if($length != -1){                         if(strlen($title)>$length){                              echo substr($title,0,$length).'...'; }                          else {                              echo $title;                          }                     } else {                          echo $title;                      }                 echo '

';                 $content = $item->get_description();                  echo $content;                 echo '

';                 echo $item->get_date('F j, Y');                 echo '

';                 echo "-".$item->get_date('Ymd');                 echo '

';                 $cattemp = $item->get_category();                 echo $cattemp->get_label();                 echo '
10

';                                                          echo '
get_permalink();             echo '" class="highlight" title="';             echo 'Posted '.$item->get_date('j F Y | g:i a');             echo '">Read more about ';             echo $item->get_title();             echo '

';                       }*/              ?>                                 <?php }         }          } else {              return $rss_items;          }     }          /*function soilsextension_enqueue_scripts(){      $handle = 'soilsextension_scripts';      $src = get_theme_root_uri() . '/soilsextension/js/min/master.min.js';          wp_register_script($handle, $src, false, false, true);          wp_enqueue_script('soilsextension_scripts');     }          add_action('wp_enqueue_scripts', 'soilsextension_enqueue_scripts'); */      * * * ## Active Plugins: These were the active plugins during the time I was testing. **Production:** Advanced Custom Fields Version 4.3.5 (http://www.advancedcustomfields.com/), Custom Post type UI Version 0.8.2 (http://webdevstudios.com/plugin/custom-post-type-ui/), Events Manager Version 5.5.2(http://wp-events-plugin.com/), WP Super Cache Version 1.4 (http://wordpress.org/plugins/wp-super-cache/) **Localhost Active plugins:** Advanced Custom Fields Version 4.3.4 (http://www.advancedcustomfields.com/), Custom Post type UI Version 0.8.2 (http://webdevstudios.com/plugin/custom-post-type-ui/) * * * **Attempted Solutions:** I attempted two cases and recorded the results, in effort to understand the cause. > > **Case 1.** >> >>> removing html comment on top of functions.php >>> >>>> **Localhost:** "white-screen problem" is absent. "media-library problem", absent. >>>> >>>> **Production:** "White-screen problem" and "media-library problem both present. >> >> **Case 2.** >> >>> keeping html comment on top of functions.php but removing function cals_feed_fetch2 >>> >>>> **Localhost:** "white-screen problem" is absent." media-file problem" present. >>>> >>>> **Production:** "white-screen problem" is present. media-file problem is present * * * ## Conclusion: * * * Though I appear to have fixed the problems by removing all the content in functions.php, I don't know what part(s) of my original functions.php caused these problems.


How to hide Newsletter plugin submenus from the Dashboard?

I would like to hide some submenus from the Dashboard for non admin users. I'm using the `remove_submenu_page` function but I'm not using it properly since it doesn't work and sub menus are still displayed. http://codex.wordpress.org/Function_Reference/remove_submenu_page I'm trying to hide sub menus from a plugin called Newsletter for non admins :   * wp-admin/admin.php?page=newsletter_main_index   * wp-admin/admin.php?page=newsletter_main_main   * wp-admin/admin.php?page=newsletter_main_diagnostic    * wp-admin/admin.php?page=newsletter_subscription_profile Here's the code I used in functions.php but I can't get it right:                   function ns_remove_admin_menus() {             global $menu;             global $current_user;             if ($current_user->ID != 1) {                 remove_submenu_page( 'admin.php?page=', 'newsletter_main_index' );                 remove_submenu_page( 'admin.php', 'newsletter_main_index' );             }         }         add_action('admin_init', 'ns_remove_admin_menus', 999 );      Any idea how I could make it work?


Calendar based on Codrops

I've been banging my head over this problem for more than a week now and just cound't manage to make it happen. Event though I know that it is possible. I'm building a calendar based on this plugin and I've got it to work almost properly. The only problem I'm facing is that it is not recognizing the post_tyle I made as a source to mark the days with events. You can access the plugin files in the link above if you want to test it yourself and I'll put here the code of the calendar and it's functions. I should mention that I did not build the functions myself, so I don't fully get all the things... calendar in index.php

                         <?php query_posts(array("post_type" => "eventos", "posts_per_page" => -1)); if(have_posts()){ while(have_posts()){ the_post(); ?>                             <div id="evento-<?php the_ID(); ?>" class="infodia entry">
<?php the_title(); ?>
                                 <?php the_content(); ?>
                         <?php } } wp_reset_query(); ?>

      Events Functions               loadEventsCalendar();          var codropsEvents = {         <?php             query_posts(array('post_type' => 'eventos', 'meta_key' => 'vld_date', 'orderby' => 'meta_value', 'order' => 'ASC', 'posts_per_page' => -1));             if(have_posts()){                 $eventsArray = array();                 while(have_posts()){                     the_post();                     $eventDate = get_post_meta($post->ID, 'vld_date', true);                     $eventEndDate = get_post_meta($post->ID, 'vld_dateEnd', true);                          if($eventsArray[$eventDate] == NULL) $eventsArray[$eventDate] = array();                     array_push($eventsArray[$eventDate], '

'.get_the_title().'
+ Saiba mais
');                          if(!empty($eventEndDate) && $eventDate != $eventEndDate){                         list($eventMonth, $eventDay, $eventYear) = split("-", $eventDate);                         $dateObj = mktime(0, 0, $eventYear, $eventMonth, $eventDay);                         list($eventEndMonth, $eventEndDay, $eventEndYear) = split("-", $eventEndDate);                         $dateEndObj = mktime(0, 0, $eventEndYear, $eventEndMonth, $eventEndDay - 1);                              $newDate = $dateObj;                              while($newDate <= $dateEndObj){                             $newDate                = strtotime(strftime("%d %B %Y", $newDate)." +1 day");                             $formattedDate  = strftime("%m-%d-%Y", $newDate);                             if($eventsArray[$formattedDate] == NULL) $eventsArray[$formattedDate] = array();                             array_push($eventsArray[$formattedDate], '

'.get_the_title().'
+ Saiba mais
');                         }                     }                 }                      foreach($eventsArray as $eventDate => $eventDay){                     echo "'".$eventDate."' : '";                     foreach($eventDay as $event){                         echo $event;                     }                        echo "',";                 }             }             wp_reset_query();         ?>     }     function determineEmptyDivs(){         jQuery("#calendar .fc-row > div").each(function(){             if(jQuery(this).html() == '') jQuery(this).addClass("empty");         });         jQuery("#calendar .fc-body > .fc-row").last().addClass("last-row");     }     function loadEventsCalendar(){         var cal = jQuery('#calendar').calendario({                 onDayClick : function($el, $contentEl, dateProperties){                     if($contentEl.length > 0) showEvents($contentEl, dateProperties);                 },                 caldata : codropsEvents,                 displayWeekAbbr : true,                 displayMonthAbbr : false,             }),             $month = jQuery('#custom-month').html(cal.getMonthName()),             $year = jQuery('#custom-year').html(cal.getYear());              jQuery('#custom-next').on('click', function(){             cal.gotoNextMonth(updateMonthYear);             determineEmptyDivs();         });         jQuery('#custom-prev').on('click', function(){             cal.gotoPreviousMonth(updateMonthYear);             determineEmptyDivs();         });         jQuery('#custom-current').on('click', function(){             cal.gotoNow(updateMonthYear);             determineEmptyDivs();         });              determineEmptyDivs();              function updateMonthYear(){                          $month.html(cal.getMonthName());             $year.html(cal.getYear());         }        }     function showEvents($contentEl, dateProperties){         hideEvents();         var $wrapper = jQuery('#custom-inner'),                 $events = jQuery('

Eventos do dia ' + dateProperties.day + ' de ' + dateProperties.monthname + ' de ' + dateProperties.year + '

'),                 $close = jQuery('
').on('click', hideEvents);         $events.append($contentEl.html(), $close).insertAfter($wrapper);         setTimeout(function(){             $events.css( 'top', '0%' );         }, 25);     }     function hideEvents(){         var $events = jQuery('#custom-content-reveal' );         if($events.length > 0){             $events.css( 'top', '100%' );             jQuery(this).remove();         }     }


Completely hide user info

I'm wondering if there's a way to make 100% sure a user's info is not available to the public. Our theme is not currently using a profile page, but I did notice that there is a 'Posts by author' page for each user. Aside from that, is there anywhere else a user's info may show up? I'm hoping to have no info be displayed anywhere on the site, including a user's email address, name, username, etc. The reason for this is that our WordPress user's will have very sensitive information, and that they will not want to be public in any way shape or form. > Question: Where in public/not logged in request can author info be exposed?


Remove 'Visual' tab from TinyMCE editor

I would like to disable the 'Visual' tab so that the 'Text' tab is always used. Is there a clean way to do this besides just doing something like .wp-switch- editor { display:none!important; } ![enter image description here](http://i.stack.imgur.com/wYuG0.jpg)


Unable to get posts with category on my page

I am using wordpress as my CMS. I am thinking, that the left panel has titles of my "posts" under its relevant category and the right side as the title of the post and its content. I have tried to put the following code in a page (after enabling a php plugin for wordpress). But since I dont know php, I tried the below, but it does not display pages with category "basics".               [php]     $myposts = get_posts('numberposts=5&category=basics');      foreach($myposts as $post) :         setup_postdata($post);     //add in standard WordPress post specific template tags here eg.   the_title(),     the_permalink, the_content, the_excerpt etc.     endforeach;     [/php]


Change the look and feel of admin pages

I want to change the look and feel of the post edit page without making changes to any of the wordpress core file, which is basically a theme. For example, for any user with role of 'author', i want to display everything in one column and re-arrange the meta boxes. So is it possible to create a theme for one of the admin pages and how could i get started?


In administration, how do I display comments of a certain user?

From the users section, I can see a link to their posts, but not their comments. When I go to comments, there doesn't seem to be a straightforward way to filter only comments by a specific user. How to do it? (I'm sure such basic feature must be somewhere, I just can't find it.)


Correct way of adding taxonomy to a custom post type

Just something I´ve been wondering for a while: The Codex shows us two ways of attaching a Taxonomy to a Custom Post Type:   1. Using the `taxonomies` argument in the `register_post_type` function   2. Using the `object_type` variable in the `register_taxonomy` function Should we use both methods, or is one enough? And do they give the same result?


Update URL Snippet to Canonical Permalink URL

My permalinks is in the format `domain.com/post-id/post-slug` I notice this is a great choice for permalinks as I can share articles with a short URL like `domain.com/123` But when I go to this short url, should it not redirect to show the full URL, becuase in the adress bar its only showing `domain.com/123` Any setting to do to update the URL to the actual, without putting any additional load or the server. **UPDATE** : My requirement is not to get a shortlink. Rather to convert an URL fragment to the full URL. For eg: If I type `domain.com/123/wrong-slug` it gets corrected to `domain.com/123/correct-slug` but if I type `domain.com/123` it doesn't get corrected to `domain.com/123/post-slug`


Add 32x32 icon to custom post type index page

I've setup an "album" custom post type and want to add an icon on the index page where the RED circle is (see image below; from wptheming.com). Here's my function to replace the icon. The CSS is what I found when I inspected the icon element with firebug:               add_action('admin_head', 'album_foo');     function album_foo() {             global $post_type;         ?>         <style>         <?php if ($post_type == 'album') : ?>               #icon-album.icon32.icon32-posts-album {           background:url('<?php get_template_directory_uri(); ?>/images/album32x32.png') no-repeat;         }          <?php endif; ?>             </style>             <?php     }      I also tried this CSS in the function:               #icon-edit.icon32-posts-album {             background:url('<?php get_template_directory_uri(); ?>/images/album32x32.png') no-repeat;     }      I can't figure out what my CSS is missing, but my icon isn't showing. ![enter image description here](http://i.stack.imgur.com/mrmPp.jpg)


wordpress search result page post_type order

i want to customize the search. what i need is when user search for ex: if user search for **tools** in search result will return result in following manners. **Pages** page 1 page 2 **Posts** post 3 post 8 **Products** product 2 product 8 in above manners. while default search returns the mix result i want to filter the result. first return all the post_type **page** , then after **posts** and at last **products** how to filter search result in such manner. what i did is i check the result with **get_post_type()** but pagination issue occur. pagination will not appear. is there solution for it? here is my code:                    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                     <div class="post post_row clearfix" id="<?php echo $post->post_name; ?>">
              <a href="<?php echo get_permalink($post->ID); ?>" title="<?php the_title();?>">
<?php the_title();?>

 <?php the_time(__('F j, Y', 'example')); ?>

<?php the_category('
'); ?>

                  <?php if(has_post_thumbnail()):?>
<?php the_post_thumbnail("thumbnail");?>
<?php endif; ?>                 <?php the_excerpt();?>
<a href="<?php echo get_permalink($post->ID);?>">read more

                    <?php endwhile; ?>

             <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
               <?php wp_reset_query();?>                      <?php else : ?>
<?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentytwelve' ); ?>
                     <?php get_search_form(); ?>                   <?php endif;?>  <?php endif;?>      **Need Help to have Such a output .**


Wordpress - Creating multiple versions of the same single-customtype.php depending on selected taxonomy categories

I have registered a custom post type 'Clients' and a taxonomy for this post type for categorizing posts. There are currently 3 categories for a Client: 'Logo Project', 'Video Project' and 'Web Design' project. Some Clients may belong to multiple categories. On the Edit Page for a Clients post, I have a Flexible field layout builder that let's you generate 'blocks' of content for each category type (logo, web, video...). Each block will have unique fields relevant to each category (video upload tools for video, image galleries for logo etc..) My issue is, that while I can display relevant content on taxonomy category pages (only show web-design for all Clients that are in the web design category...), once the user clicks to view this Client, the single-clients.php page has no way of ONLY displaying Web Design content and filtering out other 'Content blocks' in cases where a Client has > 1 content block. Ideally I need multiple versions of the clients single template: something like:               1) single-clients-web.php     2) single-clients-logo.php     3) single-clients-video.php     4) single-clients.php (shows all project blocks as it does now)      OR somehow take a referral ID and write a conditional that if the user clicked on the client from the web design category page, the single page they are directed to only shows the web design fields.


Dynamic wp_enqueue_scripts?

Is it possible to call wp_enqueue_scripts dynamically? For example, I want to use in function.php my own function               addThemeJS( true, 'modernizr', THEME_JS_DIR . "/plugins/modernizr.custom.js", array(), false, false );     addThemeJS( true, 'somthing-else', THEME_JS_DIR . "/plugins/somthing-else.js", array(), false, false );      In my core function file:               function addThemeJS( $enqueueThemeJS, $handle, $src, $deps, $ver, $in_footer ) {              function addJS( $handle, $src, $deps, $ver, $in_footer ) {                  wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer );              }               add_action('wp_enqueue_scripts', 'addJS');          }       ... but I can not pass variables ( $handle, $src ) here that I need Suggest me a solution to this problem, please I'm just trying to make something like a mini framework for creating basic things in WordPress. for example, to create the menu, I use this function               / / Create menu:     function addThemeMenu ($ showThemeMenu, $ location, $ description) {          if ($ showThemeMenu):          register_nav_menu ($ location, $ description);          endif;          }      and then call               addThemeMenu (true, 'main', __ ('Main Navigation', 'Theme'));      it's very fast and do not have to rewrite from project to project.


How to set up Wordpress Multisite on multiple domains without plugin?

How to set up Wordpress Multisite, sub-folder setup, on multiple domains without plugin? For expample if I have two domains www.domain-one.com and second www.domain- two.com, i would like to have sites like: www.domain-one.cz - site in root, www.domain-one.cz/anothersite/ - site in subfolder of first domain, then the same posibilities on the second domain, is it posible? Actually i could do it on multiple domains but with change of one condition in wp-includes/ms-settings.php on line 72:               if ( $blogname != '' && ! in_array( $blogname, $reserved_blognames ) && ! is_file( $blogname ) && $domain != 'www.domain-two.com' )      and to be able to log into those sites you have to also put some aditional code to settings.php (this seems not necessary for new wordpress):               if($_SERVER['HTTP_HOST'] == 'www.domain-two.com')         define('COOKIE_DOMAIN', 'www.domain-two.com');      With this, quiite simple solution, you can have multiple sites but no sites with subfolders within those aditional domains, you can have subfolder sites only for main domain (and then multiple aditional domains). Actually if there is no option to do this without plugin and without changing code of core, if there option to do ti with change of core? Or is there some plugin which can do exactly this? What about sunrise.php is it posible with this?


Install a Network under a mapped domain

I'm already running a WordPress installation just fine under a mapped domain. The current setup points `(www).sample.com` to `/sample/` within `domain.com`, and it works fine. In the Create A Network section of the WP Codex, it states _"Domain mapping, however, will not work"_ but I would like to know if it is possible to make this installation into a network by manually editing the .htaccess file or some configuration somewhere. I feel like this should be possible, I can't see a reason why it couldn't be done, it's just complicated. Any input would be greatly appreciated.


tax_input argument for wp_insert_post()

I'm trying to insert custom taxonomies using `wp_insert_post()` and the `tax_input` argument, but it doesn't work. I want to set a post to a custom taxonomy ('types') and a category ('cars')               $new_post = array(                  'post_title'    =>   $title,                  'post_content'  =>   $description,                  'tax_input' =>   array('types' => array('cars')),                    'post_status'   =>   'pending',                            'post_type' =>   'vehicles'                    );


form to post multiple inputs into post_content

I have a form, with multiple inputs that I am trying to get posted to the wordpress "post_content". I am able to get the title field and only one other field to post successfully, only when making a field name "description" instead of "description[]", but have no idea how I can get the rest to submit into the post_content. I would like the inputs posted like the image I have created below. ![enter image description here](http://i.stack.imgur.com/dRjCS.jpg) Here is the code I currently have that works for the title only.


Does auto_load to 'no' in wp_options improve performance

I am trying to improve the performance of a wordpress based blog. I am looking at wp_options table and am thinking to set the column auto_load to 'no'. Does it have any side-effect on the site itself ? Does it improve the performance of the site ?


Wordpress Admin Bar pushed Sticky Footer off the bottom of the page

I've implemented Ryan Fait's oh-so-common sticky footer in a custom Wordpress theme. I've noticed now if I implement the Wordpress Admin Bar into my pages, which is 28px high (in current Wordpress version at least...), it pushes the sticky footer down 28px as well. Here's the admin bar: ![enter image description here](http://i.stack.imgur.com/urpWt.jpg) Anyways, the way Wordpress works is that the Admin Bar does or does not show up at the top of the pages depending on how Admin users set their preferences. So I do not want to simply remove it fro the theme. I could obviously use jQuery after the ready event fires to see if the Admin Bar is there or not and alter the footer accordingly, but I'd rather try to avoid this if possible and just have the page generate properly to begin with... Any ideas? Also I want the theme to work with near-future versions of Wordpress. So if in a future version they decide to change the admin bar to something other than 28px high, then I don't want my code to have to be adjusted to compensate for the change.


Shortcode registered from a plugin not recognized

I'm coding a really simple plugin to add some slideshows to my theme. I also want to register a shortcode to invoke them from my pages. So far I have this:               class Slideshow {          public function __construct() {              // Register the project custom post type         add_action( 'init', array( $this, 'ss_register_slideshow_type' ), 0 );         add_action( 'init', array( $this, 'ss_register_shortcodes' ), 0 );     }          function ss_register_slideshow_type() {}          function ss_register_shortcodes() {         add_shortcode( 'embed-slideshow', 'ss_shortcode_embed_slideshow' );     }          function ss_shortcode_embed_slideshow( $atts ) {         return 'Foo';     }          }          // init     $slideshow_instance = new Slideshow();      I omit the custom post type registration for brevity. The custom post type gets registered, but when I try to call the shortcode in a page with               [embed-slideshow]      nothing happens. I mean, I get [embed-slideshow] written. I've registered another shortcode from my theme functions and it works well. Am I missing something really obvious? Any idea? Thanks!


Can't access login page after password reset

After completing the WordPress reset password procedure I try to login with the new password but I get an error saying:               'Authorization Required. This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.'      The password has been changed but I have to use a different browser in order to view the login page and be able to login. Once this happens I can't view the login page even after deleting all the cookies. If I repeat the same procedure on a different browser the same thing happens. Does anybody know what may be the cause of this ? Thank you


jQuery ajax call throws an HTTP 302

I'm trying to implement a jQuery Autocomplete where the Autocomplete gets its data from a ajax source. However, for some reason when I make the call it results in a 302 which in turn results in a 404. This is what I have: **In functions.php:**               function my_ajax_foo() {       die("OK");     }          add_action('wp_ajax_my_ajax_foo', 'my_ajax_foo' );     add_action('wp_ajax_nopriv_my_ajax_foo', 'my_ajax_foo' );      **My Javascript:**               function onGetData(term, callback) {       jQuery.post( "http://mydomain.com/wp-admin/admin-ajax.php", {         action: "my_ajax_foo",         cookie: encodeURIComponent(document.cookie),         term: term       },       function( response ) {         console.log( response );       } );     }          jQuery(document).ready(function() {       jQuery("#my_input_field").autocomplete( { source:onGetData } );     });      All the Javascript is loaded correctly. When I type in the Autocomplete input box the ajax call is made but I can see in Firebug that the call results in a HTTP 302. When I call the `http://mydomain.com/wp-admin/admin-ajax.php` simply from the browser URL I get a `-1` returned so I know that the URL exists. Any help much appreciated.


Create A Metabox For A Custom Field

I add videos to my WordPress posts' video format by using custom fields. I was wondering if there is any way to create a meta box in post editor (like excerpt or something) for that specific custom field. Just a text area to add iframe code. For example the custom field is a embed-video.


Calling the_excerpt from inside a plugin template file

Im trying to use the_excerpt form inside a plugins template file, plugin is wp-favorite-posts by default the plugin only lists and displays the saved post title, i have manged to get it to show everything, tax terms, image etc but having a heck of a time with the_excerpt, what happens when i add `<?php the_excerpt( $post_id ); ?>` into the code is a continual looping of the favorite post and no excerpt. Im using `global $post` so that i can get all the info (cept the excerpt)               <?php          global $post;          if (!empty($user)):         if (!wpfp_is_user_favlist_public($user)):             echo "$user's Favorite Posts.";         else:             echo "$user's list is not public.";         endif;     endif;          if ($wpfp_before):         echo "
".$wpfp_before."
";     endif;               if ($favorite_post_ids):         foreach ($favorite_post_ids as $post_id) {            $p = get_post($post_id); ?>

                            <?php if (strtotime($post->post_date) > strtotime('-7 days')) { ?>                                <img src="<?php echo get_template_directory_uri(); ?>/images/new.png" alt="latest property listings" />                            <?php } ?>

                                                            <?php                                 if ( 'sales' == get_post_type($post_id) ) {                                     echo 'Property For Sale';                                } elseif ( 'rentals' == get_post_type($post_id) ) {                                     echo 'Property For Rent';                                 } elseif ( 'business' == get_post_type($post_id) ) {                                     echo 'Business For Sale';                                 } elseif ( 'bandb' == get_post_type() ) {                                     echo 'Bed And Breakfast';                                 }                                ?>                                                                                <a href="<?php echo get_permalink($post_id); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'themename' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php echo get_the_title ( $post_id ); ?>

                              <?php                           echo "";                         echo get_the_post_thumbnail ( $post_id, 'medium' );                         echo "";                         ?>

                              <?php                         if ( 'sales' == get_post_type($post_id) ) {                              echo '
' . get_the_term_list( $post_id, 'property_type', 'Property Type: ', ' ', '' ),'   ' . get_the_term_list( $post_id, 'location', 'Location: ', ' ', '' ),'   '.get_the_term_list( $post_id, 'region', 'Region: ', ' ', '' );                         } elseif ( 'rentals' == get_post_type($post_id) ) {                              echo '
' . get_the_term_list( $post_id, 'property_type', 'Property Type: ', ' ', '' ),'   ' . get_the_term_list( $post_id, 'location', 'Location: ', ' ', '' ),'   ' . get_the_term_list( $post_id, 'region', 'Region: ', ' ', '' );                         } elseif ( 'business' == get_post_type($post_id) ) {                              echo '
' . get_the_term_list( $post_id, 'property_type', 'Property Type: ', ' ', '' ),'   ' . get_the_term_list( $post_id, 'location', 'Location: ', ' ', '' ),'   ' . get_the_term_list( $post_id, 'region', 'Region: ', ' ', '' );                          }                          ?>

              <?php         }     else:              echo $wpfp_options['favorites_empty'];          endif; ?>     <?php wpfp_clear_list_link(); ?>     <?php wpfp_cookie_warning(); ?>        First picture is using the_excerpt ![with the_excerpt](http://i.stack.imgur.com/yHO9z.jpg) Second picture is without the_excerpt   ![without the excerpt](http://i.stack.imgur.com/ZHSVr.jpg)


Register Template

I created a register template for Wordpress with some ajax so that users can click on the register link in my header and the register form opens up in a lightbox. For some reason on submit, if there is an error or success message my form gets displayed twice. Any help appreciated. I am confused because I have almost identical code for my login page with no issues. Here is the code:               <?php     /**     * Template Name: Register     */          /* Load registration file. */     require_once( ABSPATH . WPINC . '/registration.php' );          /* Check if users can register. */     $registration = get_option( 'users_can_register' );          /* If user registered, input info. */     if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'adduser' ) {     $user_pass = wp_generate_password();     $userdata = array(         'user_pass' => $user_pass,         'user_login' => esc_attr( $_POST['user_name'] ),         'first_name' => esc_attr( $_POST['first_name'] ),         'last_name' => esc_attr( $_POST['last_name'] ),         'nickname' => esc_attr( $_POST['nickname'] ),         'user_email' => esc_attr( $_POST['email'] ),         'user_url' => esc_attr( $_POST['website'] ),         'aim' => esc_attr( $_POST['aim'] ),         'yim' => esc_attr( $_POST['yim'] ),         'jabber' => esc_attr( $_POST['jabber'] ),         'description' => esc_attr( $_POST['description'] ),         'role' => get_option( 'default_role' ),     );          if ( !$userdata['user_login'] )         $error = 'A username is required for registration.';     elseif ( username_exists($userdata['user_login']) )         $error = 'Sorry, that username already exists!';     elseif ( !is_email($userdata['user_email'], true) )         $error = 'You must enter a valid email address.';     elseif ( email_exists($userdata['user_email']) )         $error = 'Sorry, that email is already registered!';     elseif ( !$userdata['first_name'] )         $error = 'Please kindly enter your First Name.';     elseif ( !$userdata['last_name'] )         $error = 'Please kindly enter your Last Name.';          else {         $new_user = wp_insert_user( $userdata );         wp_new_user_notification($new_user, $user_pass);         echo '
Thank you for Registering!
Please check your email address. That\'s where you\'ll recieve your login password.
 (It might go into your spam folder)
';     }           }          ?>                    <?php if (!$new_user) { ?>
<?php echo $error; ?>

                  <form method="post" id="adduser" class="user-forms" action="<?php echo "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>">
                     <?php _e('Email Address *', 'frontendprofile'); ?>                     <input class="text-input" name="user_name" type="text" id="user_name" value="<?php if ( $error ) echo wp_specialchars( $_POST['user_name'], 1 ); ?>" />

                     <?php _e('First Name', 'frontendprofile'); ?>                     <input class="text-input" name="first_name" type="text" id="first_name" value="<?php if ( $error ) echo wp_specialchars( $_POST['first_name'], 1 ); ?>" />

                     <?php _e('Last Name', 'frontendprofile'); ?>                     <input class="text-input" name="last_name" type="text" id="last_name" value="<?php if ( $error ) echo wp_specialchars( $_POST['last_name'], 1 ); ?>" />

                     <?php _e('E-mail *', 'frontendprofile'); ?>                     <input class="text-input" name="email" type="hidden" id="email" value="<?php if ( $error ) echo wp_specialchars( $_POST['email'], 1 ); ?>" />

                     <?php echo $referer; ?>                     <input name="adduser" type="submit" id="addusersub" class="submit button" value="Register" />                     <?php wp_nonce_field( 'add-user' ) ?>                     <input name="action" type="hidden" id="action" value="adduser" />
                  </form>                                 <?php }  ?>


Unable to get the upcoming events for custom post

I have custom post ='events' and there is custom field 'event-start-date' for each events. I want to show the upcoming events for which I am using the following code.               $date_today = time();                      $meta_query_args=array('key' => 'event-start-date',                                             'value' => $date_today,                                             'compare' => '>',                                            );                          $loop = new WP_Query( array(                                                   'post_type' => 'events',                                                  'posts_per_page' => 5 ,                                                  'meta_key'   =>   'event-start-date',                                                  'orderby' => 'event-start-date',                                                  'order'=>'desc',                                                  'meta_query' => $meta_query_args                                                   )                                         );      But this is giving me all the posts, even those which are not upcoming i.e `'event-start-date' < $date_today`. What is it that I am doing wrong?


wp_enqueue & youtube API on different templates

I'm trying to use the youtube API on two of my template pages. Obviously I want to enqueue it correctly. When I put this code in my footer.php page, I got it to work:                                    Seeing that it works, I deleted it and placed the following code in my function.php file. My youtube_js.js file is down below. It's not working, and I'm not sure why, any suggestions? Am I supposed to add anything in my template-name.php files?               add_action ( 'wp_enqueue_scripts', 'dtrou_youtube_api' );          function dtrou_youtube_api() {         wp_register_script( 'dtrou-youtube', get_template_directory_uri() . '/js/youtube_js.js', array('jquery'), '', true );         wp_register_script( 'youtube-subscribe-btn', 'https://apis.google.com/js/plusone.js', array(), '', true );         wp_register_script( 'youtube-subscribe-featured', 'http://gdata.youtube.com/feeds/users/droptroucomedy/uploads?alt=json-in-script&callback=vidinfolist&max-results=1', array(), '', true );         wp_register_script( 'youtube-subscribe-videos', 'http://gdata.youtube.com/feeds/users/droptroucomedy/uploads?alt=json-in-script&callback=vidinfolist&max-results=100', array(), '', true );          if ( is_page_template('t-featured.php') ) {         wp_enqueue_script('dtrou-youtube');         wp_enqueue_script('youtube-subscribe-featured');         wp_enqueue_script('youtube-subscribe-btn');     }          if ( is_page_template('t-videos.php') ) {         wp_enqueue_script('dtrou-youtube');         wp_enqueue_script('youtube-subscribe-videos');         wp_enqueue_script('youtube-subscribe-btn');     }     }      youtube_js.js file.               function vidinfolist(data) {     var dat = data.feed.entry;     var pageOutput = '
';     for (var i=0; i<data.feed.entry.length; i++) {     var datID=dat[i].id.$t.substring(38);     var datTitle=dat[i].title.$t;     var datDescription=dat[i].media$group.media$description.$t;     var datThumbnail=dat[i].media$group.media$thumbnail[0].url;     pageOutput += '

' + datTitle + '
';     pageOutput += '

' + datDescription + '
';     pageOutput += '

';     pageOutput+='
';     }     document.getElementById('videoCode').innerHTML = pageOutput;     pageOutput +='
';     }


new multisite, old db

I'm trying to get my old posts from a WP install that was in a sub-directory on my site, into a new Multisite install on a new host. The new install is doing what it should. the problem is the posts are in a database with a different table prefix. i'll admit that i didn't think it would be this difficult. but i need it to either pull from the correct prefix `wed_` not `wp_2_` _or_ replace all the data in `wp_2_` with the data from `wed_` thanks. **ANSWER** after some poking around some mysql websites, i found that find/replace isn't really straight forward. lets assume that the database table prefixes in question are `new_` and `old_` and that i want to replace `new` with `old` myphpadmin has an option of **change prefix** , here are the steps i did to correct my issue.   1. export the sql databases to my desktop as a backup.    2. change `new_` to `bak_new_`   3. change `old_` to `new_`     * since nothing else has changed wordpress is still pulling from the `new_` tables, but has `old_`'s data.      * this works! but no images.    4. export the new `new_` to the desktop.    5. open in a text editor and find/replace all the old urls that should point to your images to your new url.      * when using multisite installs the upload folder has new subfolders.        * new path: `http://example.com/wedding/wp-content/uploads/sites/2/2014/06/program03.jpg`       * old path: `http://example.com/wedding/wp-content/uploads/2014/06/program03.jpg`     * note the added `sites/2` in the new path.      * save  In myphpadmin   1. select all the `new_` tables and drop them.      * this deletes them, after giving a warning that asks if you _really_ want to do this. click yes.    2. import the file with the replaced urls with the same `new_` prefix.  **done** upload all the images to the new path of the server and verify that everything works. then delete the `bak_new_` tables since they're useless now. now all the old data from my old/incorrectly install site works on the new multisite install.


Custom Blog Loop on Home Page

I wanted to see if it was possible to display the "newest" post from all top level post categories on the home page using args in the loop? See http://blog.reneerouleau.com/dev/ for example of what I currently have set up. I'm running shoestrap wp.               <?php      wp_reset_query();          $cats = get_categories('');     foreach ($cats as $cat) :          if($cat->category_parent)  continue; //this line avoids to show posts of sub categories          $args = array(     'posts_per_page' => 1,     'category_name' => $cat->slug,);          query_posts($args); // reset to original     ?>      **UPDATE** Still not working with below updated code - I think I might need to put that while have post loop in the above new code -- any idea?               <?php get_template_part( 'templates/page', 'header' ); ?>
     <?php do_action( 'shoestrap_index_begin' ); ?>      <?php if ( !have_posts() ) : ?>
         <?php _e( 'Sorry, no results were found.', 'shoestrap' ); ?>
       <?php get_search_form(); ?>     <?php endif; ?>     <?php      $cats = get_categories('parent=0');     foreach ($cats as $cat) :       $args = array(         'posts_per_page' => 1,         'category__in' => array( $cat->term_id ) );       $top_cat_query = new WP_Query($args);       if( $top_cat_query->have_posts() ) while( $top_cat_query->have_posts() ) :           $top_cat_query->the_post();         //output       endwhile; wp_reset_postdata();       //..etc..     endforeach;      ?>     <?php while ( have_posts() ) : the_post(); ?>              <?php do_action( 'shoestrap_in_loop_start_action' ); ?>         <?php get_template_part( 'templates/content', get_post_format() ); ?>          <?php endwhile; ?>

     <?php if ( $wp_query -> max_num_pages > 1 ) : ?>

<?php next_posts_link( __( '← Older posts', 'shoestrap' ) ); ?>

<?php previous_posts_link( __( 'Newer posts →', 'shoestrap' ) ); ?>

            <?php endif; ?>
     <?php do_action( 'shoestrap_index_end' ); ?>'


Custom Post Type Taxonomy Term Order by Title

I have a custom post type of Clients. The "Client Categories (taxonomy terms)" are called via taxonomy-client.php. I'm able to get the results to output as expected but I can't figure out how to get them to order by title. Here is the code I'm using:               <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>         <?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
<?php the_title();?>

<?php the_content(); ?>
     <?php endwhile; ?><?php endif; ?>       Thanks in advance


Use same login information on multiple wordpress installations?

I am creating a website where there are three modules, and two require the same login information, but they must have different wordpress installations. So, is there any way to implement this.


Where these arguments are defined?

I want to make 2-line navi, and found this code.               add_filter('walker_nav_menu_start_el', 'description_in_nav_el', 10, 4);          function description_in_nav_el($item_output, $item, $depth, $args)     {         return preg_replace('/(<a.*?>[^<]*?)</', '$1' . "<span>{$item->post_content}</span><", $item_output);     }      http://pastebin.com/Fw3e0wqC Where come from these arguments `$item_output` and `$item`? I know `$item_output` is nav_menu html source and $item is nav_menu, but I don't know in which function the html are generated.


Allow only attachment uploaded to current post

The "Add Media" button allows any media to be added to current editor. I need the "Uploaded to this page" from the dropdown menu to be the only option available. Some time ago I found a solution somewhere like this:               jQuery(function($){         $(document).on("DOMNodeInserted", function(){             // Lock uploads to "Uploaded to this post"             $('select.attachment-filters [value!="uploaded"]').remove()             $('select.attachment-filters').trigger('change');         });     })      However, this event conflicts with my other plugin because that plugin will insert more than 100 nodes and this code snippet will slow that process down very much: it takes 2 minutes longer to load with this event attached. Therefore, I am looking for a better solution that will save the time and browser's resource here. Any suggestion is welcome!


How to make sticky posts for category pages

how do I make certain posts to stay at the top for each category page. That is I want sticky posts for category pages. Thanks


how to use ajax in plugin admin area?

I tried ajax to get some info a php inside my plugin.but getting error-call to undefined function. **Ajax**               jQuery.ajax({             type: "POST",             url: "<?php echo plugins_url();?>/tester/inc/test.php",             data: { param: 'st1' }           }).done(function( msg ) {                  alert( "Data Saved: " + msg );          });      Error in alert               Data Saved:

( ! ) Fatal error: Call to undefined function add_action() in E:\wamp1\wamp\www\wp_twentythirteen\wp-content\plugins\tester\inc\test.php on line 7

Call Stack

#	Time	Memory	Function	Location

1	0.0007	254944	{main}(  )	..\test.php:0

      test.php               <?php     function aj()     {      echo "hello";     echo plugins_url();     }     add_action('wp_ajax_my_action','aj');      add_action('wp_ajax_nopriv_myFunction','aj');            ?>      i think the error denote like am not inside wordpress. Any idea?


Wordpress postmeta: Store data as an array or single item?

I know it could be difficult to query a single item that saved in an array in wordpress postmeta table, but I have lots of metadata for a single post which may create too many rows for the postmeta table. So, I guess it might be better to save the meta in an array for each post, then, create an object to query the meta so that I can access the data by `$obj->meta1.` My question is:   1. Will it be really bothering when the postmeta table has too many rows?   2. Does saving data as array really solve my doubts?


Manipulating register_post_status() setup on pageload

This is a long shot, but I spend hours here to find answers, so I post a question. When register custom post status in my functions.php. Can I provide diffrent parameters for diffrent user views? Will this type of manipulating totally be out of how to? Here is my code:               function my_custom_post_status(){     if(current_user_can( 'update_core')) $p = true;         else $p = false;     register_post_status('archive', array(         'label'                     => _x( 'Archive', 'post' ),         'public'                    => $p,         'exclude_from_search'       => true,         'show_in_admin_all_list'    => true,         'show_in_admin_status_list' => true,         'label_count'               => _n_noop( 'Archive (%s)', 'Archive (%s)' )     ));     }     add_action( 'init', 'my_custom_post_status' );      This actually is working, but do I mess with the database or are this kind of register just a page to page load variables? ( I mean, "register", is it just instructions how to handle the "already stored" and "to be stored" in the database? ) Don ask why Im doing this (!), just if I can do it -or if Im making a mess... Thanks to all of you who contributes on this forum !


Modify a parent theme's PHP file, and save in child theme

I'm working with a paid theme, and we're using a child theme to display a slightly different design. The parent theme has a file called /includes/forms/register-form.php I'd like to customise this file, and save it in my child theme. How do I tell Wordpress to use my child theme's version of this file, instead of my parent theme's version?


Adding custom code into header.php using a plugin

I have a bunch of code that I tend to put into the `header.php` of every site I do which are specific to Internet Explorer. I was wondering if there was a way to insert code into a 'standard' `header.php`. Yes, I can simply modify the header. But the idea is to make this a plugin which is generic. Specifically, I'd like to create a plugin to echo the following in the header immediately after the default stylesheet:               <!--[if IE]>       <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/ie.css" type="text/css" />     <![endif]-->


Child Theme vs. Jetpack Editor

I have read that it is always desirable to create a "child theme" so that any changes I make don't get washed away if the main theme is updated. However, one of Jetpack's features is a CSS editor that lets me override the theme's default style.css. Therefore the original style.css is never edited. Does that provide enough protection against the updating problem so that creating a child theme is no longer necessary?


Help debugging PHP filter for wordpress

I have a PHP filter for wordpress/gravityforms, that just recently stopped working and I can't figure out why. Can anyone help me? Here's the code:               add_filter('gform_pre_submission_2', 'create_company_full_name', 10, 2, 'input_7', 'input_6', 'input_1');          add_filter('gform_pre_submission_1', 'create_company_full_name', 10, 1, 'input_3', 'input_4', 'input_77');          add_filter('gform_pre_submission_26', 'create_company_full_name', 10, 26, 'input_7', 'input_6', 'input_9');          function create_company_full_name($entry, $form, $first, $last, $company){         $field_we_are_checking = $company;         $name = $_POST[$first].' '.$_POST[$last];         if(empty($_POST[$field_we_are_checking])){             $_POST[$field_we_are_checking] = $name;         }         return;     }      What it does/did is check if the person left the Company field blank, and if so, put the First and Last name in the Company field before submission. It does that for 3 different forms. If I knew how to debug PHP, I would try it myself. But there's nothing like msgboxes or any other way to test things out. Can anyone point me in the right direction? Much appreciated! Updated code:               add_filter('gform_pre_submission_1', 'create_company_full_name', 10, 2);     //      function create_company_full_name($entry, $form){         switch($form){             case 1:                 $field_we_are_checking = $_POST['input_77'];                  $name = $_POST['input_3'].' '.$_POST['input_4'];                  break;             case 2:                 $field_we_are_checking = $_POST['input_1'];                  $name = $_POST['input_7'].' '.$_POST['input_6'];                  break;             case 26:                 $field_we_are_checking = $_POST['input_9'];                  $name = $_POST['input_7'].' '.$_POST['input_6'];                  break;         }               if(empty($_POST[$field_we_are_checking])){               $_POST[$field_we_are_checking] = $name;           }           return;     }


How to display 7 most recent days of posts?

I would like to be able to display on my homepage a timeline of posts from 7 of the most recent days. For example, if today is January 1, 2013, I would like my blog feed to display something that looks like the following:   1. January 1, 2013 All the posts from this day   2. December 31, 2012 All the posts from this day   3. December 30, 2012 All the posts from this day   4. December 29, 2012 All the posts from this day   5. December 28, 2012 All the posts from this day   6. December 27, 2012 All the posts from this day   7. December 26, 2012 All the posts from this day Essentially, this feed should always display 7 days worth of posts. In effect, when January 2nd comes, December 26 would be hidden and everything gets bumped by one. This isn't outputting working quite how I would like it as when a new week comes along, it will only show 1 day worth of posts, so basically the only day that shows 7 days worth of posts is the 7th day of that week:
         <?php              $day_check = '';             $today = get_the_date();             $year = date('Y');             $week = date('W');             $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                 $args = array(                     'post_type'=>'post',                     'category_name' => 'whats-happening',                     'year' => $year,                     'w' => $week,                     'paged'=>$paged                 );                 $temp = $wp_query;                 $wp_query = null;                 $wp_query = new WP_Query($args);                  if (function_exists('wp_pagenavi')) { wp_pagenavi(); }             if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();                 $day = get_the_date('j');                 if ($day == $today) {                     echo "
Today
";                     $counter = 0;                 } elseif ($day != $day_check) {                     echo "
" . get_the_date() . "
";                     $counter = 0;                 }                 if ($counter % 3 == 0) {                     $apply_css_margin = TRUE;                 }                 elseif ($counter % 3 == 1) {                     $apply_css_margin = TRUE;                 } else {                     $apply_css_margin = FALSE;                 }                 $counter++;         ?>         <article id="post-<?php the_ID(); ?>" <?php if($apply_css_margin) { post_class('news-timeline-margin'); } else { post_class(); } ?>>             <a href="<?php the_permalink(); ?>">

By <?php the_author(); ?>

<?php the_title(); ?>

                 <?php the_post_thumbnail('homepage-features-news'); ?>
         <?php $day_check = $day; endwhile; endif; ?>                       <?php if ($wp_query->max_num_pages > 1) : ?>
                 <?php next_posts_link('←previous'); ?>                 <?php previous_posts_link('Newer next'); ?>
         <?php endif; ?>                       <?php             if (function_exists('wp_pagenavi')){wp_pagenavi();}             $wp_query = null;             $wp_query = $temp;             wp_reset_query();         ?>


WP Query with multiple tags by get the tags

I need to do a wp query that will get any post that has one tag or more. My current code work for one tag, but I've try for multiple with the codex and I can't do... can you help me ? Thank's !               <?php     global $post;     foreach(get_the_tags($post->ID) as $tag) {     }     $recent_posts = new WP_Query(array(     'cat'  => 20,     'tag_slug__in' => $tag->name . ', ',     'showposts' => 2     ));     ?>


How to return hook data when multiple parameters are present?

What is the proper way of returning data to a hook when there is more than one parameter present? **Example** `apply_filters('image_downsize', false, $attachment->ID, $size)` **Attaching a callback function:**               function wpse_test_hook($param1, $param2, $param3){          }     add_filter('image_downsize', 'wpse_test_hook');      How do I return data from my callback, so that it returns properly for the hook to use?


Installing multisite on domain with existing subdirectory wordpress installations

I have a domain that already has a number of wordpress installations in existing subdirectories. I would like to activate wordpress multisite to manage so new subdirectory installations with a new template. The concern I have is that on activating multisite it's prompting me to clear all database tables for the existing installation. Will this cause a problem for the 20+ existing installations?


How to Retrieve data of Gallery Shortcode and display it above a post

I'm trying to style my theme without resorting to custom fields. For gallery posts type, most premium themes are using custom field which is the method I used till now. With it, I could then retrieve the attachment ID's and display the images in a slideshow above the post title & content. However this results in theme lock, and I was wondering if there is any way to do the below:   1. Retrieve the first gallery shortcode used in a post to output the images as slideshow above the Post title and    2. also remove the shortcode from within the post so it is not displayed again in the content.  I understand it would involve lot of code so if anyone could just point me in the right direction would be appreciated. I know bit of PHP and can tweak code but not great with creating something from scratch.


Are plugins instantiated on every request to Wordpress?

I want to know how wordpress plugins are instantiated, if Wordpress creates a instance of plugins every time that a request is made to wordpress? Example. I open /wp-admin: The plugin is instantiated I open /: The plugin is instantiated ... etc


How to total cache a specific PHP file?

How do I cache specific file in WordPress? I have a file in a theme in WordPress and W3 Total cache. The file has a `.php` extension and is loading dynamic CSS from database. It takes too much time to load current settings from DB so it's slowing down page significantly. How can I set W3 Total Cache so it caches the file?


Query the database after get_header() has been included

I'm trying to create a custom template. Iv'e searched a lot but cannot find how to query the database once the get_header() is added to the page. What I am looking for is for PROPER ways to query the database. Thanks Update: basically i added my own tables to the database. Including the header in my template SHOULD automatically include also the necessary database connection used by wordpress. My question i how to use this open database connection to query the database and read data from my custom tables. for instance, how is the mysql-connection object called, and how do i execute a query the proper way. (I know how to make a query in general, but i want to avoid to use unneded code if it is already provided, and i would like to avoid spaghetti- coding.) this is what i have so far:               global $wpdb;     $querystr = "SELECT *FROM mytable WHERE name ='".$name."'";     echo $querystr;     $gmdata = $wpdb->get_results($querystr, OBJECT);          foreach ($gmdata as $gm)     {     echo $gm[1]."<br>";          }      Thanks!


How to stop Wordpress creating URLs that dont exisit

I have a website that is constantly created URLS that don't exist. For example a category section that only has 2 pages in it, for some reason is allowing the creation of other URLS - see below eg: http://www.exmaple.com/products/page/11142/311355/909238/12807/ There is actually only one url eg: /page/2/ I have no idea why and how it is doing this, and would very much like some help please. Google is also indexing these pages with the made up numerical additions, and I would like to clear asap. Many thanks in advance for any help with this.


How to have content scroll over background

I'm attempting to modify the latest version of the mystique theme, and would like to have it so when I select a background, the page will lock that background into page, but have the content scroll over top of it. Currently the content scrolls, but the background scrolls with it, leaving an awkward spot where the background no longer exists. Would anyone know how this effect could be done?


Using a Multi Site Users Blog ID as a WP Prefix

I'm trying to update a plugin so that the prefix for the defined tables is taken from the ID of the posts authors site This is what I am trying to do at the moment               function {     global $authordata, $post, $wpdb;     //Get author id from current post     $wpnewprefix = $authordata->ID;     $prefixids = get_blogs_of_user($wpnewprefix);     //Get second blog id     $wpnewprefix = $prefixids{2}->userblog_id;     //Define tables     define('Settings_table', 'wp_'. $wpnewprefix .'settings');     define('schoolevent_table', 'wp_'. $wpnewprefix .'schoolevent_calendars');     }      At the moment I can't seem to get the author ID to pull on the current post object being viewed. Does anyone have any suggestions?


Upload files to wp-content/uploads - What to add in DB?

Given that I upload a file to `wp-content/uploads` via FTP, what are the records that I should create in the DB in order for the MediaManager to recognize those new uploads?


How to stop WordPress from changing ellipsis into a pre-composed triple-dot glyph?

When I type an ellipsis composed of three separate dots `...`, WordPress displays the pre-composed triple-dot glyph `…` instead. Is there any way to prevent WordPress from substitution the three dots?


Filter terms bases on multiple taxonomies - operator not in?

Building a function for filtered taxonomies. How to use 'operator' => 'NOT IN' or 'operator' => 'IN' inside the query to only show `tax_query` terms that are connected to all taxonomies instead of results that meet only one of multiple taxonomy.               if (!$is_search) {     $filters = explode(',', $filters);     $query_args = array(         'posts_per_page' => 30,         'post_type'      => $post_type,         'post_status'    => 'publish',         'paged'          => $pg      );          $terms = array();     foreach ($filters as $f) {         if (!empty($f) && is_numeric($f) && $f > 0) {         $terms[] = $f;     }}          if (!empty($terms)) {                 if (!is_array($query_args['tax_query'])) $query_args['tax_query'] = array();                 $query_args['tax_query'] = array(                'relation' => 'OR',      array(                     'taxonomy' => $post_type,                     'terms'    => $terms,                     'field'    => 'id',                          ));             }          $queried_items = new WP_Query($query_args);     } else {     global $wp_query;     $queried_items = $wp_query;     }          foreach ($queried_items->posts as $p) {     $taxonomy = str_replace('%#%', $p->post_type);     $p->taxonomy = array();     $pfields = array("fields" => "all");     $terms = wp_get_post_terms($p->ID, $taxonomy, $pfields);     $assgined_terms = array();     if ($terms && is_array($terms) && !empty($terms)) {         foreach ($terms as $term) {     if (!in_array($term->parent, $assgined_terms)) {         $p->taxonomy[] = $term;         array_push($assgined_terms, $term->parent);     }}  }     }}      _This is a related question to a previous one._ The current code shows all the results, as expected. First I tought about the relation OR/ AND for results, but I believe I should work with 'operator' => 'NOT IN' to query the results.


Always show same size tags for Tag Cloud in Wordpress Admin

I wanted to know if there was a way to modify the back-end of Wordpress to do 2 things:   * Make all tags' font the same size, so none are larger than the others   * Always show the most used tags when creating/editing a post This only applies to the back-end of Wordpress, not calling the tag cloud or any sort of front-end CSS that would be found in the theme.


Is it possible to incorporate username in a login redirect?

I'm using WP to work as the CMS for a website which will be provided to users of a number of different products. I've successfully created a function which will redirect users based on their role:               add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );     function my_login_redirect( $redirect_to, $request, $user ) {     if ( is_array( $user->roles ) ) {         if ( in_array( 'administrator', $user->roles ) )             return home_url( '/wp-admin/' );         elseif ( in_array( 'editor', $user->roles ) )             return home_url( '/wp-admin/' );         elseif ( in_array( 'subscriber', $user->roles ) )             return home_url();         elseif ( in_array( 'map_user', $user->roles ) )             return home_url( '/mapping/' );         elseif ( in_array( 'news_subscriber', $user->roles ) )             return home_url( '/category/newsletter/' );         else             return home_url();     }      Some users need to be redirected to a specific page which shares their username. How can I retrieve the username and incorporate it into their redirect? So:               ...     elseif ( in_array( 'map_user', $user->roles ) )         return home_url( '/mapping/[username-based-page-goes-here]/' );     ...      [I'm aware of Peter's Redirect plugin, I'd rather make use of Wordpress core functions to save on having to manually tailor each user's access upon creation. I also make use of other plugins which seem to conflict with Peter's.]


Search posts by Tag

I'd like my search forms to only display results organized by tag. I know you can add `&tag=TAGNAME` to the end of a search results URL, but how do I integrate it into a form so that my site only searches for posts containing tags equal to whatever was entered in the search box? I have two searches on the page, so ideally I'd like to be able to add it via HTML into the forms themselves as opposed to anywhere else, but any answer is fine :) thanks


Creating pages and getting their values from the database table

I need to make inquries from my new website. I want to know whether Wordpress is capable of this: Say it I have such a table:               CREATE TABLE IF NOT EXISTS `mytable` (       `id` int(11) NOT NULL AUTO_INCREMENT,       `base_id` int(11) NOT NULL,       `page_type` smallint(4) NOT NULL,       `page_title` varchar(50) NOT NULL,       `page_content` text NOT NULL,       `previous_id` int(11) NOT NULL,       `next_positive_id` int(11) NOT NULL,       `next_negative_id` int(11) NOT NULL,       PRIMARY KEY (`id`)     ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;                 id..base_id..page_type..page_title..page_content..previous_id...next_positive_id..next_negative_id     1..1..question...."Character test"..."Do you like cats"....0....2....3     2..1..middle question.."Character test"...."Do you like dogs"....1....4....5      First question is "Do you like cats". This is "page content". Page title is "Character test". If user selects yes, he is redirected to page 4, if no then redirected to page 5. Page titles, questions, next page's links etc. will be taken from the database table. I put a flow example below. Is it possible to make this in Wordpress ? I need to change only database entries and then the site content wil be updated automatically. Thank you ![enter image description here](http://i.stack.imgur.com/Jfxgx.jpg)


How to display menu description, but only if there is a sub menu?

Today I've written my own custom menu walker. While I am a bit shocked how difficult this is (also because there seem to be some bugs in Wordpress), I am astonished that I could make everything work. There is only one thing I can't figure out: _How do I print the description given to a menu item in the Wordpress backend as first item in a submenu?   Or maybe a bit simpler: How do I display the menu item description, but only if the menu has a submenu?_ In my walker, I tried to modify `start_lvl` like this:               function start_lvl(&$output, $depth, $item) {          $description  =! empty( $item->description ) ? esc_attr( $item->description ) : '';              // $depth > 0 could also work?         $depth === 1 ? $output .= $description : '';              $indent = str_repeat("\t", $depth);         $output .= "\n$indent<ul class=\"navlist__sublist\">\n";     }      That didn't work (but also did not give me an error), probably because I added `$item` as argument. So I guess my approach is wrong, but how to properly do this?


Get id of category from drop down menu

Im trying to get the category ID from `wp_dropdown_categories();`and then pass the ID into a loop to have it output posts titles from that particular category. I currently have this:                  <form action="<?php bloginfo('url'); ?>" method="get">             <?php wp_dropdown_categories(); ?>         </form>

                     <?php                      global $post;                     $args = array( 'posts_per_page' => 5, 'category' => $_GET['value']);                     $myposts = get_posts( $args );                     foreach ( $myposts as $post ) :                        setup_postdata( $post ); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                     <?php endforeach;                     wp_reset_postdata(); ?>

      But it's not grabbing the category ID from the `$_GET['value']` and I'm not sure what I need to do to get it to pass that ID to the array. Eventually, I'd like to have it so that when you select a different category that it will show the posts associated with that selected category. But I figured that I'd try to get the select to work first and then move on from there.


How to Insert A List of Posts in A Category Written by the Author into the Author Archive

What I want: http://i.imgur.com/jH6Dj.png (sorry for linking out, I am a new user here so can't post an image inline) How does one list posts by an author within a category, with a count for each category, on the author archive page?


WordPress with PageLines theme: how to change the background color of a page?

> **Possible Duplicate:**   >  PageLines theme: how to change the background color of the main content vs. > entire page? I use PageLines free version, with WordPress 3.3.1, for this website: http://new.teleosis.org/?page_id=76 I want the background color of the whole page to be light green, and the background color of my content area to be white (typical design). It seems like a super simple thing to do - or so I expected.   * I configure the overall background color in the PageLines settings as such: screenshot   * But I don't find the setting to change the page-content background color, is it even available in PageLines? I hope I don't have to go into the CSS files for such a simple thing, but if I do, I appreciate any suggestions to do that too.


Keep requested/entered url with add_rewrite_rule

I've got url-rewriting partially working. I have this rule:               add_rewrite_rule('^somepage/([^/]*)/([^/]*)/([^/]*)/?','index.php?p=27&target=$matches[1]&arrival=$matches[2]&departure=$matches[3]','top');      When I request a page like this:               http://yourpage.com/wp/somepage/florida/02-03-2012/03-03-2012/      The Visitor gets redirected to:               http://yourpage.com/wp/somepage/      But I'd like to keep the additional parameters of the original url. How can I achieve this? And I noticed something else. When I generate a link like above from a form via JavaScript I get "page not found" although the url is correct. Now when I refresh that same page I get redirected to the page mentioned above. Why isn't it working on the first try? I'd appreciate any help. Kind regards, Denyo


Add html word before category

I'm trying add "Tuppersex" text before categories but it's impossible! Everyone can help me please? Now, final code is this:

     1
      But i want show:

      Tuppersex 1
      How is possible?               <?php     $get_cats = wp_list_categories( 'echo=0&title_li=&depth=1&hide_empty=0&exclude=1,762,899,951' );     $cat_array = explode('
',$get_cats);     $results_total = count($cat_array);     $cats_per_list = ceil($results_total / 3);     $list_number = 1;     $result_number = 0;     ?>          <ul class="cat_col" id="cat-col-<?php echo $list_number; ?>">          <?php     foreach($cat_array as $category) {     $result_number++;          if($result_number % $cats_per_list == 0) {         $list_number++;         echo $category.'

';     }     else         echo $category.'
';     }     ?>


How to have two different versions of a tag/category/taxonomy archive page?

I have a site that has two different bodies of content: more formal content (using various different custom post types) and a blog (using a blog post type). These two different bodies of content use the same taxonomies—but I would like to have two different versions of the taxonomy archives: one for the formal content, and one for blog content. For example, for a term **science** in the taxonomy **subjects** I'd like to have both   * **mysite.com/subjects/science** AND   * **mysite.com/blog/subjects/science** (or **mysite.com/subjects/science/blog** ) What's the best way to accomplish this in Wordpress? I don't want to use pages, because terms are being added all the time. I just want some way to be able to provide two archive templates for taxonomy terms.


Incrementing a class in a custom walker

I have written a custom walker that I am using with `wp_nav_menu` but I need to iterate through 4 custom classes, and I'm not sure how to do this. Basically, each menu-item `<li>` needs to be given a class of `color1`, `color2`, `color3` or `color4`, cycling back to `color1`, lather, rinse, repeat, in that order. Ordinarily I would do this with a `$i` and a `$i++`, but how do I do this in the Walker class? EDIT: My Walker class code:               class Salamander_Advent_Walker extends Walker_page {     function start_el(&$output, $item, $depth, $args) {         if ( $depth ) {             $indent = str_repeat("\t", $depth);         } else {             $indent = '';         }              $advent_thumbnail = get_post_meta($item->ID, 'advent-thumb', true);         $advent_slug = get_post_meta($item->ID, 'advent-slug', true);         $advent_oneliner = get_post_meta($item->ID, 'advent-oneliner', true);         //$description = get_post_meta($item->ID, 'advent-thumb', true);              $output .= $indent . '
                                                   '. $advent_slug .'                                                                             '. $advent_slug .'                                          '. $advent_oneliner .'                              ';                           }      }


Getting a custom post's custom field based on another custom post's custom field select

So I'm at my wit's end here. I've done this before plenty of times, but I think I have stared at this so much I am missing something.   * I basically have a custom post called locations. That custom post has a few fields which include address, and latitude and longitude.     * that lat/long are geocoded so they get automatically populated after the user enters in the address (so they can later be dumped into a map): the_field('latitude'); ?> the_name(); ?>" value="the_value(); ?>"/> the_field('longitude'); ?> the_name(); ?>" value="the_value(); ?>"/>   * The second part of this is the people custom field that has a select box that lets the user select the title of each of those locations: the_name(); ?>"> Select Location ID; ?>" the_select_state($office->ID)?>>post_title; ?> The final piece that I am having issues with is tying them together. I have a query displaying the information for the people: Based on the region selection in the people custom post, I want to display the last and long fields in the locations post. I've done something similar before without any issues, but this time around it's not cooperating. I've tried different variations, but here is where I am right now:               <?php              $people = get_posts(array(             'post_type' => 'person',             'nopaging' => 'true',             'order' => 'ASC'             ));               foreach ($people as $person) :             $office = 'office';             $office_id = get_post_meta($person->ID, 'person_location', TRUE);         ?>             <?php get_post_meta($office_id, "latitude", true); ?>', '<?php echo get_the_title($office_id); ?>      I've tried different things including creating a custom query with no avail:               function get_latLong($office_id) {         global $wpdb;                   $mylink = $wpdb->get_row("SELECT * FROM $wpdb->location WHERE id ='" . $office_id . "'");         echo $mylink->latitude;          }      Any insight would be greatly appreciated! Thanks