Where to add the permalink in this function?

Below is a function that displays the latest 4 approved comments on my homepage, I wrote this almost a year ago, and for the life of me, it's gone completely from my head, All i want to do is add a permalink to where the comment is located. How do I, and where do I add this?               function showLatestComments() {       global $wpdb;         $sql = "        SELECT DISTINCT comment_post_ID, comment_author, comment_date_gmt, comment_approved, SUBSTRING(comment_content,1,100) AS com_excerpt         FROM $wpdb->comments         WHERE comment_approved = '1'        ORDER BY comment_date_gmt DESC         LIMIT 4";        $comments = $wpdb->get_results($sql);        $output .= '
Latest student perspectives

';        foreach ($comments as $comment) {         $output .= '
'. $comment->comment_author . ' said : "' . strip_tags($comment->com_excerpt). '..."
';        }      $output .= '
';        echo $output;       }          //end function


Ordering a mysql style datetime stamp with meta_query

I have a custom post type field that I am storing data in called football_game_datetime. Example format and values for this field are examples like: "2013-10-31 14:00:00", "2013-09-16 20:00:00", "2013-09-30 22:00:00". The code I am using is the following, but it isn't doing what I thought it should be doing:               $mypost =     array(         'post_type' => 'football_games',         'meta_query' => array(                array(                     'order'=>'DESC',                     'orderby' => 'meta_value_num',                     'meta_key' => 'football_game_datetime'                )         )     );     $loop = new WP_Query( $mypost );


MediaElement audio tag not visible

Audio tag works normally if I include it in the page. Like this:               [audio src="URL_TO_MP3_FILE"]      Than another case: I'm trying to make an "audio player" with window.open. I needed two days to do that right and to bypass popup blockers, but just when I achieved that, audio shortcode stopped working. During this two days it was working and it still works on other areas of my website... just not in this popup. I checked the popup html with "view page source":               <audio class="wp-audio-shortcode" id="audio-4-1" autoplay="on"         preload="none" style="width: 100%; visibility: hidden;" controls="controls">         <source type="audio/mpeg" src="[URL_TO_MP3_FILE]?_=1">                      [AGAIN_THE_SAME_URL_TO_MP3_FILE]              </audio>      It for sure looks weird, but I'm not the one to question that. I added this to the popup "page".                     If I check the page source now it looks like the visibility is set to visible, but still I don't see the player.               <audio class="wp-audio-shortcode" id="audio-4-1" autoplay="on"         preload="none" style="width: 100%; visibility: visible; display: block;"         controls="controls">         <source type="audio/mpeg" src="[URL_TO_MP3_FILE]?_=1">                      [AGAIN_THE_SAME_URL_TO_MP3_FILE]              </audio>      Pure pain. I read all this but still I have no solution: http://codex.wordpress.org/Audio_Shortcode http://wordpress.org/support/topic/audio-embed-shortcode-not-working-ver-222 http://wordpress.org/support/topic/audio-player-not-showing-1


Wishlist Content

I am using the Wishlist plugin for my membership site. My content is divided into 12 modules corresponding to 12 months. When a member upgrades from one level to the next,he has access to current Level plus the previous Level(s) content, so for example if he is on Level 2 he has access to Level 2 plus Level 1 content;if on Level 3 he has access to Level 3 plus Level 2 plus Level 1 content and so on... The problem is that each membership level can see the content from the Level that they are currently on which is all okay with Level 1 but as a member moves on to the next Level, say Level 2, he can only "see" Level 2 content. What I want to do is to somehow show the Level 2 content when the member is logged in to that Level as well as the Level 1 content; I would like to do the same for all the other Levels. Also I would like to highlight the "old" content in some way from the current content. Is there any way out? Can someone help me with this?


display specific term based on custom post type in custom taxonomy metabox

I am using a custom taxonomy 'Categories' for more than one custom post types. While adding/editing a post in one of the custom post type, I want to show only specific TERMS under custom taxonomy 'Categories' metabox based on that custom post type.


How to keep theme layout the same when admin gray bar is present?

When I am logged in, there is a gray admin bar on top. My theme layout got distorted by the bar. How to solve the layout problem? Is there a function that can detect user is logged in or not, or use CSS can solve the problem ? The theme demo is at: http://raptor.hk/dev/theme and below is the screenshot when the gray bar is there. p.s. I use `WordPress 3.2.1` & plugin `Theme Test Drive` ![when the gray bar is present...](http://i.stack.imgur.com/Ew9dD.png)


Wordpress multisite in subdirectory, not root, and remove base folder from url

I might be misreading but I can't find a solution to the following need: I want to install Wordpress in a subfolder of my `www` directory, let's say `www/wp`. I then want to add two blogs to the multisite network called `foo` and `bar`. When I do so, they end up with the URL:               http://mysite.com/wp/foo     http://mysite.com/wp/bar      I would instead like them to be located at:               http://mysite.com/foo     http://mysite.com/bar      _But_ I do _not_ want a WP site running at the home/root:               http://mysite.com/      because I will be running a different application there (otherwise I would just install WP att the root and be done) with it! How do I configure this?


Using pagination with get_posts on page type

Is there a way to use pagination on a page query like with posts? Here is the code I'm using:                   $listingPages = get_posts(          array(         'cild_of' => '7',             'meta_key' => 'Type',             'post_type' => 'page',             'post_status' => 'publish',             'orderby' => 'meta_value',             'order' => 'ASC',         'posts_per_page' => '20',         'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ),         )     );      I can add /page/2 /page/3/ and etc to the URL and see the next set of 20 however when I add in my pagination code nothing shows up.               <?php wpbeginner_numeric_posts_nav(); ?>      Here is the function.php part of this:               function wpbeginner_numeric_posts_nav() {          if( is_singular() )         return;     global $wp_query;          /** Stop execution if there's only 1 page */     if( $wp_query->max_num_pages <= 1 )         return;     $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;     $max   = intval( $wp_query->max_num_pages );          /** Add current page to the array */     if ( $paged >= 1 )         $links[] = $paged;          /** Add the pages around the current page to the array */     if ( $paged >= 3 ) {         $links[] = $paged - 1;         $links[] = $paged - 2;     }          if ( ( $paged + 2 ) <= $max ) {         $links[] = $paged + 2;         $links[] = $paged + 1;     }     echo '

' . "\n";          /** Previous Post Link */     if ( get_previous_posts_link() )         printf( '
%s
' . "\n", get_previous_posts_link() );          /** Link to first page, plus ellipses if necessary */     if ( ! in_array( 1, $links ) ) {         $class = 1 == $paged ? ' class="active"' : '';         printf( '
%s
' . "\n", $class, esc_url( get_pagenum_link( 1 ) ), '1' );         if ( ! in_array( 2, $links ) )             echo '
…
';     }          /** Link to current page, plus 2 pages in either direction if necessary */     sort( $links );     foreach ( (array) $links as $link ) {         $class = $paged == $link ? ' class="active"' : '';         printf( '
%s
' . "\n", $class, esc_url( get_pagenum_link( $link ) ), $link );     }          /** Link to last page, plus ellipses if necessary */     if ( ! in_array( $max, $links ) ) {         if ( ! in_array( $max - 1, $links ) )             echo '
…
' . "\n";         $class = $paged == $max ? ' class="active"' : '';         printf( '
%s
' . "\n", $class, esc_url( get_pagenum_link( $max ) ), $max );     }          /** Next Post Link */     if ( get_next_posts_link() )         printf( '
%s
' . "\n", get_next_posts_link() );     echo '

' . "\n";      }


Hello I don't know how but now I am getting this error > Notice: wp_enqueue_style was called incorrectly. Scripts and styles should > not be registered or enqueued until the wp_enqueue_scripts, > admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging > in WordPress for more information. (This message was added in version 3.3.) > in wp-includes/functions.php on line 3049 > > Notice: wp_enqueue_script was called incorrectly. Scripts and styles should > not be registered or enqueued until the wp_enqueue_scripts, > admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging > in WordPress for more information. (This message was added in version 3.3.) > in wp-includes/functions.php on line 3049 > > Warning: Cannot modify header information - headers already sent by (output > started at wp-includes/functions.php:3049) in wp-login.php on line 415 > > Warning: Cannot modify header information - headers already sent by (output > started at wp-includes/functions.php:3049) in wp-login.php on line 427 This is what I get, when I try to log in... On other sites I have only two first errors. I try to fix it but I can't. Any suggestions?


Random order of posts on each request

I want my testimonials to be shuffled everytime someone clicks on my testimonials page so that it is not the same one on top all the time. How can I do this? Where should I put the code? I am building using Thesis for WordPress. Also, i assume that each testimonial will need to be inside a div and I will give an ID to each div so that they can be shuffled? I still want them all to be on the page, I just want the order they appear in to change.


Use MarkItUp as editor and not the default

Does anyone know if it is possible to use this editor as my WordPress editor and not the default. If so, how?


Are un-sanitized theme options more vulnerable to malicious scripts than the theme editor?

I'd like to put text areas in a theme options area to allow users to easily add analytics code, scripts, and css. Is it silly to worry about malicious code being inserted via un-sanitized theme option text areas when, theoretically, a user could add malicious code just as easily via the standard wordpress theme editor? These types of theme options would be so helpful, but I'm struggling with the lack of sanitation/validation that comes with implementation.


How to use jQuery on widget admin page

I have a lengthy form config for my widget so I thought about using radio buttons to hide and show the relevant input fields instead of having them all after each other. But it doesn't seem to work. I suppose it is because the form is loaded with ajax? Is there a way to get it to work? Take a look at the code here: http://jsfiddle.net/JmVL3/


trying to get paginate_links to work but the query before is not working with multiple categories

I am trying to make this paginate_links work. The thing is I cant use category__and in my query. If I write 'cat' => array(3, 4, 24), It works but I get a message saying it needs a string, not an array. I cant use an array at all. It works with 'cat' for single categories.               $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;                               $the_query = new WP_Query( array(                         'category__and' => array(3, 4, 24),                         'posts_per_page' => 15,                         'paged' => $paged,                     ) );      Rest of the code:               global $the_query;                          $big = 999999999; // need an unlikely integer                          echo paginate_links( array(                         'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),                         'format' => '?paged=%#%',                         'current' => max( 1, get_query_var('paged') ),                         'total' => $the_query->max_num_pages,                         'show_all'     => False,                         'end_size'     => 2,                         'mid_size'     => 2,                         'prev_next'    => True,                         'prev_text'    => __('« Föregående'),                         'next_text'    => __('Nästa »'),                         'type'         => 'plain',                     ) );


default value not getting displayed in input field

I have written code for creating theme options but default values not getting displayed in text field Also settings saved message also not getting displayed                   <?php          // Default options values     $xyz_options = array(             'footer_copyright' => '© ' . date('Y') . ' ' . get_bloginfo('name'),             'facebook'=>'http://www.facebook.com/'         );          if ( is_admin() ) : // Load only if we are viewing an admin page              function xyz_register_settings() {         // Register settings and call xyz initiation functions             register_setting( 'xyz_theme_options', 'xyz_options', 'xyz_validate_options' );         }              add_action( 'admin_init', 'xyz_register_settings' );              function xyz_theme_options() {         // Add theme options page to the admin menu             add_theme_page( 'Theme Options', 'Theme Options', 'edit_theme_options', 'theme_options', 'xyz_theme_options_page' );         }              add_action( 'admin_menu', 'xyz_theme_options' );              // Function to generate options page         function xyz_theme_options_page() {             global $xyz_options;                  if ( ! isset( $_REQUEST['updated'] ) )                 $_REQUEST['updated'] = false; // This checks whether the form has just been submitted. ?>
                      <?php screen_icon(); echo "
" . get_current_theme() . __( ' Options' ) . "
";                 // This shows the page's name and an icon if one has been provided ?>                      <?php if ( false !== $_REQUEST['updated'] ) : ?>

<?php _e( 'Options saved' ); ?>

                 <?php endif; // If the form has just been submitted, this shows the notification ?>                      <form method="post" action="options.php">                          <?php $settings = get_option( 'xyz_options', $xyz_options ); ?>                          <?php settings_fields( 'xyz_theme_options' );                 /* This function outputs some hidden fields required by the form,                 including a nonce, a unique number used to ensure the form has been submitted from the admin page                 and not somewhere else, very important for security */ ?>

                                                              Facebook url                             	                                                  <input id="facebook" name="xyz_options[facebook]" type="text" value="<?php esc_attr_e($settings['facebook']); ?>" />

                                                              Footer Text 1                             	                                                  <input id="footer_copyright" name="xyz_options[footer_copyright]" type="text" value="<?php  esc_attr_e($settings['footer_copyright']); ?>" />

                         <input type="submit" class="button-primary" value="Save Options" />
                 </form>
              <?php         }              function xyz_validate_options( $input ) {         global $xyz_options;              $settings = get_option( 'xyz_options', $xyz_options );              }          endif;  // EndIf is_admin()


Jetpack Infinite scroll conflicting with theme's pre_get_posts custom posts_per_page

I have the current function on my theme using `pre_get_posts`, currently right at the bottom of my theme's functions.php file:               function mytheme_portfolio_archive_pages( $query ) {         if ( is_admin() || ! $query->is_main_query() )             return;              if ( is_post_type_archive( 'mytheme_portfolio' ) ) {             // Display 20 posts for a custom post type called 'mytheme_portfolio'             $query->set( 'posts_per_page', 20 );             return;         }     }     add_action( 'pre_get_posts', 'mytheme_portfolio_archive_pages', 1 );      It means I have 20 posts per page if the current archive is of the post type `mytheme_portfolio`, instead of the default 5 for the blog pages (the number 5 is being set in "Blog pages show at most __ posts" in Settings -> Reading). The above function is working fine when Jetpack Infinite Scroll is deactivated. Problem is I want to use Jetpack Infinite Scroll with the 'mytheme_portfolio' archive. And with it activated, the above function stops working and the Infinite Scroll uses the "Blog pages show at most 5 posts" number from Settings -> Reading when it loads new posts. The Infinite Scroll is otherwise working fine but I need to show 20 posts per page, not 5, if I'm on a `mytheme_portfolio` archive page! My Jetpack setup code is as follows, just for reference:                   function mytheme_render_infinite_scroll() {             while ( have_posts() ) : the_post();                     if ('mytheme_portfolio' == get_post_type() && !is_search()) :                         get_template_part( 'content', 'archive-portfolio' );                     elseif ( is_search() ) :                         get_template_part('content','search');                     else :                         get_template_part( 'content', get_post_format() );                     endif;             endwhile;         }              function mytheme_jetpack_setup() {             add_theme_support( 'infinite-scroll', array(                 'container'      => 'content',                 'footer_widgets' => 'footer-widgets',                 'type'           => 'click',                 'render'         => 'mytheme_render_infinite_scroll',                 'wrapper'        => true,                 'posts_per_page' => false             ) );         }         add_action( 'after_setup_theme', 'mytheme_jetpack_setup' );      Thanks so much for any help anyone can give! **EDIT:** I found the line in the Jetpack plugin code that's conflicting, in `jetpack/modules/infinite-scroll/infinity.php`, line 26...               function __construct() {         add_action( 'pre_get_posts',                  array( $this, 'posts_per_page_query' ) );         ...      which corresponds to lines 449 - 452 in the same file:               function posts_per_page_query( $query ) {         if ( ! is_admin() && self::archive_supports_infinity() && $query->is_main_query() )             $query->set( 'posts_per_page', self::get_settings()->posts_per_page );     }      If I comment line 26 out my function works. Obviously I don't want to go changing the plugin's files, is there a way I can make sure my theme's `posts_per_page` argument (initial code block above) is the one that's used, and not Jetpack's?


Bootstrap Error in WordPress plugin

I am creating a plugin that generates advanced search queries. All of the UI is done in bootstrap, and the results are displayed via modal (bootstrap.js). On the production site Greenlane SEO I get the JS error: `Uncaught TypeError: Object [object Object] has no method 'modal'`. I cannot figure out for the life of me what is causing this as I installed this on another WP site and the plugin works seamlessly (minus the styling).


Error, when i install new theme

I'm getting following error when I install emphaino theme in WordPress. ![enter image description here](http://i.stack.imgur.com/1OGza.png) The default themes (Twenty Eleven 1.3, Twenty Ten 1.3) are working good. Other themes are also working good. I am already using same theme in another site. That's working good. But my new site makes this problem. Where is Wrong?


Copy Root Multisite Site

I have a Multisite installation created in WordPress hosted at `example.com` with websites at `example.com/site1`, `example.com/site2` etc. Is it possible to create an exact copy of `example.com` at `example.com/site3`? Blog Copier and NS cloner don't allow you to ever create a copy of the root site for some reason. What would the technical limitations behind this be?


Adding define('WP_MEMORY_LIMIT', '64M'); by default?

Before installing a big plugin I'm always scared of the blank page so I usually add define('WP_MEMORY_LIMIT', '64M'); to wp-config.php beforehand. I was thinking I could add it immediately after any WordPress install. Does this have potential downside?


Wordpress PHP plugin - Settings page error

Writing a PHP plugin for Wordpress. It was an external PHP script. But now I'm having a problem. When I click submit on the page it redirects saying there are no permissions to go to that page. Edit: Completely different query all together. I have permission errors following some of the changes advised below. (View edits to see revisions). Here is my code:                           <?php                 /*                 Plugin Name: ProfileDT-JobBoard                 Plugin URI: http://profiledt.co.uk                 Description: ProfileDT-JobBoard                   Author: Bradly Spicer                 Version: 0.0.2                 Author URI: http://profiledt.co.uk                 */                      /*Installation of Plugin */                 /* What to do when the plugin is activated? */                 /*register_activation_hook(__FILE__,'JobBoard_install');*/                 register_activation_hook('jobboard-settings','JobBoard_install');                      /* What to do when the plugin is deactivated? */                 /*register_deactivation_hook( __FILE__, 'JobBoard_remove' );*/                 register_deactivation_hook('jobboard-settings', 'JobBoard_remove' );                      function JobBoard_install() {                 /* Create a new database field */                 add_option("JobBoard_data", 'Testing !! My Plugin is Working Fine.', 'This is my first plugin panel data.', 'yes');                 }                      function JobBoard_remove() {                 /* Delete the database field */                 delete_option('JobBoard_data');                 }                      /*Admin Menu of Plugin*/                 add_action('admin_menu', 'JobBoard_admin_menu');                 function JobBoard_admin_menu() {                 /*add_options_page('Plugin Admin Options', 'JobBoard Settings', 'manage_options',__FILE__, 'JobBoard_options_page');*/                 add_options_page('Plugin Admin Options', 'JobBoard Settings', 'manage_options','jobboard-settings', 'JobBoard_options_page');                           }                 /*Content inside the admin page*/                 function JobBoard_options_page()                  {                 ?>                      <?php                      if(isset($_POST['submit_delete'])) {                               $id=$_POST['ID'];                             $sql= (mysqli_query($con, "Delete FROM details WHERE ID = '$id'"));                             if($sql)                             {                            echo "Data Deleted";                         } else {                            echo "Data Not Deleted";                 }                 } elseif(isset($_POST['submit_add'])) {                      // Get values from form                      $value_Employer = $_POST["Employer"];                     $value_LearningProvider = $_POST["LearningProvider"];                     $value_ContractedProvider = $_POST["ContractedProvider"];                     $value_LearningDeliverySite = $_POST["LearningDeliverySite"];                     $value_VacancyDescription = $_POST["VacancyDescription"];                     $value_VacancyTitle = $_POST["VacancyTitle"];                     $value_EmployerDescription = $_POST["EmployerDescription"];                     $value_VacancyLocation = $_POST["VacancyLocation"];                     $value_WorkingWeek = $_POST["WorkingWeek"];                     $value_WeeklyWage = $_POST["WeeklyWage"];                     $value_NoVacancies = $_POST["NoVacancies"];                     $value_VacancyRefNumber = $_POST["VacancyRefNumber"];                     $value_ClosingDateForApplications = $_POST["ClosingDateForApplications"];                     $value_InterviewBeginFrom = $_POST["InterviewBeginFrom"];                     $value_PossibleStartDate = $_POST["PossibleStartDate"];                     $value_TrainingToBeProvided = $_POST["TrainingToBeProvided"];                     $value_LearningProviderDescription = $_POST["LearningProviderDescription"];                     $value_ContactDetails = $_POST["ContactDetails"];                     $value_VacancyType = $_POST["VacancyType"];                     $value_ApprenticeshipFramework = $_POST["ApprenticeshipFramework"];                     $value_SkillsRequired = $_POST["SkillsRequired"];                       $value_PersonalQualities = $_POST["PersonalQualities"];                        $value_ImportantOtherInformation = $_POST["ImportantOtherInformation"];                        $value_Website = $_POST["Website"];                      // Insert data into mysql                  $sql="INSERT INTO $tbl_name(Employer, LearningProvider, ContractedProvider, LearningDeliverySite, VacancyDescription, VacancyTitle, EmployerDescription, VacancyLocation, WorkingWeek, WeeklyWage, NoVacancies, VacancyRefNumber, ClosingDateForApplications, InterviewBeginFrom, PossibleStartDate, TrainingToBeProvided, LearningProviderDescription, ContactDetails, VacancyType, ApprenticeshipFramework, SkillsRequired, PersonalQualities, ImportantOtherInformation, Website)VALUES('$value_Employer', '$value_LearningProvider', '$value_ContractedProvider', '$value_LearningDeliverySite', '$value_VacancyDescription', '$value_VacancyTitle', '$value_EmployerDescription', '$value_VacancyLocation', '$value_WorkingWeek', '$value_WeeklyWage', '$value_NoVacancies', '$value_VacancyRefNumber', '$value_ClosingDateForApplications', '$value_InterviewBeginFrom', '$value_PossibleStartDate', '$value_TrainingToBeProvided', '$value_LearningProviderDescription', '$value_ContactDetails', '$value_VacancyType', '$value_ApprenticeshipFramework', '$value_SkillsRequired', '$value_PersonalQualities', '$value_ImportantOtherInformation', '$value_Website')";                 $result=mysql_query($sql);                      // if successfully insert data into database, displays message "Successful".                  if($result){                 echo "Successful";                 echo "
";                 }                      else {                 echo "ERROR";                 echo $sql;                 }                           } elseif(isset($_POST['submit_update'])) {                     // code for updating                 }                      ?>                           <?php screen_icon(); ?>
ProfileDT JobBoard Settings
                      <?php                         // Connect to our DB with mysqli_connect(<server>, <username>, <password>, <database>)                             $con = mysqli_connect("localhost", "profiled_job","ZH8liJnG5pZR", "profiled_jobboard") or die(mysql_error());                        // mysqli_select_db($con,"jobboard" ) or die(mysql_error());                                   //update                             $sql_update = "SELECT ID,Employer FROM details";                             $result_update =mysqli_query($con,$sql_update);                         //delete                             $sql_delete = "SELECT ID,Employer FROM details";                             $result_delete =mysqli_query($con,$sql_update);                 ?>

 Add User

                      <form method="post" action="<?php echo admin_url('options-general.php?page=jobboard-settings'); ?>"/>                 <?php                 echo "Employer                                   <input type=\"text\" name=\"Employer\" />

" .                 "Learning Provider                  <input type=\"text\" name=\"LearningProvider\" />
" .                 "Contracted Provider                  <input type=\"text\" name=\"ContractedProvider\" />
" .                 "Learning Delivery Site:                   <input type=\"text\" name=\"LearningDeliverySite\" />
" .                 "Vacancy Description:                  <textarea rows=\"5\" Cols=\"22\" name=\"VacancyDescription\" style=\"display: inline-block; margin-left:10px;\"/> </textarea>
" .                 "Vacancy Title:                  <input type=\"text\" name=\"VacancyTitle\" />
" .                 "Employer Description:                  <textarea rows=\"5\" Cols=\"22\" name=\"EmployerDescription\" style=\"display: inline-block; margin-left:10px;\"/></textarea>
" .                 "Vacancy Location:                  <input type=\"text\" name=\"VacancyLocation\" />
" .                 " Working Week Hours:                  <input type=\"number\" name=\"WorkingWeek\" />
" .                 "Weekly Wage:                  <input type=\"text\" name=\"WeeklyWage\" />
" .                 "Vacancies:                  <input type=\"text\" name=\"NoVacancies\" />
" .                 "Reference Number:                  <input type=\"text\" name=\"VacancyRefNumber\" />
" .                 "Closing Application Date:                  <input type=\"date\" name=\"ClosingDateForApplications\" />
" .                 "Interview Start Date:                  <input type=\"date\" name=\"InterviewBeginFrom\" />
" .                 "Possible Start Date:                  <input type=\"date\" name=\"PossibleStartDate\" />
" .                 "Training to be provided:                  <textarea rows=\"5\" Cols=\"22\" name=\"TrainingToBeProvided\" style=\"display: inline-block; margin-left:10px;\"/></textarea>
" .                 "Learning Provider Desc:                  <textarea rows=\"5\" Cols=\"22\" name=\"LearningProviderDescription\" style=\"display: inline-block; margin-left:10px;\"/></textarea>
" .                 "Contact Details:                  <textarea rows=\"5\" Cols=\"22\" name=\"ContactDetails\" style=\"display: inline-block; margin-left:10px;\"/> </textarea>
" .                 "Vacancy Type:                  <input type=\"text\" name=\"VacancyType\" />
" .                 "Apprenticeship Framework:                  <input type=\"text\" name=\"ApprenticeshipFramework\" />
" .                 "Skills Required:                  <textarea rows=\"5\" Cols=\"22\" name=\"SkillsRequired\" style=\"display: inline-block; margin-left:10px;\"/></textarea>
" .                 "Personal Qualities:                  <textarea rows=\"5\" Cols=\"22\" name=\"PersonalQualities\" style=\"display: inline-block; margin-left:10px;\"/></textarea>
" .                 "Other Information:                  <textarea rows=\"5\" Cols=\"22\" name=\"ImportantOtherInformation\" style=\"display: inline-block; margin-left:10px;\"/></textarea>
" .                 "<input type=\"text\" name=\"Website\" />
" .                 "<input type=\"submit\" value=\"Add Vacancy\" name=\"\" />";                 ?>

 Delete User

                     Warning: Once deleted it is gone forever                 <form method="post" action="<?php echo admin_url('options-general.php?page=jobboard-settings'); ?>"/>                     <select name='ID'>                          <?php                          while ($data=mysqli_fetch_assoc($result_delete)){ ?>                            <option value ="<?php echo $data['ID'] ?>"><?php echo $data['Employer'] ?></option>                     <?php } ?>                              </select>
                             <input type="submit" value="Delete User" name='submit'>
                      </form>

 Update User

                 <form method="post" action="<?php echo admin_url('options-general.php?page=jobboard-settings'); ?>"/>                     <select name='ID'>                          <?php                          while ($data=mysqli_fetch_assoc($result_update)){ ?>                            <option value ="<?php echo $data['ID'] ?>"><?php echo $data['Employer'] ?></option>                          <?php } ?>                              </select>
                             <input type="submit" value="Update User" name='submit'>
                      </form>

                 <?php } ?>


Posts 2 Posts - Filtering site search with connected post types

I would like to utilise the WordPress search facility to create the site search. Once the search has been complete I would then like to be able to filter it down based on the posts 2 posts connection. Is it possible to extend the site search to include p2p connection?


Yet another wp_insert_post infinite loop. What is wrong?

I am writing a plugin that enables subscribed users to submit posts of a custom type, and I am trying to implement this feature via shortcodes. Now the problem is that instead of inserting one post, my code inserts hundreds of them, until PHP runs out of memory... Here is an ultraminimal code that reproduces the issue:               add_shortcode( 'occaz-ajouter', 'occasion_addedit' );          function occasion_addedit(){              wp_insert_post(array('post_title'=> 'hello',                              'post_content'=> 'Hello everybody',                             'post_author'=>1));              return "OK.";          }      (Of course, I have a page that contains the [occaz-ajouter] shortcode, and I encounter the problem when I visit this page.) I saw that several people have encountered such infinite loops, but none of the solutions provided seems to solve my issue, since I use none of the hooks that usually explain the infinite loop... Any idea? Thanks a lot, Nown


dbDelta support for FOREIGN KEY

**On PHP 5.3.13/MySQL 5.5.21 the following code doesn't work:**               if($check_custom_fields_form!=1){         $sql = "CREATE TABLE IF NOT EXISTS ". $table_custom_fields_form ." (                     `form_name` longtext NOT NULL,                     `field_id` bigint(20) NOT NULL,                     FOREIGN KEY (`field_id`) REFERENCES $table_custom_fields (`ID`) ON DELETE CASCADE ON UPDATE CASCADE         ) CHARACTER SET utf8 COLLATE utf8_general_ci";         dbDelta($sql);     }     if($check_subscribe_cat!=1){         $sql = "CREATE TABLE IF NOT EXISTS ". $table_subscribe_cat ." (                     `subscribe_id` bigint(20) NOT NULL,                     `cat_id` bigint(20) NOT NULL,                     FOREIGN KEY (`subscribe_id`) REFERENCES ".$wpdb->prefix."tgt_subscription (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,                     FOREIGN KEY (`cat_id`) REFERENCES ".$wpdb->prefix."terms (`term_id`) ON DELETE CASCADE ON UPDATE CASCADE         ) CHARACTER SET utf8 COLLATE utf8_general_ci";         dbDelta($sql);      }      **Thecode provider suggested a downgrade to MySQL 5.1.37 (no, thanks) or the following update:**               if($check_custom_fields_form!=1){             $sql = "CREATE TABLE IF NOT EXISTS ". $table_custom_fields_form ." (                         `form_name` longtext NOT NULL,                         `field_id` bigint(20) NOT NULL,                         KEY(field_id)             ) CHARACTER SET utf8 COLLATE utf8_general_ci";             dbDelta($sql);         }     if($check_subscribe_cat!=1){           $sql = "CREATE TABLE IF NOT EXISTS ". $table_subscribe_cat ." (                       `subscribe_id` bigint(20) NOT NULL,                       `cat_id` bigint(20) NOT NULL,                       KEY(subscribe_id),                       KEY(cat_id)           ) CHARACTER SET utf8 COLLATE utf8_general_ci";           dbDelta($sql);        }      Which seems like a rather dirty way to work around the problem (no cascading deletes/updates). Therefore:   1. **Do I really have to live with thatuntil dbDelta supports FOREIGN KEY?**   2. **Is it true that dbDelta only works with foreign key in a 3 year old MySQL version?**


How to display by default only published posts/pages in the admin area?

As it is, WordPress displays by default **all** the pages/posts in the pages/posts list in the admin area, no matter what their publishing status is. I have a lot of drafts, but usually I'm much more interested in editing the published pages/posts, therefore getting only to display them requires another click and full reload. Is there a way to set WordPress to initially display only published posts/pages, allowing you to click on "All" or "Draft" if you later want to?


How to create a post with next buttons

I am trying to create a post to show top 10 movies of 2013. I have created a post with the same heading. However how can I show the post with next buttons. That is position 10 movie should be first, with corresponding image and some text. Then on clicking next button go to 9th movie. like that the last screen should be the 1st movie. Is there any plugins available? or how can I achieve it.


One query to get posts and their taxonomy terms

I am building a map of posts and taxonomies to do some more intensive processing later on. Right now I am querying the posts with `WP_Query` and iterating over each one to get their taxonomy terms and then dump all of that into an array for use later. I know this isn't right from a performance and "best standards" perspective. I don't want to make database calls in a loop and I would really prefer to eagerly load all post terms on the first query with the posts. Is this possible? How?


How to alert users when new posts appear under search query?

I have been hunting the web for days for this feature, and I am kind of surprised it's so hard to find / nobody really talks about it! I have a Wordpress site with a custom post type that can be pulled by different search attributes. I am looking for a way for users to subscribe to a specific search query string, and once per week, get notified automatically via email when new posts that match their search query string appear. For example when somebody searches for www.mysite.com/?Location=California&Radius=25, a list of results come up, and if that user subscribes to this search result, then once per week he/she will be notified of new posts matching that search query I am open to paid plugins as well, it's just I haven't been able to find one that can do this. I am comfortable with capturing additional information from users when they're signing up, using jQuery and populating hidden fields' values, etc., if this would help with the end goal. Edit: I thought of an idea of users subscribing to the RSS feed for each search query, since it's automatically generated by adding /feed/ in the search query URL. But I am not sure how to alert users when new posts appear under the RSS feed, and when to fire the alert (i.e. once a week), and how to display all new posts in an email template. Any help is greatly appreciated!


Wordpress list child pages of custom post type

Im stuck on this and any help would be appreciated. Say there is a parent page called "Stuff". And Stuff has several pages under it.   * Stuff      * more stuff     * more stuff1     * more stuff2   * It has no children   * Other with children      * etc     * etc 2 So when you click on "more stuff". That page would list all the pages under stuff ('more stuff, morestuff1, morestuff2'). Or if you click on "etc" you would see "etc, etc2" Any thoughts or help would be appreciated. I'm using the Types plugin and have hierarchical setting turned on already. **** I've used the following. Currently trying to figure out how to use ACF with the results. For example: If Advanced Custom Field"x" exists then use that instead of the title (basically use an image for the title instead depending on if that field exists and is being used)               <?php                  if($post->post_parent)                     $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&post_type=physicians");                 else                     $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&post_type=physicians");                 if ($children) { ?>

                                                                  Home
                         <?php echo $children; ?>

                 <?php }?>


Add Div to Comment Form

I have some code that displays my comment form and my custom validation, what I'd like to do is add a div right underneath the title, but I'm not sure how to do that because that code is generated... The Code:               <?php $comment_args = array(         'title_reply' => 'Leave a Comment',          'comment_notes_before' => '',           'fields' => apply_filters( 'comment_form_default_fields', array(         'author' => '
' . '' . __( 'Name:' ) . ' ' . ( $req ? '*' : '' ) .         '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" required />
',          'email'  => '
' .         '' . __( 'E-mail:' ) . ' ' . ( $req ? '*' : '' ) .         '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30" required />'.'
',          'url'    => '' ) ),          'comment_field' => '
' . '' . __( 'Comment:' ) . '' . '<textarea id="comment" name="comment" cols="45" rows="8" required></textarea>' . '
',          'comment_notes_after' => '',          'label_submit' => __( 'Post' ),         );         comment_form($comment_args);     ?>      Which Outputs:
Leave a Comment Cancel reply
          <form action="http://ourpictureshare.com/wp-comments-post.php" method="post" id="commentform" class="comment-form">
Logged in as admin. Log out?

Comment:<textarea id="comment" name="comment" cols="45" rows="8" required=""></textarea>

               <input name="submit" type="submit" id="submit" value="Post">               <input type="hidden" name="comment_post_ID" value="93" id="comment_post_ID">               <input type="hidden" name="comment_parent" id="comment_parent" value="0">
           <input type="hidden" id="_wp_unfiltered_html_comment_disabled" name="_wp_unfiltered_html_comment" value="70754f57d7">     </form>      What I am looking for:
Leave a Comment Cancel reply

           <form action="http://ourpictureshare.com/wp-comments-post.php" method="post" id="commentform" class="comment-form">
Logged in as admin. Log out?

Comment:<textarea id="comment" name="comment" cols="45" rows="8" required=""></textarea>

             <input name="submit" type="submit" id="submit" value="Post">             <input type="hidden" name="comment_post_ID" value="93" id="comment_post_ID">             <input type="hidden" name="comment_parent" id="comment_parent" value="0">
       <input type="hidden" id="_wp_unfiltered_html_comment_disabled" name="_wp_unfiltered_html_comment" value="70754f57d7">     </form>      Any help is appreciated. Thanks,   Josh


Get all attachments by custom taxonomy - term

I want to make custom taxonomy (gallery) and terms (name1, name2, name3...) Add images into media tab and then retrieve all images from same term. Look like simple task, but I cant manage it. I registered new (custom) tax, added some terms to image, but I cannot retrieve any of them. Searched for two days for solution, just can't put all pieces all together. I want to get list of terms first, and then get list of images from this list.


Wordpress Site access from other machines on same network

I developed a Wordpress website on my local computer using 'Wamp' server. I'm now trying to put it on a local server at our work so that others can look at it / access it from their work stations. We setup a Windows 2008 Server R2, installed Xampp (Wamp had issues installing). Apache server and MySQL are both active and running. I installed a copy of SQL DB, copied over the wordpress contents from my local workstation to C:\xampp\htdocs\'mysite' on the new server. Finished wordpress setup and I'm able to access the dashboard and the website. Now I wanted to change localhost to IP Address of this server to it can be access by other workstations. So on Wordpress Dashboard, I went into settings > General > Changed Site Address to '//IP/mysite' and WordPress Address to '//localhost/mysite' (Which was default). Made sure all the permalinks are changed to IP address. everything looks good, Website works fine on the new server, navigation links are all good. When I access the website from other workstations using '//IP/mysite'. I get the content of the website but not the same layout (Styles). Contents just stack up vertically, one below the other. I cannot seem to figure out whats going on. I've tried changing both Wordpress Address URL & Site Address URL to '//IP/mysite', when I hit save, I lose all the dashboard icons (For eg: Page icon before Pages link in the dashboard) and some of the plugins don't respond. Has anyone ever come across similar problem before? Any help would be appreciated. Thank you in advance!! PS: If you need more info, please let me know I'll provide asap


Redirect permalinks after creating custom post types

I'm in the process of reorganizing a website with many posts (~30.000) a part of which have to be migrated to a new custom post type. Since the custom posts have an added slug to the permalink, is there a way to redirect all the requests to the old links like: `www.example.com/some-interesting-article` to `www.example.com/new-post-type/some-interesting-article` ?


Modify my code - which takes the first sentence of the post and use it as a h2 tag - to work outside the loop

My code takes the first sentence of a post and places it's content inside a variable. The problem is it works only inside the loop. I need help making this code outside the loop, becouse I want to use the posts first sentace as description in the header.php Here it is:               <? ob_start();     the_content();     $old_content = ob_get_clean();     $content = strip_tags($old_content);     $match = null;     preg_match('/(.*?[?\.!]{1,3})/', $content, $match);       $first_sentence = $match[1];        $the_rest = substr($content, strlen($first_sentence));      if ( $first_sentence != '' && $the_rest != '' ){        echo '
'.$first_sentence.'
';        echo '
'.$the_rest.'
';     } ?>      One more thing, it would be perfect to keep the posts formating in this code. Any ideea how I can do that? Ty very much, take care!


Is there an easy way to create a links index page?

Essentially I want this... http://oldtimemusic.com/otlinks.html I want to have an index of letters each pointing to a page with links for that letter along with a description. I'm wondering if there is some way I can do that with a wordpress plugin or maybe even the out of the box link functionality? I'd just rather not make it all manually.


Most appropriate way to display CPT's by children terms of custom taxonomies while retaining desired permalink structure?

Im currently building a small store section on a site of mine with the use of CPT's & Custom Tax's for the first time. So far Ive successfully got my CPT's & Tax's working as expected however since this is my first time Im still a bit stumped about the best approach to take to present this content via templates??? ### Things to note to better understand my goal-   • The store items are all using **(1) CPT** called " **Store Items** "   • The store is going to contain products that fall into a few different custom tax's, eg.   **Product Categories** - w/ children such as (Clothing, Accessories, CDs) filed under that custom tax. / **Brands** - w/ children such as (Brand 1, Brand 2, etc.) filed under that custom tax, and lastly something like **Artists** - w/ children such as (Artist 1, Artist 2, etc.) filed under that custom tax. ### Id like my URL structure to be easy to understand and follow according to what product, etc. is selected, so -   • When your visiting the store itself it will just be - www.mysite.com/store   • When your visiting a product in the store, id like it to be something like - www.mysite.com/store/clothing/mens/t-shirts   (the thing to note here is that "clothing", "mens", and "t-shirts" are children terms added to my custom taxonomy called "Product Categories") - This is the part Im hung up on and not sure how to go about...   Its just my assumption that the current approach Ive devised with 1 CPT along with my custom tax's is the best way to achieve my goal, so even if the core of how Ive approached this is in your opinion haltering my goal then Id love to know what you think. Thanks for the help!   Best,   SB


Loading a sidebar on an Ajax call

I wanted to load a custom sidebar when doing an Ajax call, so I found the way with:               add_filter( 'loop_start', 'my_sidebar_widget', 25 );      but it is showing the sidebar even in media admin panel, so I thought about doing:               if( !is_admin() ) {         add_filter( 'loop_start', 'my_sidebar_widget', 25 );     }      but it was still loaded in the media admin panel, so I tried:               add_filter( 'loop_start', 'my_sidebar_widget', 25 );          if( is_admin() ) {         remove_filter( 'loop_start', 'my_sidebar_widget', 25 );     }      but in this way, the sidebar is not loaded on the Ajax call. Any idea of how to solve it?


How can I call menu_class into this PHP script?

For mobile navigation I would love to call menu_class and drop it in below "foreach ( (array)". Ideas? Everything I've tried won't work. New to PHP, thanks / cheers :)                   <?php                  $menu_name = 'top_nav_menu';                  if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) {             $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );                  $menu_items = wp_get_nav_menu_items($menu->term_id);                  $menu_list = '

';                       foreach ( (array) $menu_items as $key => $menu_item ) {                 $title = $menu_item->title;                 $url = $menu_item->url;                 $menu_list .= '
' . $title . '
';             }             $menu_list .= '
Menu
';             } else {             $menu_list = '<select class="dropdownmenu"><option>Menu "' . $menu_name . '" not defined.</option></select>';             }              echo $menu_list;               ?>


"Conflict" with jQuery (or its plugins)?

I've been working on localhost and everything looks fine but then when I uploaded my Wordpress theme online, all of the jQuery plugin functions are undefined! One solution that worked (which I haven't tested a lot so I still don't know if it will work in the long run) is to import the javascript file from the plugin's main website or github page. I don't really prefer this "solution." Another is the solution here but I haven't tested this a lot also. My issue here is I've used jQuery in another theme and everything works using just `$`, but in my new theme it doesn't work with `$` and so I have to use `$j` instead. It's just that I'm very used to using just `$`. Can someone explain this weird phenomenon? Thank you! :)


Fake Single Wordpress Post (Page) Loop

In a plugin, I am building a custom page with               add_action('template_redirect', function(){         include(TEMPLATEPATH."/page.php");         exit();     });     add_filter('the_title', function(){ return "Virtual Page Title"; });     add_filter('the_content', function(){ ?>         <!-- HTML CONTENT -->     <?php }); ?>      But some templates wrap the `page.php` content calls in a `have_posts()` loop which I need to override for the virtual page. I have tried `query_posts('posts_per_page=1')` but that requires that there is at least one published post, which may not always be the case.


Excluding categories from "Manage Categories" using a get_terms filter

I'm using a filter on get_terms (see below) to remove a specified number of named categories from the "Manage Categories" listing. It works great, however, the excluded categories are still counted in the category count field that's displayed just under the "Search Categories" button. Is it possible that I can subtract these categories from the count?               function admin_edit_tags() {add_filter( 'get_terms', 'admin_trim_category_description', 10, 2 );}          function admin_trim_category_description( $terms, $taxonomies ){         if( 'category' != $taxonomies[0] )return $terms;         $my_categories = array('test1','test2','test3');         foreach( $terms as $key => $term)              if(in_array($terms[$key]->name, $my_categories)) { unset($terms[$key]);}             else             {             if(isset($terms[$key]->description) && $terms[$key]->description !=='') $terms[$key]->description = strip_tags(substr( $term->description, 0, 75 ))."...";             }             return $terms;         }


Why are some of my custom posts not showing up on my page?

I have 6 posts with a custom post type in my Wordpress theme. I want to show them all on a page but I can only get a maximum of 3 to show up, regardless of how many there are. I have this code in the page:               <?php $count_posts = wp_count_posts( 'cases' )->publish;     echo $count_posts; ?>          <?php query_posts('post_type=cases'); ?>     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
case
     <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
     <?php endif; ?>      ...and it outputs this:               6     case case case      Why are my other 3 custom posts not showing up? Thanks in advance


Setting multiple values to as sort_column

If I want to sort on 1) menu_order and if the pages weight the same I want to 2) sort them alphabetically, how? Is this the default behavior if you set menu_order? Is it?:               $args = array(         'sort_order' => 'ASC',         'sort_column' => 'menu_order, post_title'     );     $children = get_pages($args);      Or?:               $args = array(         'sort_order' => 'ASC',         'sort_column' => 'menu_order post_title'     );      Or?:               $args = array(         'sort_order' => 'ASC',         'sort_column' => 'menu_order | post_title'     );      Or?:               $args = array(         'sort_order' => 'ASC',         'sort_column' => array('menu_order', 'post_title')     );      etc... From wp_query it seems like it would be a simple space? Multiple orderby values in WP_Query Should really be in the spec.!


Get string from array and start loop

I´m using this code to get all members of the groups, in which the logged-in user is member of. Questions: The $group_id is a string from an array. My problem is, there are more than one $value / group_id in the array. In this example group_id=5 and group_id=6 So how can I change the code to a loop (for e.g. with foreach) to list all members of all $value / group_id, in this example group_id=5 and group_id=6 ? Thank you!               <?php          $user_id = bp_loggedin_user_id();         $groups = BP_Groups_Member::get_group_ids( $user_id );                    foreach ($groups as $type => $properties) {              foreach ($properties as $property => $value) {                  $group_id = 'group_id='. ' ' .$value. ' '  .'&exclude_admins_mods=false';             }         }          if ( bp_group_has_members($group_id) ) : ?>
       <?php bp_group_member_pagination_count() ?>

     <?php bp_group_member_pagination() ?>

     <?php while ( bp_group_members() ) : bp_group_the_member(); ?>
              <?php bp_group_member_avatar() ?>       <?php bp_group_member_link() ?>       <?php bp_group_member_joined_since() ?>
     <?php endwhile; ?>
     <?php endif;?>


Upgraded to 3.6.1. and cannot open my website anymore

I upgraded to 3.6.1. and all the sudden I cannot open my site anymore. Any suggestion on how to solve this?


Template is different with and without comments

My referenced website is at http://angelopardo.com/wakeupbeast and I've built it as a child theme of twentytwelve. Pages and single posts that have comments are displaying correctly, where the sidebar is just right of the posts area. But pages and single posts that don't have comments are bumping down the sidebar below the posts area. What conditional statement outside of the loop can I use to target pages/posts that have no comments, so that it displays the sidebar correctly? I will probably place the code in single.php or page.php I've been stuck on this for ages, so any help would be appreciated. Thanks!


How to get video url and poster url with query in wordpress 3.9.1

[video width="400" height="300" src="UrlVideo" poster="UrlPoster" preload="none"][/video]      How to get UrlVideo and UrlPoster in loop query from content posts


cache reset button and question about deleting cache

I need to put a "delete cache button" on front-end pages. I am looking for plugins for it. any experience or recommendation for it? Can you recommend me a plug in when i create a reset button? What if users keep deleting cache or allow users to delete cache, is it fine or causing any problems for wordpress sites? We use super-cache and we have front end forms based on buddypress and others. After users post, it is not displaying immediately. cuz of cache. then users may need to delete cache. therefore we are trying to find a plugin for users on front-end page. Thank You.


Use code from bundled themes in my theme and resell it

Since a while I have started comparing frameworks for wordpress in order to understand the way wordpress works. Now that I understand the code more clearly, I have compared it to the twentythirteen and twentyfourteen themes bundled with wordpress. I came to understand that quite alot of the code seems to be the same, apart from the functions they all seem to use and call for. Can I do the same thing, using code from those themes? _I'm sorry if this question has already been asked before, just didnt see it anywhere on this site..._ Any suggestions to this issue?


Rewriting post slug before post save

I need to retrieve an ACF field within the post, and change the slug(permalink) of the post before saving it to database. What is the approach to achieve that? I need the slug to be changed every create/edit post operations.


How to determine if I'm on the first page of pagination?

How do I determine if I'm on the very first page of pagination? I'm using WP_Pagenavi. I want to run a function only on the first page of the pagination. I checked the query_var 'paged', it's set to 0 on this page, and then 2, 3 and so on in the later pages (1 is missing!)... Anyone knows a clean solution? Thanks.


Custom Loop, Match Category with Page

I want to set up my template so that Pages show a list of posts where the category slug matches the page slug. So on the Page "About Us" ('about'), posts tagged with the category-slug 'about'. The sidebar should show a list of these posts (I need to hardcode this. NO PLUGINS). Index.php should show all posts, EXcluding the posts that show up on a page. This is the custom loop generates a list of recent posts that I will be adding to sidebar.php. This needs to be modified so that it only shows posts in a category that matches the page.
     <?php     query_posts( 'posts_per_page=5' );     if ( have_posts() ) :           while ( have_posts() ) : the_post();         ?>
<a href="<?php the_permalink() ?>"><?php the_title() ?>
<?php     endwhile;     endif;     wp_reset_query();     ?>
      I tried to explain as clearly as possible, but it's a little confusing, so please me know what I need to make more clear.


My search form finds page 1 results but shows "error 404 page not found" on pages 2 on or clicking next

search-form.php
         <form method="get" class="searchform" action="<?php echo home_url( '/' ); ?>" >             <input type="text" class="field s" name="s" value="<?php _e( 'Search…', 'woothemes' ); ?>" onfocus="if (this.value == '<?php _e( 'Search…', 'woothemes' ); ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search…', 'woothemes' ); ?>';}" />             <input type="image" src="<?php echo get_template_directory_uri(); ?>/images/ico-search.png" alt="<?php _e( 'Search', 'woothemes' ); ?>" class="submit" name="submit" />         </form>


Add categories and posts to page hierarchy

So, I find myself in this situation now and again, trying to solve a particular workflow. I have a page hierarchy something like this:               Page 1         Sub-page 1 (category term listing)             Post 1             Post 2         Sub-page 3 (standard page)     Page 2 (category term listing)         Post 5         Post 6      Now the particular problem is that I want to maintain this hierarchical structure, particularly in the breadcrumbs and url (friendly rewrites). Basically I want category and post pages to appear in the page hierarchy, for example `/Page 1/Sub-page 1/Post 1/`, rather than the wordpress default: `/category/{category-name}` and `/blog/{post-name}`. Is this just something WordPress won't do, or does anyone have any clever workarounds?


Backup another database with BackUpWordPress plugin

Is there any possibilities to add another database which is connected to other wordpress plugin? My site is using two database: main wordpress db and additional db for plugin data. The Backup includes only the main one. But i want to include the other one too.


Problems in migration of WordPress site from local server to the online server

I am finding some problems uploading a WP site from my local webserver to the official online webserver. The situation is the following one, on my local web server:   1. I have install WP website on my computer   2. I have configure it   3. I have custom a template  After, I have upload this site in a folder on my official online webserverm I have took the local database on the online database using PhpMyAdmin (to export the local databse on a file and then to import it on the online database) Finnally I have changed the file **wp-config.php** changing the MySql connection settings and putting here the settings related to the official online database. When I try to open the website it appears to me, here you can say how: http://www.scorejava.com/wordpress/ Ok...seems good but there is two problems:   1. **If you try to open an article it is not open the article on the online server but in the localhost server, infact open this URL:`http://localhost/wordpress/?p=81`**   2. **If I try to open the administration pannel opening this URL:`http://www.scorejava.com/wordpress/wp-admin/` I obtain a white page** I don't know if these two problems are related togheter but I think that all may depend due to a problem of location path... I think that somewhere there is some settings that specify the URL (that can't be localhost...), but (if it is so...) where is this setting? in some file or in the database? Some one have an idea? Can you help me?


Custom row action on custom posts list page causes a wp_die?

The scenario is this: I have a CPT called Job. I've set custom row actions for this CPT, and most of them are linked to external or custom settings pages. They work fine. Now I've set a new row action, called as 'mark-special', and I've set the href for the link as the same posts list page with my own params as: `edit.php?post_type=job&action=mark-special&job_id=123&_wpnonce=<custom nonce>` I'm handling the action in a function hooked with `init`. The problem is, when I click this link, it `wp_die`s with a message: `Are you sure you want to do this?`. But the function works as I want it to, and the CPT is set as special. Any way I can solve this?


Export / import Wordpress database

Is there a proper way of exporting and importing a big WordPress MySQL database to a new database? When I tried to do that in the standard way I run into 2 issues:   1. All widgets disappeared and I had to create them from scratch   2. I had issues with special characters such as `'` and I had to search and replace the gibberish letters This is quite important as I need to move to a managed server from shared hosting. All apache, php, MySQL versions will be the same. Ps: this will have to be SSH commands as phpadmin times out due to the database size.


Updating post content and custom fields in edit post screen

I'm trying to find the best approach to customising the edit post screen for a custom post type. I want to add a button which, when clicked will trigger code which looks up an external (not WP) database, gets some data, and then updates various fields - both core WP fields and custom meta fields. Ideally, the updates should update fields in the editor, but not commit anything to the WP database until the user then saves the edits (with the normal 'update' button). So far, I have tried adding a submit button in the metabox, and then hooking into 'wp_insert_post_data'. That works, but I get a browser "The changes you made will be lost if you navigate away from this page" message if any fields have been edited which I don't want. As for updating the data, I am updating $post by hooking into 'dbx_post_advanced', and adding my own filters to hook into my custom meta fields, which updates what goes into the fields without updating the DB. Again, that works, but 'dbx_post_advanced' feels a bit hackish as it is buried deep in edit-form-advanced.php and there's no documentation I could find as to what it is meant to be used for. Is there a better way to achieve this, or at least some way to avoid the browser complaining that I'm moving away from a page where I have made edits?


Set default avatar network-wide

I've seen plugins and snippets on how to set a new default avatar for a site. I'm wondering if this can be done network-wide, such that every new site on the network will have the network's avatar as its primary default. from there the plugin's that allow the user to upload a new avatar will be sufficient to let each site define it's own. But until they do I'd prefer they have my avatar than the mystery man or some of the others which are downright ugly.


Contact Form 7 not sending emails- no confirmation, no error

Live site. I've noticed that Contact Form 7 recently stopped working, despite my not having touched any of the settings. What's odd is that I receive neither a confirmation nor an error message; I click "send" and nothing happens. This problem persists across FF, Safari, and Chrome. I read in other, older threads that it could be something to do with SMTP settings, but as the threads were 2 years old, most of the work-around plugins they suggested are no longer an option. I also found a patch that was intended to address a problem similar to what I'm experiencing, but the patch has made no difference in my situation. Any ideas? Once the problem is fixed.. is there any way for me to obtain the lost email? I use the form for my business site and have undoubtedly lost leads because of this.. WP 3.4.2 CF7 3.3.1 ETA: More info here.


Strange Behaviour with is_home()

I'm having an odd issue, although I can understand why it works like this I do need to find a way around it. I have used the the request filter to modify the query for the home/index page to select for a post type other than 'post' The result of this is that is_home() is returning false in the index.php template. If I disable the filter then is_home() goes back to returning true. Anyway to force the is_home() to return true? or another way to approach this? Thanks, Stewart.


How to Remove Subscribers from the Post Author Drop Down

I have a WP Multisite installation. On the main blog all subscribers are appearing in the post author dropdown on the post edit screen. I think this happened after an upgrade to 3.0.1. The new user role is set to Subscriber, so it's not like all the new signups are being made contributors or authors. Does anyone know if the problem I'm experiencing is a bug? Or am I missing something really obvious? We have hundreds of subscribers so it's really a pain to try to find the right one to assign a post author. Any help / hacks would be much appreciated. Thank you. ALSO.... when I look at edit-form-advanced.php , I see this:               if ( post_type_supports($post_type, 'author') ) {         $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM         if ( $post->post_author && !in_array($post->post_author, $authors) )             $authors[] = $post->post_author;         if ( ( $authors && count( $authors ) > 1 ) || is_super_admin() )             add_meta_box('authordiv', __('Author'), 'post_author_meta_box', $post_type, 'normal', 'core');     }      Is there anything I can change in there to fix this?


wordpress theme option in other templates

I am using word press theme option panel and using those in my header.php without any issues, code as follows...               <?php         // loading theme options.  used in header.php         global $options;         foreach ($options as $value) {             if (get_settings( $value['id'] ) === FALSE) {                  $$value['id'] = $value['std'];              } else {                  $$value['id'] = get_settings( $value['id'] );              }         }     ?>          <?php echo $aagt_fb_url; ?> //loads fb url      But if i use `<?php echo $aagt_fb_url; ?>` in index.php it doesn't work, can you please help me to resolve this issue. thanks.


single-type.php not working, delivering 404

I've created a custom post type, and have successfully added a few entries. I can call these entries out with `query_posts()` to show on the front page, but `the_permalink()` on each of them just sends me to a "Page not found" 404. Am I missing something? I'm currently running on `http://localhost`, so the results of `the_permalink()` from the front page custom post type loop sends the user to `http://localhost/PU/PU2010/website/cartoons/einstein-on- california`. ### functions.php               function createCartoonPostType() {         register_post_type( 'cartoon', array(             'label' => 'Cartoon',             'public' => true,             'hierarchical' => true,             'supports' => array( 'title', 'editor', 'thumbnail', 'comments' ),             'rewrite' => array( 'slug' => 'cartoons' )         ) );     }     add_action( 'init', 'createCartoonPostType' );      According to this, I should be able to just create `single-cartoon.php`, correct? ### single-cartoon.php               <?php get_header(); ?>

                     <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>                              <?php the_title(); ?>                          <?php endwhile; ?>

                 <?php get_template_part( 'social', 'box' ); ?>                 <?php get_sidebar(); ?>

          <?php get_footer(); ?>      ### loops-cartoons.php (frontpage loop)               <?php query_posts( 'post_type=cartoon&posts_per_page=1' ); ?>

         <?php if ( ! have_posts() ) : ?>             Sorry, no posts.         <?php else : while ( have_posts() ) : the_post(); ?>
                  <a href="<?php the_permalink(); ?>" class="preview-image">                        <?php the_post_thumbnail( 'featured' ); ?>
         <?php endwhile; endif; ?>

     <?php wp_reset_query(); ?>


Removing blog page images

I have my blog page here on a website I created, however I'm not understanding quite where to find the code to get rid of the images on my child theme. I'm using code from Twenty Ten and have set my own BLOG template page up but it's not working so I'm obviously editing the wrong file. So isn't loop.php the file I'd want to edit to take out these images on the main blog page?               <?php /* How to display all other posts. */ ?>              <?php else : ?>             <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
                        <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
                     <?php the_excerpt(); ?>
         <?php else : ?>
                     <?php the_content( __( 'Continue reading →', 'twentyten' ) ); ?>                     <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentyten' ), 'after' => '
' ) ); ?>
         <?php endif; ?>
       But I don't know where it is that shows the images. These are just images I've added to the blog entries throughout the content. Help is appreciated!


Category Templates for Post Types not Working

I came up with this in the codex in order to set my template for a specific category post. I have a category name called "Work". The slug for this category is "work". I created a "category-work.php" file, and yet, the post still defaults to the index.php. I am trying to access the post itself. What am I missing?


Custom Post Type and Custom Taxonomy Permalinks

I'm currently working with a client's Wordpress blog that has a permalink structure set in the admin settings as "/speaks/%postname%/". This is so that all actual blog posts (post_type=>posts) have the word "speaks" before them. However, I have created a new custom post type and a new custom taxonomy for a new section on the site. I currently have a page at /advantages/professional- development that I would like to list the new custom taxonomy on as well as the new custom post types. I have code in place on this page that is listing out the custom taxonomy "categories" for my custom post type, but the permalink for each of these taxonomy terms include the word "speak" before the rest of the permalink. How do I go about removing the word "speaks" only from this custom post type and taxonomy? Here is the code creating my custom post type:               function register_custom_posts() {     register_post_type( 'profdev', /* (http://codex.wordpress.org/Function_Reference/register_post_type) */             // let's now add all the options for this post type             array('labels' => array(                 'name' => __('Professional Dev Posts'), /* This is the Title of the Group */                 'singular_name' => __('Professional Dev Post'), /* This is the individual type */                 'all_items' => __('All Professional Dev Posts'), /* the all items menu item */                 'add_new' => __('Add New'), /* The add new menu item */                 'add_new_item' => __('Add New Professional Dev Post'), /* Add New Display Title */                 'edit' => __( 'Edit' ), /* Edit Dialog */                 'edit_item' => __('Edit Professional Dev Posts'), /* Edit Display Title */                 'new_item' => __('New Professional Dev Post'), /* New Display Title */                 'view_item' => __('View Professional Dev Post'), /* View Display Title */                 'search_items' => __('Search Professional Dev Posts'), /* Search Custom Type Title */                  'not_found' =>  __('No Professional Dev Posts Found.'), /* This displays if there are no entries yet */                  'not_found_in_trash' => __('Nothing found in Trash'), /* This displays if there is nothing in the trash */                 'parent_item_colon' => ''                 ), /* end of arrays */                 'description' => __( 'Professional Dev Custom Post Type' ), /* Custom Type Description */                 'public' => true,                 'publicly_queryable' => true,                 'exclude_from_search' => true,                 'show_ui' => true,                 'query_var' => true,                 'menu_position' => '', /* this is what order you want it to appear in on the left hand side menu */                  'menu_icon' => 'dashicons-businessman', /* 16px x 16px */                 'rewrite'   => array( 'slug' => 'advantages/professional-development', 'with_front' => false ), /* you can specify its url slug */                 'has_archive' => false, /* you can rename the slug here */                 'capability_type' => 'post',                 'hierarchical' => false,                 /* the next one is important, it tells what's enabled in the post editor */                 'supports' => array('title','editor','excerpt','page-attributes') // all of the post capabilities             ) /* end of options */     ); /* end of register post type */     } add_action( 'init', 'register_custom_posts');      And here is the code that creates my custom taxonomy for this post type:               function create_profdev_taxonomies() {     // Add new taxonomy, NOT hierarchical (like tags)     $labels = array(         'name'                       => _x( 'Categories', 'taxonomy general name' ),         'singular_name'              => _x( 'Category', 'taxonomy singular name' ),         'search_items'               => __( 'Search Categories' ),         'popular_items'              => __( 'Popular Categories' ),         'all_items'                  => __( 'All Categories' ),         'parent_item'                => null,         'parent_item_colon'          => null,         'edit_item'                  => __( 'Edit Category' ),         'update_item'                => __( 'Update Category' ),         'add_new_item'               => __( 'Add New Category' ),         'new_item_name'              => __( 'New Category Name' ),         'separate_items_with_commas' => __( 'Separate categories with commas' ),         'add_or_remove_items'        => __( 'Add or remove categories' ),         'choose_from_most_used'      => __( 'Choose from the most used categories' ),         'not_found'                  => __( 'No categories found.' ),         'menu_name'                  => __( 'Categories' ),     );          $args = array(         'hierarchical'          => false,         'labels'                => $labels,         'show_ui'               => true,         'show_admin_column'     => true,         'update_count_callback' => '_update_post_term_count',         'query_var'             => true,         'rewrite'               => array( 'slug' => 'advantages/professional-development/' ),     );          register_taxonomy( 'prof_dev_category', 'profdev', $args );     }      Ideally, I'd like to have the following permalink format: /advantages/professional-development/taxonomy-term/post-name How can I go about achieving this? Any help would be greatly appreciated! * * * **UPDATE** - Can't believe I missed it, but somehow I forgot to include               , 'with_front' => false      at the end of my taxonomy rewrite slug rule. The corrected code is:               'rewrite' => array( 'slug' => 'advantages/professional-development', 'with_front' => false )      This results in ignoring the default permalink settings in WP Admin.


HTTPS connection with wampserver for "Facebook for WordPress" plugin

I have installed Wordpress 3.9.1 on wampserver2.2e-php5.3.13-httpd2.2.22-mysql5.5.24-x64. Then I installed the Facebook Plugin (1.5.5). I created a Facebook app and than I wanted to enter the credentials in the Facebook plugin. I get the following error message: > Your server does not support communication with Facebook servers over HTTPS. > > Facebook application functionality such as posting to your Facebook Timeline > requires a HTTPS connection to Facebook servers What can I do to allow the HTTPS connection? Is this a configuration problem with wampserver? PS: I don't know where to put this topic. Is it serverfault, superuser or wordpress? I put it on wordpress because it is the main topic here. **Edit:**   The error message is thrown through this piece of code:               // notify of lack of HTTPS     if ( ! wp_http_supports( array( 'ssl' => true ) ) )         add_action( 'admin_notices', array( 'Facebook_Application_Settings', 'admin_notice' ) );


User submitted post

I'm sure there are plugins to do this but I wanted to try and do it myself. I have a form that contains a title and a content/message area. I would like to add this form as a post when fill it in. How do I go about adding the user completed form as a post. Any tutorials or pointers would be greatly appreciated.


SWF in wordpress post

My question is somewhat a two part question. First I embedded a SWF file into my blog post using Easy Flash Embed plugin. It shows up on my desktop computer but when I view the post on my mobile device, I can not see the SWF content. Does the plugin Easy FancyBox solve this problem? My follow-up question is, I'm wondering if embedded SWF files is safe for my blog/website. Should I not use SWFs?


get_page_children arguments - page objects?

From the Codex, I'm using this function to return all children from a page ID without using SQL queries. Usage:               <?php get_page_children( $page_id, $pages ) ?>      $page is defined as a "List of pages' objects". What are examples of page objects I would use in this case?


Transfer from English page to Arabic page

I have a button at the top of the website in **header.php**. That button should transfer me to the Arabic version of the page if I am on an English page. For example, on **contact.html** the button should transfer me to **contact- ar.html** and on **info.html** the button should transfer me to **info- ar.html**.
arabic
      I want to know if there is any way to edit part of the **header.php** from outside?


Custom taxonomy position in admin panel

I can't figure out how to change position of custom taxonomy menu item in the admin panel. Right now I have custom post type-- `custom_1`-- and another custom post type-- `custom_2`. For custom_2, I've set `'show_in_menu' => 'edit.php?post_type=custom_1'` and it works fine. The problem is, I've added a custom taxonomy for custom_2 and it's not showing under the same parent menu item. Is there any way to alter the position of custom taxonomy menu item?


Make WordPress size and name images for Retina.js

I'm a huge fan of the way retina.js works for high pixel density displays. Essentially, when it's loading image assets (via `<img>` or css image) it will check if there's a `@2x` suffix version of the image (eg. if there's a `logo.jpg` it will automatically show the `logo@2x.jpg` in its place if it exists. The WordPress function `the_post_thumbnail` lets me define various image sizes, but I want to know if there's a way to have it also create versions of the images that are twice the size with the `@2x` suffix as well! It's easy to do this for theme files, but would be pretty awesome to allow this for content images as well.


Jetpack infinite scroll not working on Twenty Twelve

I just updated **Jetpack** and the theme, and the **infinite scroll** doesn't work anymore. I have tracked the console, and the **XHR** does receive the content of the posts to add but somehow it isn't displaying them. My blog is: http://jorjon.com/blog/ I have **no custom modification** whatsoever. **Update:** Thanks to Jared, I have found this Javascript console error:               Uncaught SyntaxError: Unexpected token < jquery.js:2     v.extend.parseJSON jquery.js:2     (anonymous function) infinity.js:208     l jquery.js:2     c.fireWith jquery.js:2     T jquery.js:2     r      **Update 2:** This is what is being returned by the **XHR** , supposedly there is an unexpected token there, but I can't find anything. The JSON at the last line, as Jared mentioned, is Valid. http://pastebin.com/ZUD2xqun


Retrieve image from content, assign it as a featured, and then remove it from the content

I am trying to grab the first image from the content and use as featured image, then remove the that image from the content. I found the plugin get the image, but it doesn't save image on the post, at least on 3.5.1 wp


Why is it bad to use the GUID?

I recently upgraded my WP version from 3.2.x to 3.5.x. In the process, the WP functions that retrieve images (wp_get_attachment_image_src, get_the_post_thumbnail, etc) are now broken. I had to change calls to those functions and use `<img src='.$my_post->guid.'>` in order to get it to work. However, people have told me that using guid is not good. I'm not changing the value though, just using it because I can't find any other way to get my images to load properly. The `wp_get_attachment_image_src` method doesn't return anything. What's so bad about using the guid if it doesn't change? Is it okay in this situation?


Can a WordPress administrator see other users' passwords?

Of course, an administrator in WordPress can reset other users' passwords (including that of other administrators). However, can a WordPress administrator **see** other users' passwords? Phrased differently, does the WordPress software protect registered users from an unscrupulous administrator observing their passwords? Of course, since WordPress is open source, I realize a malicious administrator could hack the software to divulge users' passwords. But I'm asking about the standard WordPress build.


Deleting users do not deletes coments

Hello I have bee trying to figure this one out without any luck. I am deleting users from my site, and selecting either `delete comments` or `attribute comments to:` options do nothing. The user does not show in dashboard->users but all their comments are there and/or not attributed to someone i chose. Any ideas why this is?


When is it OK to create a custom table for a plugin?

A while ago I wrote a question asking about storing easily queryable data associated with a given attachment. The recommendation that I received at the time was that I should avoid using the WP attachment metadata because it cannot be quickly queried for. Instead, what was recommended (and what I opted to implement) was to store all of the values in an array within an option. This works, but the design of the thing makes me want to cry. It goes agains every fiber of my being which says, "that should be its own table!" See what I mean: http://pastebin.com/hBfrxaiH So my question is, under what circumstances should a WP developer consider creating a custom table to support their plugin? I know that custom tables are generally frowned upon, but I feel like what I'm currently doing is an abomination and really would like to achieve my plugin's needs in a cleaner way. My thinking with a custom table is that not only would it clean up this design disaster, but I would also have a higher degree of control over how and when values are loaded from the DB rather than just pulling EVERYTHING out before being able to do anything intelligent with the data. Additionally, unlike the current solution, a custom table would scale -- the current solution most definitely does NOT scale.


How do i reference the theme path in pages for images?

How do i reference images in a page/post without installing the php plugin or typing it out manually like this:               domain.com/wp-content/themes/mytheme/image.jpg


Format HTTP links

I have a custom page template creating an xml feed found on a WP page at http://example.com/xml/ I am trying to access this xml document via Google Maps but it appears I need the actual file name like example.com/xml/example.xml How can I add a .xml file extension at the end of the link http://example.com/xml/ ? **EDIT:** I am using a page template in my theme to display the output of XML. The XML part is probably irrelevant. What it comes down to I guess is how do I assign a specific file extension off of a page template such as /example.xml


Possible to replicate economist.com's debate section in wordpress?

We're building an online magazine with a debate section similar to economist.com/debate. Is it possible to do it in wordpress with existing plugins? Thanks so much.


Making WP Admin Folder accessable JUST under a different link

I read all your post regarding renaming and moving the admin folder a few times but I still didn't find the real answers to my question! I got a page, lets say available under mysite.com ,the real wordpress is found under mysite.com/wordpress (of course not directly available over that link) and therefore my wp admin under mysite.com/wordpress/wp-admin/ I made the needed adaptions in the index.php and used the following commands in my .htaccess to make my wordpress available under mysite.com                   <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /         RewriteRule ^index\.php$ - [L]         RewriteCond %{REQUEST_FILENAME} !-f         RewriteCond %{REQUEST_FILENAME} !-d         RewriteRule . /index.php [L]         </IfModule>      Everything is working perfect now BUT want to realise the follwing. I want to reach my admin section JUST over lets say mysite.com/secret-area and mysite.com/secretarea/ and NOT ANYMORE over mysite.com/blog/wp-admin/ or mysite.com/blog/admin If I would be able to realise a server based password protection for that path too, it would be extremly great :) How can I realise that over .htaccess ? I did a lot of research and tried a lot of things but couldn't get it done in the end :/ Thx a lot for your help guys! Nice Regards, Stephan


Add Submenu Link in add_submenu_page That Opens in a New Window

How can I add a sub menu link using add_submenu_page that will open a new window (`target="_blank"`) instead of opening in the current one (default behavior)?


Show WordPress Custom Taxonomy Items Based On a Selected Item From Another Custom Taxonomy

Let me explain the problem I am dealing with: I have 2 custom taxonomies. One is named "thestate" and the other one is named "thetown". In " **thestate** " I have listed all the states in the U.S.   In " **thetown** " I have listed the main towns in the U.S. For each taxonomy I have their items displayed in a drop-down Do you understand where I am going with this? :D I need to be able to display the items in "thetown" based on what state is selected in the taxonomy "thestate" **For example** , if the user selects "Michigan" (in the taxonomy called "thestate), the page automatically refreshes, and in the next drop-down, in the taxonomy called "thetown", I have only the cities "Detroit", "Grand Rapids", "Warren". If the user then changes his mind and selects "Texas", the page automatically refreshes and in the next drop-down, in the taxonomy called "thetown" I have only the cities "Houston", "San Antonio", "Dallas". Hope my explanation makes sense! Can you think of a logic by which I can accomplish this? Best regards, Gabriela


jquery document ready function not being called

For some reason I can't get the jquery document ready to fire for my plugin my javascript               jquery(document).ready(function($) {         alert("hello world");         $("#testdiv").text("hi");     });      the source from my website               <link rel='stylesheet' id='admin-bar-css'  href='http://example.com/wp-includes/css/admin-bar.css?ver=20111209' type='text/css' media='all' />     <script type='text/javascript' src='http://example.com/wp-includes/js/jquery/jquery.js?ver=1.7.1'></script>     <script type='text/javascript'>     /* <![CDATA[ */     var fantasy_golf = {"ajaxurl":"http:\/\/example.com\/wp-admin\/admin-ajax.php"};     /* ]]> */     </script>     <script type='text/javascript' src='http://example.com/wp-content/plugins/fantasy-golf/js/fantasy-golf.js?ver=1.2'></script>     <script type='text/javascript' src='http://example.com/wp-includes/js/comment-reply.js?ver=20090102'></script>      when I follow the source of my fantasy-golf.js (in firefox's source) it has the correct version of my js. (it shouldn't be due to it caching an older version)


Group WP_Query by meta_key date

I have a wp_query which lists posts from a custom post type, sorted by a custom field 'time'. I'd like to group this list by another custom field 'date', so that every post that has the same custom field 'date' is listed beneath that date. I do not know these dates in advance. The output would be like: Date x   - post 3   - post 6   - post 8   Date y   - post 1   - post 4   Date z   - post 2   - post 5   - post 7   - post 9   Below is my current WP_Query:               <?php             // WP_Query arguments             $args = array (                 'post_type'              => 'movie',                 'posts_per_page'         => '50',                 'orderby'                => 'meta_value_num',                 'order'                  => 'ASC',                 'meta_key'               => 'time',             );                  // The Query             $query = new WP_Query( $args );                  // The Loop             if ( $query->have_posts() ) {                 while ( $query->have_posts() ) {                     $query->the_post();                     echo "
";                     echo "
".get_the_title()."
";                     echo "
";                          $vbrand = get_post_meta( get_the_id(), 'brand', true );                      $vyear = get_post_meta( get_the_id(), 'year', true );                      $vtime = get_post_meta( get_the_id(), 'time', true );                                   echo "
".$vbrand;                     echo "
".$vyear;                     echo "
".$vtime;                 }                  } else {                 // no posts found             }             /* Restore original Post Data */             wp_reset_postdata();     ?>


Code only works every other time its run

This code below works fine as long as I leave the $wpdb query commented out. However, I'm trying to clear the current settings before I write the new ones into the db. That's the purpose of the $wpdb delete command. However, something curious is happening. It only writes the values to the database every other time its run. Despite the fact that I can trace echo the correct values each time. Either the delete is running after the update_options loop (clearing the values) or the values never get written.               function doSettings()     {     /* FIRST CLEAR ALL SETTINGS */          //  global $wpdb;     //  $wpdb->query( "Delete FROM wp_options where option_name like 'mx2|_%' escape '|'");              $file = WP_PLUGIN_DIR.'/mx-settings/settings.ini';         if (file_exists($file) && is_readable($file))         {                    $ini_array = parse_ini_file($file);             foreach ($ini_array as $key=>$value) {                 if($key != "template" && $key != "stylesheet")                     update_option($key, stripslashes($value));             }          }         return;     }


Custom Post Type Nav to Subpage

I've registered a post type for an audio plugin, the post type is "Custom Players" in the admin and has its own tab on the admin sidebar. I'm just curious if there's a simple way to move this out of the menu and make it another sub-item under "Settings", for example, as cleverly illustrated in this screenshot: ![enter image description here](http://i.stack.imgur.com/cGGdA.png) I know about the `show_in_menu` key for `register_post_type()` but don't want to make the post type inaccessible from the admin; I'm just curious about making it less prominent, it's a post type that won't be used frequently. Thanks for even looking at this! Peace


How to add a data attribute to a WordPress menu item

I'm Twitter Bootstrap and need to add data-toggle="modal" attribute to the a tag of menu link. Upon searching most all results reference doing a walking for Twitter Bootstrap dropdown menus however this menu has no dropdowns and I only need to add the particular attribute. Next I found this: Add custom attributes to menu items without plugin which is very helpful as it appears in WordPress 3.6+ we no longer have to do long complex walkers and instead can use this: http://codex.wordpress.org/Plugin_API/Filter_Reference/nav_menu_link_attributes However as of this running that API reference is quite bare and offers no examples and since it's so new there are very few references to it on Google. I tried this first:               add_filter( 'nav_menu_link_attributes', 'mywp_contact_menu_atts', 10, 3 );          function pb_contact_menu_atts( $atts, $item, $args )     {         // inspect $item, then …         $atts['data-toggle'] = 'modal';         return $atts;     }      and that does work however it as expected adds the attribute to all the a tags in the menu. So I'm trying to figure out how to target one menu item with #menu-item-7857 a or such. Does anyone know where to find an example of targeting a menu item or able to determine how to basd on the information that's in the above linked API reference? To note, I did find the following one example but it only targets items that have children which does not help but may be in the right direction:               add_filter('nav_menu_link_attributes', function($atts, $item, $args) {         if ( $args->has_children )         {             $atts['data-toggle'] = 'dropdown';             $atts['class'] = 'dropdown-toggle';         }              return $atts;     }, 10, 3);      UPDATE - The only answer below sounds like it's on to something but from it wasn't able to determine how to actually find the number to target my specific link and where/how to add that conditional in a working example. Added a comment but didn't hear back. Since been about 18 days thought I'd see if a bounty would help. When I look at the code for the link I want to target:
Chat
      I see the number 7858 so thinking maybe that is the number I should be targeting. But when I try for instance: ` add_filter( 'nav_menu_link_attributes', 'my_chat_menu_atts', 10, 3 ); function my_chat_menu_atts( $atts, $item, $args ) { if ( 7857 == $item['ID'] ) { // inspect $item, then … $atts['onclick'] = 'SnapEngage.startLink();'; return $atts;               }      } ` However adding that if statement the one commenter suggested I get the following error: Fatal error: Cannot use object of type WP_Post as array I'm assuming more code is required but at a lost. As a reminder without the if statement it works however it targets all links rather than the one link I want to target.


I want to add a tax-ID field in registration form and upon submission, perform a lookup by tax-ID

I want to allow visitors to register to my site. I want to add tax ID field in the form. Upon submission, I want to check if the user belongs to a list (which has been imported in a custom table)and if yes, assign him a role. How do you propose I should handle all that? Thanks.


Ajax for non-logged-in users

I'm working on a plugin that captures some data from a non-logged-in user (such as a Like Button) and enters it into the database based on post_id. My plugin works fine for logged-in users but non-logged-in users produces a "-1" response in AJAX. I'm guessing this has to do with an authentication barrier for writing to the database but I'm looking for a way to work around that. Any ideas? EDIT: Here is the code: http://pastebin.com/ghtvJNiW I'm basing this off the Love-It AJAX plugin by Pippin. He says in the tutorial that this only works for logged-in users but I need to get this to work for non-logged-in users as well.