title: Dynamic Stylesheet loads but doesn't finish

text:
I am creating a website for an architect with large images being a main feature of the site. Given the potential size of the images I wanted to have a way to create responsive image sizing (and of course I thought of css and background images. I thought I could use CSS to build the small image as the default and as screen width increases use media queries to add larger background images). My thought was to use a separate dynamic stylesheet (sliders.php) and write a script that looped through the images to create a slide show. A few notes: I'm using flexslider as an image slider and Advanced Custom Fields and Custom Post Types to create "architectural projects" with featured images to create the slideshow and using my functions.php file to auto create multiple sizes for the background images. My wordpress image slider on the front end is created with the following loop:
              <?php               $the_query = new WP_Query(array(             'post_type' => 'projects'            ));         ?>              <div class="RMA-slider slider-main slider-<?php echo the_ID(); ?>">
                      <?php                     $slideNumber = 0;     // Set Slide numbering to 0                          while (has_sub_field('project_slider_images')) :                          $slideNumber++;                 ?>
                     <div class="slider-image slide-<?php echo $slideNumber ?>">

                      <?php endwhile; ?>                 <?php wp_reset_postdata(); ?>

      Having run some tests, I'm fairly certain the problem is in the sliders.php file which is only used to set-up the sliders. I have two stylesheets:   1. screen.css (my non-dynamic stylesheet)   2. style.php - A dynamic stylesheet that pulls images from the wordpress database and puts them into the dynamic stylesheet as background images. The problem is that the loop doesn't run for every project and I can't figure out why? I've enqueued the stylesheets with the dynamic stylesheet getting precedent, but no change. The entire dynamic stylesheet is below. I have 3 different sliders running and therefore there are 3 slider loops created:               <?php     header('Content-type: text/css');     header("Cache-Control: must-revalidate");     $offset = 100;     $ExpStr = "Expires" . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";     header($ExpStr);          $parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );     $url = $parse_uri[0];          require_once($url . 'wp-load.php' );     require_once($url . 'wp-includes/post.php');     require_once($url . 'wp-content/plugins/advanced-custom-fields/acf.php');     require_once($url . 'wp-content/plugins/custom-post-type-ui/custom-post-type-ui.php');          ?>               /* ___________MAIN SLIDER IMAGE SET-UP______________________________________________ */          //THIS WORKS AS IT SHOULD          <?php            $the_query = new WP_Query(array(         'post_type' => 'slides',         'posts_per_page' => -1         ));             $sliderTitle = get_the_title();            $slideNumber = 0;            while ($the_query->have_posts()) :         $the_query->the_post();            $slideNumber++;            $attachment_id = get_field('slider_image');       $sizeSm = "slider-image-sm";       $sizeMd = "slider-image-md";       $sizeLg = "slider-image-Lg";       $image_attributes_sm = wp_get_attachment_image_src( $attachment_id, $sizeSm );       $image_attributes_md = wp_get_attachment_image_src( $attachment_id, $sizeMd );       $image_attributes_lg = wp_get_attachment_image_src( $attachment_id, $sizeLg );          ?>          // Set-up Responsive Image loading and allow for full-page background image slider          .slider-major .slider-main.slider-homepage .slide-<?php echo $slideNumber; ?> {       background-image: url("<?php echo $image_attributes_sm[0]; ?>");     }          @media only screen and (min-height: 45em) {       .slider-major .slider-main.slider-homepage .slide-<?php echo $slideNumber; ?>{         background-image: url("<?php echo $image_attributes_md[0]; ?>");       }     }          @media only screen and (min-width: 45em) {       .slider-major .slider-main.slider-homepage .slide-<?php echo $slideNumber; ?> {         background-image: url("<?php echo $image_attributes_md[0]; ?>");       }     }           @media only screen and (min-width: 100em) {       .slider-major .slider-main.slider-homepage .slide-<?php echo $slideNumber; ?> {         background-image: url("<?php echo $image_attributes_lg[0]; ?>");       }     }          <?php wp_reset_postdata(); ?>     <?php endwhile; ?>                                   /* ___________PROJECT SLIDER IMAGE SET-UP________________________________________ */           //THIS IS THE PROBLEM. ONLY LOOPS THROUGH A FEW PROJECTS. THERE WILL BE UPWARDS OF 15 PROJECTS ON THE SITE AND ONLY 4-5 OF THEM WORK TO SHOW IMAGES          <?php            $the_query = new WP_Query(array(         'post_type' => 'projects'       ));                 while ( $the_query->have_posts() ) :         $the_query->the_post();                 $slideNumber = 0;            while (has_sub_field('project_slider_images')) :            $slideNumber++;            $attachment_id = get_sub_field('project_slider_image');       $sizeSm = "slider-image-sm";       $sizeMd = "slider-image-md";       $sizeLg = "slider-image-Lg";       $image_attributes_sm = wp_get_attachment_image_src( $attachment_id, $sizeSm );       $image_attributes_md = wp_get_attachment_image_src( $attachment_id, $sizeMd );       $image_attributes_lg = wp_get_attachment_image_src( $attachment_id, $sizeLg );          ?>          // Set-up Responsive Image loading and allow for full-page background image slider          .slider-major .slider-main.slider-<?php echo the_ID(); ?> .slide-<?php echo $slideNumber; ?> {       background-image: url("<?php echo $image_attributes_sm[0]; ?>");     }          @media only screen and (min-height: 45em) {       .slider-major .slider-main.slider-<?php echo the_ID(); ?> .slide-<?php echo $slideNumber; ?>{         background-image: url("<?php echo $image_attributes_md[0]; ?>");       }     }          @media only screen and (min-width: 45em) {       .slider-major .slider-main.slider-<?php echo the_ID(); ?> .slide-<?php echo $slideNumber; ?> {         background-image: url("<?php echo $image_attributes_md[0]; ?>");       }     }           @media only screen and (min-width: 100em) {       .slider-major .slider-main.slider-<?php echo the_ID(); ?> .slide-<?php echo $slideNumber; ?> {         background-image: url("<?php echo $image_attributes_lg[0]; ?>");       }     }          <?php wp_reset_postdata(); ?>     <?php endwhile; ?>     <?php endwhile; ?>                              /* ___________PRACTICE SLIDER IMAGE SET-UP____________________________________ */                          //THIS WORKS AS IT SHOULD          <?php            $the_query = new WP_Query(array(         'post_type' => 'practice_slides',         'posts_per_page' => -1         ));             $sliderTitle = get_the_title();            $slideNumber = 0;            while ($the_query->have_posts()) :         $the_query->the_post();            $slideNumber++;            $attachment_id = get_field('practice_slider_image');       $sizeSm = "slider-image-sm";       $sizeMd = "slider-image-md";       $sizeLg = "slider-image-Lg";       $image_attributes_sm = wp_get_attachment_image_src( $attachment_id, $sizeSm );       $image_attributes_md = wp_get_attachment_image_src( $attachment_id, $sizeMd );       $image_attributes_lg = wp_get_attachment_image_src( $attachment_id, $sizeLg );          ?>          // Set-up Responsive Image loading and allow for full-page background image slider          .slider-major .slider-main.slider-practice .slide-<?php echo $slideNumber; ?> {       background-image: url("<?php echo $image_attributes_sm[0]; ?>");     }     @media only screen and (min-height: 45em) {       .slider-major .slider-main.slider-practice .slide-<?php echo $slideNumber; ?>{         background-image: url("<?php echo $image_attributes_md[0]; ?>");       }     }          @media only screen and (min-width: 45em) {       .slider-major .slider-main.slider-practice .slide-<?php echo $slideNumber; ?> {         background-image: url("<?php echo $image_attributes_md[0]; ?>");       }     }           @media only screen and (min-width: 100em) {       .slider-major .slider-main.slider-practice .slide-<?php echo $slideNumber; ?> {         background-image: url("<?php echo $image_attributes_lg[0]; ?>");       }     }     <?php wp_reset_postdata(); ?>     <?php endwhile; ?>        * An example of a project that shows all images   * An example that's not working


title: Touch Punch and JQuery Accordion Menu Widget

text: I have been trying to figure out a way to enable touch events for the JQuery Accordion Menu Widget plugin (http://wordpress.org/support/plugin/jquery- vertical-accordion-menu); i.e. on a mobile device, touching the parent menu the first time should expand the menu to reveal the children, while a second tap would actually take you to the corresponding page. There seems to be a hack that should in theory allow this; see here: http://touchpunch.furf.com/ I am not sure, however, how to implement this. Adding the scripts is easy enough, but I believe some modifications to the plugin itself might be required. Does anyone know how to go about implementing this? Any tips would be very appreciated.


title: Managing WP Core & Plugin Updates for Clients

text: I'd like to know how you go about managing WP Core & Plugin updates for clients? It's a service my web company would like to start offering but we are unsure of the best solution. Let me provide some details:   1. The sites we build are under Version Control (Git/Github)   2. Our process typically involves 3 environments: Local Dev, Staging/Testing, Production   3. Deployment is handled through Github & DeployHQ   4. Databases are Sync'd using the excellent WP Migrate DB Pro Plugin   5. Sites are hosted on a VPS By default we disable automatic updates in WP. We are looking for a solution which fits within our workflow and wonder if anyone else uses a similar workflow? We do not want to simply login to a clients production site and update the core and/or plugins through the admin. This would mean code under Version Control would be "out-of-date" and this could potentially break the live site. We will soon be managing code & db backups with CodeGuard. Any suggestions would be much appreciated.


title: Adding custom field values to wp_list_pages

text:
I am trying to pull in a custom field vales for each page while using wp_list_pages. For example I want to list out each portfolio item in my sidebar but also show why type of work it is by pulling in a custom field value so it would look like this:   * Portfolio Item 1 Type: Web Design   * Portfolio Item 2 Type: Web Development Here is the code I am using to pull in custom post types and this works perfectly, I just have no idea how to have it pull custom field values as well:               function wp_list_post_types( $args ) {     $defaults = array(         'numberposts'  => -1,         'offset'       => 0,         'orderby'      => 'menu_order, post_title',         'post_type'    => 'our-work',         'depth'        => 0,         'show_date'    => '',         'date_format'  => get_option('date_format'),         'child_of'     => 0,         'exclude'      => '',         'include'      => '',         'title_li'     => __(''),         'echo'         => 1,         'link_before'  => '',         'link_after'   => '',         'exclude_tree' => '' );          $r = wp_parse_args( $args, $defaults );     extract( $r, EXTR_SKIP );          $output = '';     $current_page = 0;          // sanitize, mostly to keep spaces out     $r['exclude'] = preg_replace('/[^0-9,]/', '', $r['exclude']);          // Allow plugins to filter an array of excluded pages (but don't put a nullstring into the array)     $exclude_array = ( $r['exclude'] ) ? explode(',', $r['exclude']) : array();     $r['exclude'] = implode( ',', apply_filters('wp_list_post_types_excludes', $exclude_array) );          // Query pages.     $r['hierarchical'] = 0;     $pages = get_posts($r);          if ( !empty($pages) ) {         if ( $r['title_li'] )             $output .= '
' . $r['title_li'] . '
';              global $wp_query;         if ( ($r['post_type'] == get_query_var('post_type')) || is_attachment() )             $current_page = $wp_query->get_queried_object_id();         $output .= walk_page_tree($pages, $r['depth'], $current_page, $r);              if ( $r['title_li'] )             $output .= '

';     }          $output = apply_filters('wp_list_pages', $output, $r);          if ( $r['echo'] )         echo $output;     else         return $output;      }


title: wp_term_relationships has term_relationship_id of 0, causing issues with backup

text: After bulk tagging posts via mysql, I may have inserted a bunch of rows into my `wp_term_relationships` table that have a `term_taxonomy_id` of `0`. I believe this causing issues when i try to backup the database (the error is akin to "`duplicate id for primary key`") **Question:** Is it safe for me to delete all rows from where `term_taxonomy_id = 0`? Am I correct in thinking that such an term does not exist thus is causing issues?


title: How to remove Tags: text from the_tags?

text: The function `the_tags();` gives output as: `Tags: tag1, tag2`. But I want to get the tags only without the text `Tags:`. How can I use the function so that it does not out the text`? Thanks.


title: Add links widget to self-hosted blog?

text: http://en.support.wordpress.com/widgets/links-widget/ discusses a Links widget that makes it easy to create a blogroll in your sidebar. I'm not seeing this widget in my blog by default, and searching the plugins available is not turning it up. Is this feature available to self-hosted blogs? How, if so? Or is this one of those features only available to wordpress.com sites and I'll just have to find another similar widget?


title: Query unique author ids with published post of type job

text: I'm trying to come up with a simple query to return an array of unique author IDs that have a post_status of 'publish' and a post_type of 'job'. I know I can query using:               $args = array(     'post_type' => 'job',     'post_status' => 'publish'     );     $published_jobs = new WP_Query( $args );      But this seems horribly inefficient to iterate through the results when all I want is an array of unique author IDs. At most we will have 30 or so authors, but could have thousands of job posts. Any suggestions? Thanks!


title: Media Library Image search goes to No items found

text: I have a wordpress site, It contains several images in media library, Those images are uploaded by vary users with admin access, The issue is if try to search image while insert image to post, It will be goes to 'No items Found'., Please help in this. thanks in advance.


title: How to display subcategory articles in the category view?

text: I have the wordpress category widget installed on my website that lists all categories/subcategories on my site and their hierachy:               Watch Accessories (1)      - Straps (1)     Watch Glossary (5)     Watch Guides (1)      - Maintenance (1)     Watch News (2)      - New Releases (2)     Watch Reviews (7)      - Christopher Ward (1)      - Hamilton (1)      - Seiko (2)      - Tissot (2)      - Vostok (1)      I am using the following permalink structure:               /%category%/%postname%/      When I click on the parent categories > >     http://www.domain.com/watch-reviews/ >   it shows the category view and lists all articles in that category. But when I click on a subcategory > >     http://www.domain.com/watch-reviews/seiko/ >   it doesn't show the category view, it doesn't list all the articles in the subcategory. Instead it redirects to the first article in the sub category. How can I get Wordpress to display all articles in a subcategory?


title: Proper use of Output Buffer

text: I'm attempting to use actions to override function calls I currently have throughout a template (to make updating certain replicated sections easier). For example, in `archives.php` I have the following:               <?php get_header(); ?>              <?php roots_content_before(); ?>         <?php $page_for_posts = get_option( 'page_for_posts' ); if ($page_for_posts) { echo '<h1>' . get_the_title($page_for_posts) . '</h1>'; } ?>         <h3>             <?php                 $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));                 if ($term) {                     echo $term->name;                 } elseif (is_day()) {                     printf(__('Daily Archives: %s', 'roots'), get_the_date());                 } elseif (is_month()) {                     printf(__('Monthly Archives: %s', 'roots'), get_the_date('F Y'));                 } elseif (is_year()) {                     printf(__('Yearly Archives: %s', 'roots'), get_the_date('Y'));                 } elseif (is_author()) {                     global $post;                     $author_id = $post->post_author;                     printf(__('Author Archives: %s', 'roots'), get_the_author_meta('user_nicename', $author_id));                 } else {                     single_cat_title();                 }             ?>         </h3>         <?php echo category_description(); ?>         <?php roots_loop_before(); ?>         <?php get_template_part('loop', 'category'); ?>         <?php roots_loop_after(); ?>         <?php roots_content_after(); ?>          <?php get_footer(); ?>      You can see a few of the functions, like `roots_content_before();` In a separate file, I have the following: `function roots_content_before() { do_action('roots_content_before'); }` and use it as follows:               <?php              add_action('roots_content_before', 'roots_bootstrap_content_before');              function roots_bootstrap_content_before() { ?>                  this is some text              <?php }          ?>      From what I've read, especially if I'm going to have large chunks of code, I should be using the output buffer, but when I try to do this, I'm getting diddly squat:               <?php              add_action('roots_content_before', 'roots_bootstrap_content_before');              function roots_bootstrap_content_before() { ob_start(); ?>                   this is some text                 <?php return ob_get_clean();              }          ?>      Am I thinking of this completely wrong? I am still learning, but have been trying for a bit without any success. Any pointers in the right direction would really be appreciated. Thanks!


title: Change url tag name

text: I need to change this url from:               http://www.mydomain.ext/tag/mytag/      to               http://www.mydomain.ext/article/mytag/      Is it possible? Thanks!


title: how do I display a featured image in a post type?

text: I have a single-posttype.php and I'm trying to figure out how to display the image


title: Buddypress send email notification only if user is not logged in

text: When a member send a message to another member, the recipient receive a message in buddypress and also an email. I want to change that because if you receive many messages, you have too much mail in your mailbox even if you are logged in : I want to receive mail only if I am not logged in buddybress. I have find where adding the code but I don't know how to hooks (add_action or add_filter) The file is : wp-content/plugins/buddypress/bp-messages/bp- messages-notifications.php and the modification is at the end of file, just adding the if test before sending email :               if (!is_user_online($recipient->user_id)) {          wp_mail( $email_to, $email_subject, $email_content );     }      How I can do this without change the core file of buddypress ?


title: How to have 2 posting pages on a blog

text: It is possible to have 2 posting pages on a page? I have a static home page and I want to create 2 more pages for my blog which are "News" and "Recent Projects".


title: Why isn't my if/elseif/else working correctly here?

text:
I am using a simple if/elseif/else bit of code to generate a header image for my page, I can't seem to understand why it isn't working properly. It determines the category of the page being displayed and displays a header accordingly. Here's the code in my header.php:               <?php if (is_category('dino run') || has_category('dino run')) { ?>

Dino Run

                <?php } elseif (is_category('potatoman') || has_category('potatoman')) { ?>
Potatoman Seeks the Troof
     <?php } elseif (is_category('glorkian' || 'glork') || has_category('glorkian' || 'glork')) { ?>
Glorkian Warrior
     <?php } else { ?>
The Pixeljam Octology
     <?php } ?>      The problem I'm having is I click on a post that has a category "Dino Run" and it displays fine... but when I click on a post that doesn't have any of the above 3 defined categories it doesn't fall through to the else statement, it actually displays the third header "Glorkian Warrior". Any ideas what I did wrong here?


title: PageNav Not working on Custom Post - function built into theme

text:
The Pagenav will not appear on this page, I've got the wp-pagenav function built into the theme so calling it works on all the other pages. It appears on the blog template I'm using but just not the "Stockists One"               $includes = get_template_directory() . '/includes/';      require_once ($includes . 'pagenavi.php');      I've included the Pagenavi functionality within a file named pagenavi.php                 <?php         /*           Template Name: Stockists          *          */         ?>              <?php get_header(); ?>

<?php the_title();?>

<?php the_breadcrumb(); ?>

<a href="<?php echo home_url(); ?>">

Store Locator
                                     <form name="locator" action="" method="post" id="locator">                                         <input type="hidden" name="keyword[eq:instance_type:yes]" value="56:Document"/>                                         <input type="hidden" name="storelocator" value="1"/>                                         <fieldset>
Please search for a xxx® dealer near you.

Area                                             <?php                                             $args = array(                                                 'order' => 'asc',                                                 'show_option_none' => 'Select area',                                                 'show_count' => 0,                                                 'hide_empty' => 0,                                                 'echo' => 1,                                                 'selected' => 0,                                                 'hierarchical' => 0,                                                 'name' => 'region',                                                 'id' => 'region',                                                 'class' => 'region',                                                 'depth' => 3,                                                 'tab_index' => 0,                                                 'taxonomy' => 'store-category',                                                 'hide_if_empty' => false);                                              wp_dropdown_categories($args); ?>                                             <input type="button" class="image" value="Search" title="search" alt="search" onclick="this.form.submit();"/>
                                          </fieldset>                                 </form>              <?php if (isset($_POST['region'])) {          ?>                              <?php                              $args = array(                             'orderby' => 'name',                             'order' => 'ASC',                     'posts_per_page' => 5,                     'paged' => get_query_var('paged'),                             'tax_query' => array(                                 array(                                     'taxonomy' => 'store-category',                                     'field' => 'id',                                     'terms' => array($_POST['region'])                                 )                             )                         );                   $query = new WP_Query($args);                                      if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();                                     $mapurl = get_post_meta($post->ID, 'lj_mapurl', true); ?>                                              <?php                                          $premium = get_field('premium_stock_supplier');                                             if ( ! $premium ) { // this is basically short for $premium == false                                                  ?>

                                                     <?php the_title(); ?>                                                         <?php the_content(); ?>

                                                   <a class="viewMap" href="<?php echo $mapurl; ?>" title="Find <?php the_title(); ?> on a map (opens in a new window)" target="_blank">View Map

                                             <?php } else { // code for the stockists not marked as premium ?>

                                                     <?php the_content(); ?>

                                                     <?php   if ( has_post_thumbnail() ) {                                                     the_post_thumbnail('stock');                                                     } ?>

                                             <a class="viewMap" href="<?php echo $mapurl; ?>" title="Find <?php the_title(); ?> on a map (opens in a new window)" target="_blank">View Map

                                             <?php } ?>                                          <?php endwhile; ?>                                     <?php else: ?>
Sorry, content not found
                                          <?php endif; ?>              <?php } ?>
If you cannot find a retailer near your location email xxx.co.uk for help.

                                                     <?php   if ( has_post_thumbnail() ) {                                                     the_post_thumbnail('stock');                                                     } ?>                    <?php      get_template_part('includes/wp-pagenavi');      if(function_exists('wp_pagenavi')) {      wp_pagenavi( array( 'query' => $query ) );      }     wp_reset_postdata();    // avoid errors further down the page     ?>

         <?php get_footer(); ?>      Here is the page_template where the pagenav does appear.               <?php     /*     Template Name: Sorting blog page     */     ?>          <?php get_header();           ?>

<?php the_title();?>

<?php the_breadcrumb(); ?>

<a href="<?php echo home_url(); ?>">

Show All               <?php $categories = get_terms("category");             foreach ($categories as $category) {                 $entrycategory = str_replace(' ', '-', $category->name);                 echo ''.$category->name.' ';             }             ?>

                      <?php portfolio('port4',4,'post'); ?>
                  <?php             get_template_part('includes/wp-pagenavi');             if(function_exists('wp_pagenavi')) { wp_pagenavi(); }             ?>

                    <?php get_footer(); ?>      Now I've tried using both the documentations recommended function callback and the way I've done it for the blog page neither work.                <?php             get_template_part('includes/wp-pagenavi');             if(function_exists('wp_pagenavi')) { wp_pagenavi(); }      ?>      Any suggestions I'm very grateful for :)


title: show the meta values to visitors that collected via coment form

text: in stackoverflow (here) there is a solution for collecting extra information from visitors, and i want to ask that, is it possible to show the collected information to other visitors in his/her comment section? Thanks...


title: Additional, optional fee on Woocommerce Checkout

text: I'm building a shop based on WooCommerce. I need to add an extra checkbox on the checkout page called Shipping Insurance. Once the field is checked, i need to add an extra $3 to the Order Total. I was able to add a fixed fee this way:               function woo_add_cart_fee() {       global $woocommerce;       $woocommerce->cart->add_fee( __('Shipping Insurance', 'woocommerce'), 3 );          }     add_action( 'woocommerce_before_calculate_totals', 'woo_add_cart_fee' );      The problem is that this will add a fixed $3 to the order total, so its not optional. Any idea how to proceed with this issue?


title: How to retrieve "custom url" from image attachment in wordpress

text:
I have uploaded a bunch of images to a post and set the 'custom url' for each of them in the media uploader. How can I retrieve the custom URL assigned to each image into $caption_text= at the bottom?                   $images =& get_children( array(                                  'post_parent' => $featured_page,                                 'post_status' => 'inherit',                                 'post_type' => 'attachment',                                 'post_mime_type' => 'image',                                 'order' => 'ASC',                                 'numberposts' => $thelimit,                                 'orderby' => 'menu_order' )                                 );          // Loop through the images     foreach ( $images as $id => $image ) {         $attatchmentID = $image->ID;              $imagearray = wp_get_attachment_image_src( $attatchmentID , 'fullsize', false);         $imageURI = $imagearray[0];         $imageID = get_post($attatchmentID);              $thumb_imagearray = wp_get_attachment_image_src( $attatchmentID , 'fullscreen-thumbnails', false);         $thumb_imageURI = $thumb_imagearray[0];              $imageTitle = $image->post_title;         $imageDesc = $image->post_content;         $postlink = get_permalink($image->post_parent);         // If linking is On         if ($featured_linked == 1 || $featured_linked == true) {             $attatchmentURL = get_attachment_link($image->ID);         }         // Count         $count++;         if ($count>1) { echo ","; }              $slideshow_title="";         $slideshow_caption="";              //Find and replace all new lines to BR tags         $find   = array("\r\n", "\n", "\r");         $replace = '
';         $imageDesc = str_replace($find, $replace , $imageDesc);         $image_post_link = get_permalink();                   if ($imageTitle) $slideshow_title='
'. esc_attr($imageTitle) .'
';         if ($imageDesc) $slideshow_caption='
'. $imageDesc .'
';                   $caption_text= '
' . $slideshow_title . $slideshow_caption . '> Preview Article
';                   echo "{image : '".$imageURI."', title : '". $caption_text . "', thumb : '".$thumb_imageURI."', url : ''}";     }


title: Using a Cron Job to dynamically populate a field ONCE, and then making the field blank the next time someone visits page

text: I'm probably going to butcher explaining what I'm trying to do, so bare with me. Essentially I'm working on a custom Contest type of solution for a client. I'm using Gravity Forms for the users to sign up, and then I have a hidden field that is able to be populated dynamically through GF. I have a Cron Job set up to where once a day it will populate that field with a value of "winner". However it only needs to be populated for the first user that hits the site after the scheduled job runs, then for the next person it should be blank again. I've looked into using a session variable, but unless I can pull the session id, I can't exactly make that work correctly. I can't use a query string, as I don't want the user to know if they've won until after they fill out the form, which then it will use the value to show a winner or loser section with javascript. I'm about 99% sure this is not the best way to go about it, but being somewhat of a PHP newb, this is what the last few days of research has gotten me. Any help would be greatly appreciated.


title: Change CSS for logged in users

text: In my css i have a hidden `div id`:               #example {display:none;}      How can I set this to `display:block` for logged in users only? I am assuming using Jquery would be the best option here for best performance? Or is it better to use a function in functions.php ?


title: WP Multisite URL rewrite static content folder

text: I have a WP multisite installation on the root folder. one of the sites have a subdomain               subdomain.mysite.com      in the root folder there is a sub directory called               /subdomain-static      folder structure looks like something like below               www     |     |- static-content     |    |....     |     |-wp-content     |-wp-admin     |...       I want to rewrite urls for the content in subdomain-static so it would look like               subdomain.mysite.com/demo/static/subdomain-static/....      I've tried the following               RewriteRule ^/subdomain-static/(.*)$ http://subdomain.mysite.com/demo/static/$1 [R=301,L]      also few simillar things without no luck any help is appreciates


title: Settings API: Two update notices after saving settings?

text:
I've used the settings API to create a very simple page for plugin settings. This is my first time using the API, and through various tutorials online and answers here, I think I've figured it out. This is backed up by the fact that the page even works!! However, something weird is happening: ![two notices regarding the saving of settings](http://i.stack.imgur.com/dSv88.png) As you can see above, there are two div.update messages being displayed on the screen. I've checked and there's only one call to the `settings_errors()` function so and that function isn't called in a loop or anything that I can find, but I'm still getting two notices. Here's the code:               public function __construct() {         /* more stuff */              add_action("admin_menu", array($this, "plugin_settings_menu_add");         if($pagenow == "options.php" || $pagenow == "options-general.php") {             add_action("admin_init", array($this, "plugin_settings_initialize");         }     }          public function plugin_settings_menu_add() {         add_options_page("Gallery Settings", "Galleries", "manage_options", "galleries-settings-page", array($this, "plugin_settings_menu_display"));     }          public function plugin_settings_menu_display() {         require(plugin_dir_path(__FILE__) . "views/plugin-settings.php");     }          public function plugin_settings_permissions_to_use_default() {         return apply_filters(             "plugin_settings_permissions_to_use_default",             array(                 "galleries-settings-permission-to-use-url" => ""             )         );     }          public function plugin_settings_initialize() {         if(get_option("galleries-settings-permission-to-use") == false) {             add_option("galleries-settings-permission-to-use", $this->plugin_settings_permissions_to_use_default());         }              add_settings_section(             "galleries-settings-permission-to-use-section",                    // DOM ID for the section             "Permission to Use Gallery Items",                                        // on-screen title for it             array($this, "plugin_settings_permissions_to_use_header_display"),        // callback to display its header             "galleries-settings-page"                                            // the menu page on which to show it         );              add_settings_field(             "galleries-settings-permission-to-use-url",             'Webtools Form (required)',             array($this, "plugin_settings_permissions_to_use_url_display"),             "galleries-settings-page",             "galleries-settings-permission-to-use-section"         );              register_setting(             "galleries-settings-page",             "galleries-settings-permission-to-use",             array($this, "plugin_settings_permissions_to_use_sanitize")         );     }          public function plugin_settings_permissions_to_use_header_display() {         echo "
......
";     }          public function plugin_settings_permissions_to_use_url_display() {         $settings = get_option("galleries-settings-permission-to-use");         $value = isset($settings["galleries-settings-permission-to-use-url"])             ? $settings["galleries-settings-permission-to-use-url"]             : ""; ?>              <input type="url" id="galleries-settings-permission-to-use-url"             name="galleries-settings-permission-to-use[galleries-settings-permission-to-use-url]"             value="<?=esc_url($value)?>" class="regular-text" required aria-required="true">
              Enter the full URL but without any query string parameters.         <? }          public function plugin_settings_permissions_to_use_sanitize($input) {         $output = array();         foreach($input as $key => $value) {             // even though we have only one field here at the moment, we'll use a loop and a switch             // to santize.  that way we're ready to go with respect to additional data that might one             // day be sent here.                    switch($key) {             case "galleries-settings-permission-to-use-url":                 if(empty($value) || !filter_var($value, FILTER_VALIDATE_URL)) {                     add_setting_error("galleries-settings-permission-to-use-url",                         "galleries-settings-permission-to-use-url-invalid",                         "You must enter a valid web address."                     );                 } elseif(($qloc = strpos($value, "?"))!==false) $value = substr($value, 0, $qloc);                 break;             }                  $output[$key] = $value;         }              return apply_filters("galleries_plugin_settings_permissions_to_use_sanitize", $output, $input);     }      The following is the contents of the `plugin-settings.php` page that's included in the code above:

Gallery Settings
              <? settings_errors(); ?>              <form method="post" action="options.php">                 <? settings_fields("galleries-settings-page"); ?>                 <? do_settings_sections("galleries-settings-page"); ?>                 <? submit_button(); ?>         </form>
      And, yes, as you can probably tell, this is Yet Another Image Gallery Plugin. I did do a search and replace to hide some of the information about for whom I'm doing the plugin. Hopefully doing so didn't introduce any errors.


title: Duplicate posts being displayed when querying Custom Fields

text:
I have created a small segment within WordPress that records match information for League of Legends. Using up to 30 different custom fields I can store information of 30 champions picked from 3 games (10 different champions are picked each game) I want to query all games the champion 'Shen' has played in but the issue have come across is, if 'shen' was Picked in two of the three games played, that individual match is displayed twice in the loop. Is it possible to prevent any duplicates if a custom field has duplication information? Code I am using currently:               <?php          $querystr = "     SELECT $wpdb->posts.*      FROM $wpdb->posts, $wpdb->postmeta     WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id      AND $wpdb->postmeta.meta_value = 'Shen'      AND $wpdb->posts.post_status = 'publish'      AND $wpdb->posts.post_type = 'matches'     AND $wpdb->posts.post_date < NOW()     ORDER BY $wpdb->posts.post_date DESC     ";          $pageposts = $wpdb->get_results($querystr, OBJECT);          ?>     <?php if ($pageposts): ?>     <?php global $post; ?>     <?php foreach ($pageposts as $post): ?>          <?php setup_postdata($post); ?>

vs

<a href="<?php the_permalink(); ?>">view match information

<?php echo get_post_meta($post->ID, 'dbt_tournamentname', true) ?>

<img src="<?php echo get_post_meta($post->ID, 'dbt_team1logo', true) ?>" />

<img src="<?php echo get_post_meta($post->ID, 'dbt_team2logo', true) ?>" />

     <?php endforeach; ?>          <?php else : ?>
No matches found featuring 'Shen'.

Sorry, no team composition featured the selected champion.
          <?php endif; ?>      Any help will be greatly appreciated! Cheers Dan


title: Different size video display for category page (smaller) & detail page (larger)

text: I have a 'media' category page that pumps in videos / image galleries. I'm looking to have a smaller size video display (vimeo / youtube) on the category page, and the full size video on the single page. How do I change the size of the video embed on the fly for the both scenarios? Here's the loop for selecting anything in the "videos" category.                   <?php $videos = new WP_Query('category_name=video'); ?>         <?php while ( $videos->have_posts() ) : $videos->the_post(); ?>         <?php the_content(); ?>         <?php endwhile; ?>      Videos are entered into the post's main tinymce content editor. Am I being to vague?


title: Linking together two different custom post types

text: I hope someone can help out with this as it is very frustrating... I am trying to build a property site in Wordpress and would like to link two custom post types together - One would be development areas and the other would be individual properties within that development area I understand that I can create a CPT called 'Developments' and another called 'Properties' but how would I go about linking them together?.. for example if I created a property and tried to attach it to a development how would this work if they are separate custom post types? I read a similar question - How to connect different CPTs together? and the answer by Scuba Kay was almost what I needed but I don't know how you would query a certain property which belongs to a certain Development Thanks in advance!


title: Retrieve post data via WPDB class

text:
I'm trying to figure out doing a custom query using the $wpdb Object. I have custom type posts, event_posts, that have meta data, images, as well as event dates which are input in the post with the FT Calendar plugin. I can get posts that have event dates (dates pulled from the ftcalendar_events table), but my first issue is that when I query the post type it comes back as "revision" and not "event_posts". My second issue is that I don't know how to retrieve the metadata and images for the post. Here's what I am using below. Why am I doing it this way you might ask? Because I need to order the posts based on the event date, which is pulled from the ftcalendar_events table, and even though the standard wp query methods retrieve the post with all of that information, there isn't a way to order them by the event date. Any ideas how to retrieve all of that?               global $wpdb;     $poos = $wpdb->get_results("         SELECT         p.post_title AS title,         p.post_type AS type,         p.post_content AS content,         ev.start_datetime AS start         FROM         " . $wpdb->prefix . "posts AS p,         " . $wpdb->prefix . "ftcalendar_events AS ev         WHERE         p.post_parent = ev.post_parent         AND         p.post_type='event_posts'         ORDER BY         ev.start_datetime         ASC     ");          //print_r($poos);     //echo '

';          foreach($poos as $poo){         echo $poo->type.'
';         echo $poo->title.'
';         echo $poo->content.'
';         echo $poo->start.'

';         }      That outputs:               revision (should be "event_posts")     Home Town Celebration     Historic 'Home Town' Celebration in Ridgefield WA. An '0ld town' holiday celebration artisans fair and market. December 2013     2013-12-07 11:00:00


title: Cannot update a file for my theme

text:
I have a theme that automatically adds some widgets. I don't want them and so I tried to edit the Sidebar.php but it just fails and sends me to a page with message 404. Here's the code block I am trying to delete from Sidebar.php:
     <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('south_sidebar') ) : ?>

Archives
             <?php if(function_exists('wp_easyarchives_widget')) : ?>                 <?php wp_easyarchives_widget("mode=none&limit=6"); ?>             <?php else : ?>
                     <?php wp_get_archives('type=monthly'); ?>
             <?php endif; ?>

Meta

                 <?php wp_register(); ?>
<?php wp_loginout(); ?>

          <?php endif; ?>
           EDIT: So for now what I have done is I modified the css to hide southsidebar. But actually I want to use that div by adding other widgets.


title: Problem with shortcodes in external file

text: I have simple post with a shortcode:               [xx]http://harrix.org/1.txt[xx]      And an external file which has the content containing a WordPress shortcode:               [strong] g[/strong]      I try add my own tag to load the external file:               <?     add_filter('the_content', 'WorkWithTags');     function WorkWithTags($content){     $Tag ="xx";          if (preg_match_all('~\['.$Tag.'\](.*?)\[/'.$Tag.'\]~is', $content, $arr))      {         foreach ($arr[1] as $value)         {           $newvalue = @file_get_contents($value);//Main String                $content=str_replace($value, $newvalue, $content);        }             //Delete tags        $tr=array('['.$Tag.']'=>'','[/'.$Tag.']'=>'',);         $content=strtr($content,$tr);     }     return $content;     }     ?>      Adding file works good. But the external file contains shortcodes of WordPress. How can I get WordPress to execute all of the shortcodes from this external file? **Update.** I try use code by s_ha_dum in **functions.php** :               function WorkWithTags($atts,$content){       $atts = shortcode_atts(         array(           'tag' => 'xx'         ),         $atts       );       $fo = $atts['tag'];       $content = file_get_contents($fo);//Main String       return do_shortcode($content);     }     add_shortcode('wwt','WorkWithTags');      ![enter image description here](http://i.stack.imgur.com/TxMw6.png) Then I add this shortcode in post:               Text. Text. Text. Text. Text. Text. Text. Text.           [wwt tag="http://harrix.org/1.txt" /]          Text. Text. Text. Text. Text. Text. Text. Text.      ![enter image description here](http://i.stack.imgur.com/rj2Xh.png) And I see that in preview of post: ![enter image description here](http://i.stack.imgur.com/nugUC.png) I can not run shortcodes in an external file.


title: Scaling an image in a WordPress post

text: I am currently building a WordPress theme and when I add an image using the add media button, I'm able to choose a scaling percentage to allow the image to get bigger or smaller within the modal pop up box. It seems that the standard themes that ship with WordPress allow the user to do this, so there must be some functionality that is included with these themes. It seems when I inspect the code that there is an alternative width and height attribute added to the image when percentage scaling is added to an image within the context of a theme like Twenty Eleven. Is it straightforward to add this functionality to themes built from scratch as I am doing?


title: One Child Functions.php for Multiple Child Themes

text: I have a wordpress setup that I use for clients with around 30 or so child themes that they can choose from. Each child theme has it's own functions.php file currently. Is it possible to setup just one child functions.php and call it from all the separate child themes? My reason for wanting this functionality is I find myself continually making changes to the functions.php and I have to do it to all 30+ themes every time.


title: Single page site with history.js

text: I'm developing a single page site that shows each page on the front page, like so:                                               *-----------------*                                     | Home            |                                     |                 |                                     |                 |                                     |                 |                                     *-----------------*                                     | About           |                                     |                 |                                     |                 |                                     |                 |                                     *-----------------*                                     | Work            |                                     |                 |                                     |                 |                                     |                 |                                     *-----------------*      And I'm using history.js to alter the URL structure based on which section is visible in the viewport. Everything controlling this output is in my theme's `index.php`, and mirrored in the `pages.php` file. Which I'm sure there's a better way to do that, but I've no idea what it might be. I want all pages that aren't /, /about or /work to redirect to the homepage (client doesn't want to use 404), another thing I don't know how to go about setting up. I know I could put a PHP redirect in the `single.php` file and an `include()` in the `pages.php` but that doesn't strike me like the best option.


title: Is it to possible to insert a page in the post depending on the category ofthe post

text:
I am making a website about world countries and cities.Every Post will be a city name and will have a category of a country. In the beggining of the post I want to have a brief description of the country instead of writing the same description to 20 or more cities. Is it possible that wordpress would see the category is Europe > Germany and inside the post put brief description which I would have in a page called Germany ? * * * **edit:** I found a piece of code which can add a page inside a post http://css-tricks.com/snippets/wordpress/embed-a-page-inside-a-page/ Still I need a way to do that the page would be added only if post is in certain category * * * **edit2:** I've done what I wanted.Half-manually though, but it works. Soluton: This in single.php               <?php get_template_part( 'countries' ); ?>      I created countries.php in index and there put the code:               <?php     if(in_category('category-2')) {          $recent = new WP_Query("page_id=15"); while($recent->have_posts()) : $recent->the_post();?>
<?php the_title(); ?>
            <?php the_content(); ?>     <?php endwhile;          } else {     echo "Error";     }     ?>      Despite that I will have to add every country manually it's the best solution I could find.


title: WordPress 3.3.1 single post template

text: Does anybody have any idea why on single posts there are no template dropdowns for template selections in WP 3.3.1? I did not find that either in the page administrative area. Thank you


title: Gallery Shortcode Function Help

text: Okay, so I found this code online that allows you to add the option of how many thumbnails you want to show in the gallery shortcode. The code below is what they say to add to the functions.php file                     function get_random_gallery_images(){       global $wpdb,$post;           $ids = "";           $counter = 0;           $number_of_posts = 4;           $args = array(           'post_type' => 'attachment',           'numberposts' => 4,           'post_status' => null,           'orderby' => 'rand',           'post_parent' => $post->ID           );           $attachments = get_posts($args);           if ($attachments) {               foreach ($attachments as $attachment) {                        if ($counter != 0) {                       $ids .= ','.$attachment->ID;                   }                   else {                       $ids .= $attachment->ID;                   }                   $counter++;               }           }          return $ids;  }        Then they say add this code below to the loop                      $attachment_ids = get_random_gallery_images();              echo do_shortcode('[ gallery columns="4" include="'.$attachment_ids.'" link="file" ]');      But my problem is, they didn't say where in the loop to add the code. Does anyone know where I can add this code? Also if you have a better solution to achieve what I am asking, please share :)


title: show custom post's post in two different divs

text:
I have created a custom post type. For that I have used this code               add_action( 'init', 'broker_post_type' );     function broker_post_type() {       register_post_type( 'new_broker',         array(           'labels' => array(             'name' => __( 'Brands' ),             'singular_name' => __( 'Brand' )           ),         'public' => true,         'has_archive' => true,         'supports' => array( 'title', 'editor', 'comments', 'excerpt', 'custom-fields', 'thumbnail' ),         )       );     }      Now to show all the featured image of the post type Brands in a single page I have used this code               function display_broker_posts() {       $args = array(         'post_type' => 'new_broker',         'orderby' => 'title',         'order' => 'ASC',         'posts_per_page'=> -1,       );            $dee_bios = new WP_Query( $args );       if( $dee_bios->have_posts() ):         $dee_output = '
';         $dee_output .= '
';         $dee_output .= '
';         $dee_output .= '
';         while ( $dee_bios->have_posts() ) : $dee_bios->the_post();           if( $dee_bios->current_post == 0 || ( $dee_bios->current_post % 2 ) == 0 ) {             $dee_output .= '
';             }           else {             $dee_output .= '
';             }                $dee_output .= get_the_post_thumbnail( $dee_bios->post->ID,'small', 'bios', array( 'class' => 'alignleft' ) );           $dee_output .= '';         //  $dee_output .= '
' . get_the_title() . ', ' . get_the_content() . '
';           $dee_output .= '
';         endwhile;         $dee_output .= '

';         $dee_output .= '
';       endif;            wp_reset_postdata();       return $dee_output;     }      Now this one is giving the result. But here in result I want something different. I want that lets say I have `16 posts in the Post`. So it will show `first 10 posts in a different div and the rest 6 posts in a different div`. So can someone kindly tell me how to do this? Any help will be really appreciable. Thanks


title: Hiding the media-new.php File URL option via jQuery

text: As the title says I'm currently having some difficulties hiding the File URL option via jQuery. I've been trying this:               // add_action( 'admin_footer-media.php', 'cor_remove_tr_file_url' );     add_action( 'admin_footer-media-new.php', 'cor_remove_tr_file_url' );     /**      * Removes the 'File URL' row      */     function cor_remove_tr_file_url() {     ?>     <script>     jQuery(document).ready(function($){       $('tr.image_url').remove()     });     </script>     <?php     }      which works great on `media.php`, but somehow it isn't working on `media- new.php`. Would someone perhaps know what I might be overlooking here? ![enter image description here](http://i.stack.imgur.com/QjFaL.png)


title: Is it possible to embed github gists in wordpress comments?

text: Is it possible to embed github gists in wordpress comments, I have seen a few plugins which allow embedding gists in posts, but not yet seen any plugins that allow embedding gists in comments.


title: query posts and custom post type with meta key

text: I'm trying to query all-in-one-event-calendar's custom post type ai1ec_event and normal wordpress posts in a slider on my home page. That works pretty well. Now I want to query only the posts with the custom field value "teaser", but that returns just normal posts, not the events.               <?php     query_posts( array(     'post_type'=>array('post','ai1ec_event'),        'posts_per_page' => 50,     'meta_query' => array(         array(             'key' => 'teaser',             'value' => 'on'                 )     )     );     ?>      Even if I leave out the post type query:               <?php     query_posts( array(     'meta_query' => array(         array(             'key' => 'teaser',             'value' => 'on'                 )     )     );     ?>      it only returns posts, no events.


title: Changing my permalink structure - will new layout conflict with existing page?

text: My site has a blog page at `/blog/`, with links to blog posts. A post will have a URL starting at the root of the site, which is a bit jarring. I'd like to have the posts URLs appear as if they are within the blog section of the site. My site currently has a permalink structure like the following: `/2010/09/11/sample-post/` I'd like to modify it to include a `blog` prefix: `/blog/2010/09/11/sample-post/` As I understand, WordPress should be able to handle the appropriate redirects. My issue is the fact that I have the blog **page** at `/blog/` If I change my post permalink structure, is there going to be any conflict with a page having a similar URL?


title: Theme files and imagesnot loading on a mobile device

text: I am just setting up my site but I have run in to a weird issue where the site seems to load perfectly fine on my computer but when I view it on a mobile device (iPhone/iPad) it appears to have none of the template files and none of the images are attached to posts etc. Any thoughts what could be wrong? I might add incase it helps I built this on a local set up and it's my first time using this process so there may be something in that I did wrong. But I checked the uploads folder and themes folder and they both have '755' permissions. This is the site: http://www.phoebeschoppingblock.com


title: Getting a List of Currently Available Roles on a WordPress Site?

text: When writing WordPress plugins there is often a need to set up options for which roles on the site have access to certain functionality or content. To do this a plugin dev needs to fetch the list of roles that exist on the site to use in the option. Because custom roles can be created we cannot assume the default roles are the only ones available. What is the best way to fetch the list?


title: Why does WP_DEBUG only work after wp_debug_mode() is called?

text: With debugging set to on,               define('WP_DEBUG', true);      my instance of WordPress doesn't show any debugging info. After a lot of searching I figured that after I call `wp_debug_mode()` debug info shows correctly. Can anyone tell me why calling `wp_debug_mode()` is necessary, since the debugging documentation page doesn't even mention this function? Is there something in my environment that is causing this?


title: Why can't I add this feed to the RSS widget?

text: I wish to use the following RSS in my widget, but it seems to not pick it up: http://www.tapuz.co.il/blog/rssBlog.asp?FolderName=TickTack I imagine there is a problem in the feed. So:   * What is it?   * And can it be fixed? Thanks.


title: Ordering links in List Tables don't include page number

text: I'm working on a WordPress plugin that requires the use of some WP_List_Table[s]. Everything is working fine but the ordering links for the table records do not include the "paged" GET parameter and thus whenever I click them the current page is lost and I'm returned to the first page. The pagination buttons don't seem to have this problem. They contain all the relevant GET parameters, such as "paged", "orderby" and "order" so unlike the ordering links they don't reset any parameter when clicked. Is this normal WordPress behavior or have I missed something?


title: Show only first children level of current category?

text: I wish to display only first level of subcategories on current category page (if any). I tried this code:               <?php             $args=array(                 'child_of' => $cat-id,                 'hide_empty' => 0,                 'orderby' => 'name',                 'order' => 'ASC',                 'depth' => '1' //NOT WORKING                  );             $categories=get_categories($args);             foreach($categories as $category) {                 echo 'term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'';  }             ?>      But, it shows all children, and children's children (grandchildren). I tried with "'depth' => '1'" but it is ignored. How to show only first level of children (if exist) on category page?


title: Translation of plugin Upload button

text: I want to translate "Upload an image" by using `_()`, `_e()`. It does not work for me. I tried `value= _e( 'Upload an image')` but did not work out.               function logo_image() {      $options = get_option('plugin_options');           echo"<input type='text'  class='regular-text text-upload' name='plugin_options[logo_image]' value='{$options['logo_image']}'/>";           echo "<input type='button' class='button button-upload' value='Upload an image'/>";           echo"<img style='max-width: 200px; display: block;' src='{$options['logo_image']}' class='preview-upload'/>";      }


title: Blog Not Loading, Can't Access Admin Page, No Trace of WordPress on Server

text: I recently took over as the webmaster for a small company, and I was asked to figure out what's going on with the company's blog, which uses WordPress. Essentially, the blog won't load, and this prevents me from accessing the admin page. I've checked to make sure the blog is down for everyone, and not just me. I wasn't left with much information about the site, so I assumed that WordPress had been installed to the company server. After a lengthy period of combing the server's files, I wasn't able to find anything related to WordPress. Although I have little knowledge of WordPress, I am aware that the presence of WordPress content in an SQL database is necessary for any page published with WP. How would I find the WP database? I suppose my question is: is there anything I could have overlooked? Are there any default WP files or keywords that would allow me to find any trace of WP or WP published content on the server? If I could find something to fix, I could potentially start looking for solutions to the problem. Thanks, and I apologize if my limited knowledge of WordPress prevented me from effectively expressing my questions.


title: Strange URL alternative behavior. site.com/a redirects to a page like site.com/an-article

text: Today, I saw that the link `site.com/b` doesn't show a 404 page. It goes to `site.com/blog/1393/03/05/built-in-power-supply/` (Maybe because of `built-in-power-supply` at the end) `site.com/c` goes to `site.com/products/sick/proximity-sensor/capacitive/` (Probably because of the last `capacitive`) `site.com/d` is redirected to `site.com/products/danfoss/`. `site.com/en` goes to `site.com/products/sick/encoder/` and `site.com/de` show the page `site.com/detection-and-ranging-solutions/` **BUT** `site.com/fr` shows a **Page Not Found** error, because there is not a page beginning with `fr`. * * * All of the URLS above should show a simple 404 Not Found error. Does anyone have the experience to resolve the strange problem?! Note that we have installed Swifty Page Manager.


title: Is there a way to dump all registered sidebar/widget?

text: I need to know the properties of sidebar and widgets I've added, is there a way to dump those? Thanks.


title: Garbage code showing up in search result post descriptions

text: I don't know why this is showing up on all my post descriptions in Google:                       _// _ // ]]> //      It is driving me crazy. I am new to this but feel this is the reason my posts are not posting alone in Google. They are only tied to my home page in Google.


title: Multiple Installs using the same database AND tables

text: I've been looking for a solution to this problem for actually a few months. Before I get started I would like to inform that I have NO INTEREST in using wordpresses multisite. Here is the issue for my website. I have a:     * Live Web Server/Database Server - **we'll call is mysite.com/news**   * Development Webserver/Database Server - **We'll call it dev.mysite.com/news**   * LOCAL(My Mac) Server that uses the DEVELOPMENT database. (Local changes are committed via SVN to the development server once completed)So the dev and the local stay mirrored for the most part. **we'll call it local.mysite.com/news** The only part of my site that uses Wordpress is our news section, and it's'great! The only issue is when working on the news, I can't work locally, and see my changes until it's committed to the development server and then viewed there. The reason for this is because of the wp_options table that points to the development server. I want to be able to make changes and actually be able to view them on local.mysite.com/news. But when going to local.mysite.com/news it redirects to dev.mysite.com/news because of the options set in the wp_options table. I'm okay with modifying core files, I have no plans to update. Is it possible to make a second wp_options table and specify somewhere in the configuration which wp_option table to use?


title: Correct Method to run scripts with dependencies without enqueue?

text: With enqueue you would change `$deps` to your script or array of scripts that are needed to run first for your script to work.               <?php wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); ?>      For example:               function script_that_requires_jquery() {         wp_register_script( 'script-with-dependency', 'http://www.example.com/script-with-dependency.js', array( 'jquery' ), '1.0.0', true );         wp_enqueue_script( 'script-with-dependency' );     }     add_action( 'wp_enqueue_scripts', 'script_that_requires_jquery' );      I usually do this but it doesn't always seem to work:               function script_that_requires_jquery(){         if ( wp_script_is( 'jquery', 'done' ) ) { ?>             <script type="text/javascript">             (function($) {                 // jquery function goes here                 })( jQuery );             </script>         <?php }     }     add_action('wp_footer', 'script_that_requires_jquery');      Maybe this is it?               function script_that_requires_jquery(){         wp_enqueue_script( 'jquery' );         ?>             <script type="text/javascript">             (function($) {                 // jquery function goes here                 })( jQuery );             </script>         <?php      }     add_action('wp_footer', 'script_that_requires_jquery');


title: prevent HTML output if custom field is empty

text:
I am using the ACF plugin for custom fields. I am using this to add a second content area to my website. I have a peice of JS that says if this div is present then add a class to the page-content div to increase it's size. js:                     HTML:

                         <?php wp_nav_menu( array('top-menu' => 'Top Menu' )); ?>

                         <?php                     // TO SHOW THE PAGE CONTENTS                     while ( have_posts() ) : the_post(); ?>

                 <?php the_field('first_title'); ?>

                      <?php                 $first_comment = get_field('first_content_block');                 echo do_shortcode("[vr_jsp] $first_comment [/vr_jsp]");                     ?>                           <?php                     endwhile; //resetting the page loop                     wp_reset_query(); //resetting the page query                     ?>
                      <?php                     // TO SHOW THE PAGE CONTENTS                     while ( have_posts() ) : the_post(); ?>

                 <?php the_field('second_title'); ?>

                 <?php                 $second_comment = get_field('second_content_block');                 echo do_shortcode("[vr_jsp] $second_comment [/vr_jsp]");                        ?>
                     <?php                     endwhile; //resetting the page loop                     wp_reset_query(); //resetting the page query                     ?>
<a href="<?php echo home_url(); ?>">Return to home page X

      My css works but because the div page-content-text-additional renders with or without content the JS puts the double class on regardless. is there a way I am able to only render the page-content-text-additional if there is content in the ACF query?


title: Infinite blog loop

text:
I can't figure out why I'm getting an infinite blog post. When I comment out loop code in content.php, it no longer loops. I'm trying to post items based on post format and failing so far. Let me know if I need to provide anymore info! I appreciate it. content.php:               <?php     /**      * The default template for displaying content. Used for both single and index/archive/search.      *      * @subpackage FoundationPress      * @since FoundationPress 1.0      */     ?>          <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
             <?php FoundationPress_entry_meta(); ?>
             <?php the_content(__('Continue reading...', 'FoundationPress')); ?>
                  <?php if ( have_posts() ) : ?>                  <?php do_action('foundationPress_before_content'); ?>                  <?php while ( have_posts() ) : the_post(); ?>                 <?php get_template_part( 'content', get_post_format() ); ?>             <?php endwhile; ?>                  <?php else : ?>                      <?php get_template_part( 'content', 'none' ); ?>                  <?php do_action('foundationPress_before_pagination'); ?>         <?php endif;?>                           <?php $tag = get_the_tags(); if (!$tag) { } else { ?>
<?php the_tags(); ?>
<?php } ?>


title: how to get wordpress categories list with thumbnails?

text: i am trying to get thumbnails list with their thumbnails images .i tried code below but it only gives categories list . i know there a could do using feed_image but i can't figure out how to do it .please help me i am just a beginner in wordpress               $args = array(     'show_option_all'    => '',     'orderby'            => 'name',     'order'              => 'ASC',     'style'              => 'list',     'show_count'         => 0,     'hide_empty'         => 1,     'use_desc_for_title' => 1,     'child_of'           => 0,     'feed'               => '',     'feed_type'          => '',     'feed_image'         => '',     'exclude'            => '',     'exclude_tree'       => '',     'include'            => '',     'hierarchical'       => 1,     'title_li'           => __( 'Categories' ),     'show_option_none'   => __( 'No categories' ),     'number'             => null,     'echo'               => 1,     'depth'              => 0,     'current_category'   => 0,     'pad_counts'         => 0,     'taxonomy'           => 'category',     'walker'             => null        );            echo wp_list_categories( $args );


title: Using widgets on an options page?

text: hopefully someone more experienced can help me out with this idea I've got... I'm working on a new theme, and I'd like this to be widgetised. I've done this before using the regular widgets/sidebar setup in the admin area, but this time I'd like the home page sidebar (the drag and drop part) to feature on my theme options page. Can anyone tell me how tough this would be? I would like access to the same set of widgets, but a drag and drop sidebar area which is laid out horizontally rather than vertically, so the user could choose widgets for , say, 3 columns. I think this would make a cool interface for the administrator - if only I knew more..! Many thanks, Dan.


title: List of contents of entire blog

text: There is a widget categories which prints categories as tree, for example:               category1       subcategory1       subcategory2     category2       subcategory1      I would like to print whole content of blog together with articles not as widget but on main page as normal text like:               category1       subcategory1         news1         news2       subcategory2         news1     category2       subcategory1            news1         news2      What is the way to do this?


title: Need help with add_rewrite_rule

text: **SOLUTION** * * * **I've gone with Update 3 and have got it working. What I had misunderstood, was that I believed that a rewrite rule would change`designers/?designer=some- designer&bid=9` to `/designers/some-designer`. But it is of course the other way around.** * * * I've been doing some research, but I don't quite get how to use add_rewrite_rule(). This post is pretty close to what I need, but do I really need that much code? My current link is this:   http://www.norwegianfashion.no/designers/?designer=Batlak-og-Selvig&bid=9   What I want is this   http://www.norwegianfashion.no/designers/Batlak-og-Selvig/   1. How do I use `add_rewrite_rule()`?    2. I need to pass the designer ID (bid). How can I do that when using re.write rules with out it showing in the URL? **Update 1** I found this which is a bit more explainatory. But it's not working:               function add_rewrite_rules( $wp_rewrite )      {         $new_rules = array(             '('.$template_page_name.')/designers/(.*?)/?([0-9]{1,})/?$' => 'designers.php?designer='.             $wp_rewrite->preg_index(1).'&bid='.             $wp_rewrite->preg_index(2)         );            // Always add your rules to the top, to make sure your rules have priority         $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;     }     add_action('generate_rewrite_rules', 'add_rewrite_rules');          function query_vars($public_query_vars) {              $public_query_vars[] = "designer";         $public_query_vars[] = "bid";         return $public_query_vars;     }     add_filter('query_vars', 'query_vars')      **Update 2** Here is another solution I've tried, that Jan Fabry suggesten in another thread. I put this in my functions.php, but it has no effect.               add_action('generate_rewrite_rules', 'add_rewrite_rules');     add_filter('query_vars', 'query_vars');          /* Custom re-write rules for desigenrs     ------------------------------------------------------------------------------*/     function add_rewrite_rules( $wp_rewrite )      {         add_rewrite_rule('^designers/([^/]*)/([^/]*)$ /designers/?designer=$1&bid=$2 [L]', 'top');         flush_rewrite_rules(false);     }               function query_vars($public_query_vars) {              $public_query_vars[] = "designer";         $public_query_vars[] = "bid";         return $public_query_vars;     }      **Update 3**   I found a few examples here as well. But this is not working either :(               add_filter('rewrite_rules_array','wp_insertMyRewriteRules');     add_filter('query_vars','wp_insertMyRewriteQueryVars');     add_filter('init','flushRules');            // Remember to flush_rules() when adding rules     function flushRules(){         global $wp_rewrite;         $wp_rewrite->flush_rules();     }          // Adding a new rule     function wp_insertMyRewriteRules($rules)     {         $newrules = array();         $newrules['(designers)/(\d*)$'] = 'index.php?pagename=designers&designer=$matches[1]';         return $newrules + $rules;     }          // Adding the bid var so that WP recognizes it     function wp_insertMyRewriteQueryVars($vars)     {         array_push($vars, 'designer');         return $vars;     }      **Update 4** I also tried this solution, but still no sucess.               add_filter('search_rewrite_rules', 'designers_createRewriteRules');          function designers_createRewriteRules($rewrite) {     global $wp_rewrite;          // add rewrite tokens     $designer_token = '%designers%';     $wp_rewrite->add_rewrite_tag($designer_token, '(.+)', 'designers=');          $bid_token = '%bid%';     $wp_rewrite->add_rewrite_tag($bid_token, '(.+)', 'bid=');          $keywords_structure = $wp_rewrite->root . "designers/$designer_token/$bid_token";     $keywords_rewrite = $wp_rewrite->generate_rewrite_rules($keywords_structure);          return ( $rewrite + $keywords_rewrite );      } **Update 5**   It seems that my rewrite rules are not added. Executing the follwoing afte radding new rules: `print_r($wp_rewrite)`, does not include my new rewrite rules. **Update 6**   I tested Jan's solution. But URL does not change :(               /* Initiation script for NF template     ------------------------------------------------------------------------------*/        add_action('after_setup_theme','norwegianfashion_setup');          if ( ! function_exists( 'norwegianfashion_setup' ) ):            function norwegianfashion_setup() {          /* Here I do a lot of stuff */              // SEO friendly URL for desigenrs         add_action( 'init', 'wpa5413_init' );         add_filter( 'query_vars', 'wpa5413_query_vars' );       }          endif;               /* Custom re-write rules for desigenrs     ------------------------------------------------------------------------------*/     function wpa5413_init()     {         // Remember to flush the rules once manually after you added this code!         add_rewrite_rule(             'designers/([^/]+)/?',             'index.php?pagename=designers&designer=$matches[1]',             'top' );     }          function wpa5413_query_vars( $query_vars )     {         $query_vars[] = 'designer';         return $query_vars;     }      I would **really** appreciate it if someone were able to help me solve this issue.


title: Where to place PHP code that inserts (or doesn't insert) menu item?

text:
Where do I place the PHP code to insert or not insert a menu item based upon some condition, i.e. value of another PHP variable like so:               $listItem = '';          <?php if ($condition)     {         $listItem = '
Blog
';     }          ?>          /* html for menu list */          <?php echo $listItem; ?>          /* more html for menu list */


title: Customise Comment form

text:
I am trying to customise the comment form so I can clearly edit the labels and style them.               <?php comment_form( $args = array(                   'id_form'           => 'commentform',  // that's the wordpress default value! delete it or edit it ;)                   'id_submit'         => 'commentsubmit',                   'title_reply'       => __( 'Leave a Reply' ),  // that's the wordpress default value! delete it or edit it ;)                   'title_reply_to'    => __( 'Leave a Reply to %s' ),  // that's the wordpress default value! delete it or edit it ;)                   'cancel_reply_link' => __( 'Cancel Reply' ),  // that's the wordpress default value! delete it or edit it ;)                   'label_submit'      => __( 'Post Comment' ),  // that's the wordpress default value! delete it or edit it ;)                        'comment_field' =>  '
<textarea placeholder="Start typing..." id="comment" class="form-control" name="comment" cols="45" rows="8" aria-required="true"></textarea>
',                         'comment_notes_after' => '
' .                     __( 'You may use these HTML tags and attributes:' ) .                     '

' . allowed_tags() . '
'               ));          ?>      How can I change it so I can target the appropriate field such as `Name`, `Email` and `Website`? I can't find a good tutorial to do so. Any help or direction will be appreciated.


title: Linking a PDF as a downloadable document

text: How do I add a link to a PDF in the content, so that it downloads rather than opens in the browser windows? (I've uploaded the PDF to the media library and can insert the link but can't find an option to prevent it opening in the browser window). Thanks, Lucy


title: Is there a way to add Reattach and Unattach links in image gallery?

text: For some reason the Reattach and Unattach links in Media library is gone. Is there a way to add these from functions.php?


title: Question about how do wordpress filters/actions work

text: I have a question that I'm curious. In WordPress we can add a filter or action like this code:               add_filter($filter_Name, $function_will_be_hook);     add_action($action_Name, $function_will_be_hook);      We can pass some parameters into **function_will_be_hook()**. But how does WordPress know that these parameters are related to its filters/actions. Example:               function my_the_content_filter($content) {         $content .= "I added some additon content";         return $content;     }           add_filter( 'the_content', 'my_the_content_filter' );      **How does WordPress know`$content` is the content of Post/Page (even when we change name of this param to some other name)?**


title: nginx varnish w3 total cache issues

text: I converted a few sites from Apache to nginx and it was running well for a while. I recently updated the nginx configuration regarding the new changes to W3 Total Cache rules. I also tried to clean up my config. I am having really odd issues. One or two sites on this server will give me a 404 error and not load until. I verified the sites-available configuration file is exactly like the other sites. Most of the sites work fine, and as I was editing the WordPress sections of the conf, I noticed some sites would do this or 403 error but not all sites. I find this really confusing as if there is a problem with the config, it should be all sites. I went through the files for the sites that have the problems over and over and I can't see any typos or variance from the other sites. If I disable W3TC completely, everything works fine. One site I had a lot of problems with, the only way to fix it was to delete all traces of W3TC manually, and reinstall it. This is my configuration file, it is all one file here, but it is split up in multiple files on the server (drop.conf, wordpress.conf, php.conf), I just pasted them all into one file.               server {     listen       8080;     server_name  domain.com www.domain.com;     root         /srv/www/domain.com/public;     access_log   /srv/www/domain.com/log/access.log;     error_log    /srv/www/domain.com/log/error.log;          location = /robots.txt  { access_log off; log_not_found off; }     location = /favicon.ico { access_log off; log_not_found off; }       location ~ /\.          { access_log off; log_not_found off; deny all; }     location ~ ~$           { access_log off; log_not_found off; deny all; }              location / {              index index.html index.php;             try_files $uri $uri/ /index.php?$args;      }          location /search {             limit_req zone=wpsearch burst=3 nodelay;             try_files $uri /index.php;     }          location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {             expires max;             add_header Pragma public;             add_header Cache-Control "public, must-revalidate, proxy-revalidate";     }          # Prohibit php files from executing in wp-uploads     location ~* ^/wp-content/uploads/.*.php$ {             return 403;     }          location ~ /nginx.conf { deny all; }                      include /srv/www/domain.com/public/nginx.conf;              location ~ \.php {             fastcgi_intercept_errors off;             client_max_body_size 25M;             try_files      $uri =404;             limit_conn phplimit 5;             fastcgi_index  index.php;                  fastcgi_param   QUERY_STRING            $query_string;             fastcgi_param   REQUEST_METHOD          $request_method;             fastcgi_param   CONTENT_TYPE            $content_type;             fastcgi_param   CONTENT_LENGTH          $content_length;                  fastcgi_param   SCRIPT_FILENAME         $request_filename;             fastcgi_param   SCRIPT_NAME             $fastcgi_script_name;             fastcgi_param   REQUEST_URI             $request_uri;             fastcgi_param   DOCUMENT_URI            $document_uri;             fastcgi_param   DOCUMENT_ROOT           $document_root;             fastcgi_param   SERVER_PROTOCOL         $server_protocol;                  fastcgi_param   GATEWAY_INTERFACE       CGI/1.1;             fastcgi_param   SERVER_SOFTWARE         nginx/$nginx_version;                  fastcgi_param   REMOTE_ADDR             $remote_addr;             fastcgi_param   REMOTE_PORT             $remote_port;             fastcgi_param   SERVER_ADDR             $server_addr;             fastcgi_param   SERVER_PORT             $server_port;             fastcgi_param   SERVER_NAME             $server_name;                  fastcgi_param   HTTPS                   $https;                  # PHP only, required if PHP was built with --enable-force-cgi-redirect             fastcgi_param   REDIRECT_STATUS         200;                  fastcgi_pass   unix:/var/run/php5-fpm.sock;     }     }


title: Wordpress wp_update_attachment_metadata image width and height = 1?

text: Hello Friends I used to set post thumbnail programetically. this is my code.               foreach ($csv as $key => $value) {     $filename = "wp-content/uploads/images/".$value[8].".jpg";     $wp_filetype = wp_check_filetype(basename($filename), null );     $attachment = array(     'post_mime_type' => $wp_filetype['type'],     'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),     'post_content' => 'this is the first project file.',     'post_status' => 'Published'     );     $my_post = array(       'post_title'    => $value[0],       'post_content'  => $value[2],       'post_status'   => 'publish',       'post_author'   => 1,       'post_type'   => 'post_staff'     );     $post_id = wp_insert_post( $my_post );          $attach_id = wp_insert_attachment( $attachment, $filename,$post_id);     $attach_data = wp_generate_attachment_metadata( $attach_id, $filename );     wp_update_attachment_metadata( $attach_id, $attach_data );                     add_post_meta($post_id, '_thumbnail_id', $attach_id);     update_post_meta( $post_id, '_staff_name', $value[1] );         update_post_meta( $post_id, '_staff_city', $value[3] );         update_post_meta( $post_id, '_staff_postal_code', $value[4] );          update_post_meta( $post_id, '_staff_direct_line', $value[5] );          update_post_meta( $post_id, '_staff_fax', $value[6] );          update_post_meta( $post_id, '_staff_email', $value[7] );         $tagd = array( 9 );     wp_set_post_terms( $post_id, $tagd, 'department' );        if($value[3] == "St. John's, NL"){         $tagl = array( 8 );     }else if($value[3] == "Corner Brook"){         $tagl = array( 7 );     }     wp_set_post_terms( $post_id, $tagl, 'location' );        if(set_post_thumbnail( $post_id, $attach_id )){         echo "image set";     }      } This is working fine but the imported feature image with size 1x1 width = 1 and height = 1 why it takes width and height is 1 autometically please help. when i trying to get image using get_the_post_thumbnail the return image. image is found but bydefault the image width = 1 and height = 1 take. this is my code.               get_the_post_thumbnail( get_the_ID(), array(250,165));      Thank you.


title: Get author ID with attachment ID

text: I have a page, outside the loop, that display a media attachment with some basic info about it (title, uploaded date, etc). I have the attachment ID available to me via a form submitted before the page loads. What I need to do is secure the page by making sure that only users who have uploaded that file have access to the page with that file one it. In order to do that, I assumed the easiest way would be to compare the ID of the current, logged-in user with the ID of the user who created the attachment. But there doesn't seems to be a way that I can find to get the ID of the author of a post outside of the loop using only the attachment ID. I'm stumped, how should I do this?


title: Move specific javascript to the footer

text: I have noticed if I move all of my javascript to the footer, some plugins do not function properly, or at all. Is there some code I can add to my functions.php to move specific plugin javascript to the footer? Or is there a way to exclude certain js from going from the footer if I add it all? This is the code I used:               remove_action('wp_head', 'wp_print_scripts');     remove_action('wp_head', 'wp_print_head_scripts', 9);     remove_action('wp_head', 'wp_enqueue_scripts', 1);          function my_remove_thematic_scripts() {     remove_action('wp_head','thematic_head_scripts');     }          add_action('init', 'my_remove_thematic_scripts'); //wait for init          //Add the actions to the footer          add_action('wp_footer', 'wp_print_scripts', 5);     add_action('wp_footer', 'wp_enqueue_scripts', 5);     add_action('wp_footer','thematic_head_scripts');     add_action('wp_footer', 'wp_print_head_scripts', 5);      The plugins that don't work properly are simplemap, gravity forms (mainly not loading properly) and a background slider for my homepage.


title: Can you have multiple wordpress sites under the same domain?

text: Any issues with having multiple wordpress sites under the same domain. Example:   * domain.com/programs   * domain.com/sales   * domain.com/learning Each would have its own templates, functionality, menus and whatever. Any issues you can see? One of the issues I am worried about is if I have:   * domain.com/programs - which might be a hub site for programs and then I have another person who is the "golf" program admin... \- domain.com/programs/golf two totally different sites - may use multisite but not sure yet. So what if the domain.com/programs admin adds "golf" as a category? **NEW INFO:** To those who said, this is normal for WP and no issues please see Why did installing wordpress in url root jack up underlying WP sites?. I had 10 sites installed and after installing a "root" site all are having MAJOR permalink issues.


title: Is it better to use filter for the_content in archive pages?

text:
I'm using advancd-custom-fields plugin and I'm about to modifiy my acrhive content page that is shown frontend. I use the file **personnel-archive.php** (because the custom post type used is personnel) in my theme in that works ok: Beginning of this file looks like:               <?php get_header(); ?>              <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                  <div class="post" id="post-<?php the_ID(); ?>">
<?php the_title(); ?>

                       <?php echo image_personnel(get_the_ID());?>                      <?php the_content('
Läs resten »
'); ?>                          <?php wp_link_pages(array('before' => '
Sidor: ', 'after' => '
', 'next_or_number' => 'number')); ?>      I my functions.php I have made this function:               function image_personnel($post_ID) {         $post_type = get_post_type( $post_ID );         $content = '';              //If custom type for shown post is personnel, then show image first         if ($post_type == 'personnel') {                  $picture_personnel = get_post_custom_values('picture_personnel', $post_ID);             if ($picture_personnel) {                 $image_fields = get_field('picture_personnel');                                                 $url_image = $image_fields['url'];                 $alt_image = $image_fields['alt'];                 $title_image = $image_fields['title'];                 if (strlen($alt_image)>0) {                     $title_image = $alt_image;                 }                 else {                     $alt_image = $title_image;                 }                 $content = '';                }                                         }              return $content;     }                 I've basically just added a field "picture_personnel" to each personnel post and I want to show it in the content. Is it better to use filter for the_content? Or is it just a matter of taste?


title: attach one post from one post type to another post from another post type

text: I have 2 custom post types: agenda and doel. At each agenda post, I want to choose a doel post to attach it to, and the same with normal posts. So I want a connection between posts, agenda, en doel. I found this plugin called posts2posts from scribu, it does attach the posts types to each other, but I can not find out how and if it is possible to connect certain posts from one post type to certain posts from an other post type. The ideal solution would be to have a dropdown in one post type, that shows all the posts from an other one, and you can select one. In example, when editing a post from agenda, I can choose a post from doel to attach it to. And later on I want to loop that. Does someone know how this can be done easily, or recommend a good plugin? Sorry for my bad explanation, hope it is kind of clear.


title: is_active_sidebar() not working

text:
why the is_active_sidebar() function return always false? Function.php code:               if ( function_exists('register_sidebar') ) {        register_sidebar(array(          'name' => 'Footer Column 2',         'id' => 'footer-column-2', // I also added the ID but doesn't work          'before_widget' => '
',             'after_widget' => '
',          'before_title' => '
',            'after_title' => '
'        ));     }      footer.php code:               <?php if ( is_active_sidebar( 'footer-column-2' ) ) : ?>
                        <?php dynamic_sidebar( 'Footer Column 2' ); ?>
          <?php endif; ?>      I tried with the name or id but not working. Any idea? Thanks EDITED: I have more dynamic sidebars and I use this code to register these:               //register custom sidebars     add_action( 'widgets_init', 'register_theme_sidebars_dynamic' );          // and this function...I think the problem is here:          function register_theme_sidebars_dynamic(){         global $wpdb;         //post and pages sidebars         $widgetized_pages = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = 'omc_page_sidebar'", ''));              if($widgetized_pages){             foreach($widgetized_pages as $w_page){                 $widget_id = strtolower(str_replace(' ', '_', $w_page));                 register_sidebar(array(                     'name' => $w_page,                     'id'   => 'jw_widgetsection_'.$widget_id,                     'description'   => '',                     'before_widget' => '',                     'after_widget' => '     ',                     'before_title' => '',                     'after_title' => ''                 ));              }// For each         }//End If                  }


title: Site migration from Localhost to Server - 404 errors

text: I'm migrating another site from localhost to remote web server and am experiencing an issue. Here are the steps I took: 1.) Downloaded Wordpress locally, and began editing the twentytwelve theme. 2.) Created 8 custom template pages using something like this:               <?php     /*     Template Name: My Custom Page     */      3.) I went to Wordpress dashboard/admin and created 8 pages from the templates I made, then added those pages to the menu bar. 4.) I changed the DB credentials in the wp-config then FTP'd the entire site from localhost to remote host. 5.) I exported the database and successfully imported onto remote server. 6.) I downloaded the search & replace script and uploaded it to the live server, then ran it and replaced the URLs across the site. I can now navigate to the home page on the remote host: fairchildwebsolutions.com/evo/eco_designs/ However, 404 error displays when I go to any of the other pages I created. Did I do something wrong? Note that all of the pages display just fine on the localhost. Thanks


title: Customize wp-admin form custom fields

text: I would like to customize some form elements in my WP admin area: starting from this example (http://api.jquery.com/val/ the one with the select) what I would liko to do, is to update a via a select field. In order to do so I started including this function:               function my_enqueue() {              wp_enqueue_script( 'my_custom_script', get_template_directory_uri() . '/js/admin.js' );     }     add_action( 'admin_enqueue_scripts', 'my_enqueue' );      Inside "admin.js" I placed:               alert("It works!");      And it does work. But whenever I try to include anything related to jQuery nothing happens: the code is being included inside the page and I get no errors in Firebug. For example a script as simple as the one you can find at http://www.w3schools.com/jquery/event_keyup.asp               $("input").keyup(function(){         $("input").css("background-color","pink");     });       Doesn't work. Nothing happens. So I wonder, what am i missing or doing wrong? Thansk a lot!


title: Prevent stripping MathML tags on post save

text: I am trying to add MathML markups in wordpress custom post. But, it is stripping all MathML tags when I hit the publish button :( I have disabled "wpautop" and "Visual Editor". These are not helping at all. Can you please suggest what I can do?


title: Settings API with arrays example

text: I'm using the Wrox WordPress plugin development book as a primary reference for getting started with a new plugin and I understand all settings can be saved as 1 array but the book does't give an example of this and all the stuff I'm finding on the web seems so different from one example to another. The second half of a post by Konstantin gets me close but I'd really like to see a more complete example with multiple fields.


title: Two settings field in one form

text: is it possible to have two settings fields in one form?               <?php         echo '<form method="post" action="options.php">';         settings_fields( 'my-plugin-settings-group-1' );         settings_fields( 'my-plugin-settings-group-2' );     ?>      I tried it but it doesn't work, only one settings_fields is saved. any ideas or other solutions?


title: how to use register_setting array

text: register_setting( 'tema-settings-group', 'option' ); I send more than 1 value but when ı display get_option('option') ı can only see value that ı sent last. So I think ı need make array to display all values ı send.But if there is another way to display all valuo by using register_setting() pls tell me. I search but ı couldnt find. why dont you give me link