title: Get post id of permalink for a specific custom post type?

text:
I have custom post type called `Personnel`. I have this code to show a specific post ("details" page for personnel) (resides in children themes folder of Oxygen and is called single- personnel.php)               <?php     /**      * Singular Template      *      * This is the default singular template.  It is used when a more specific template can't be found to display      * singular views of posts (any post type).      *      * @package Oxygen      * @subpackage Template      */     get_header(); // Loads the header.php template.           //This posts id     global $post;      $person_id = $post->ID;      $person_name = $post->post_title;     $f_name = explode(' ', $person_name);     $first_name = $f_name[0];          $person = new Personnel();     $related_courses = $person->getRelatedCourses($person_id);                                                                        ?>
                  <?php get_template_part( 'menu', 'secondary' ); // Loads the menu-secondary.php template.  ?>                  <?php get_sidebar( 'primary' ); // Loads the sidebar-primary.php template. ?>
              <?php do_atomic( 'before_content' ); // oxygen_before_content ?>

                      <?php do_atomic( 'open_content' ); // oxygen_open_content ?>
                          <?php if ( have_posts() ) : ?>                              <?php while ( have_posts() ) : the_post(); ?>                                  <?php do_atomic( 'before_entry' ); // oxygen_before_entry ?>                                 <?php                                     $image = get_field('image_personnel');                                     $size = 'thumb-large-personnel';                                     $use_large_image = wp_get_attachment_image( $image, $size );                                           if (strlen($use_large_image)>0) {                                 ?>
                                          <?php                                     echo $use_large_image;                                     ?>
                                 <?php                                 }                                 ?>                             <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">                                      <?php do_atomic( 'open_entry' ); // oxygen_open_entry ?>                                      <?php echo apply_atomic_shortcode( 'entry_title', '[entry-title permalink="0"]' ); ?>                                      <?php echo apply_atomic_shortcode( 'byline', '
' . __( 'By [entry-author] on [entry-published] [entry-edit-link before=" | "]', 'oxygen' ) . '
' ); ?>

                                                                          <?php the_content( __( 'Continue reading →', 'oxygen' ) ); ?>                                                                              <?php                                                                         if (!empty($related_courses)) {                                                                         ?>

<?php echo $first_name;?> undervisar i:
                                                                         <?php                                                                                foreach($related_courses as $course) {                                                                             echo '
' . $course . '
';                                                                         }                                                                         ?>
                                                                         <?php                                                                         }                                                                         ?>                                                                          <a class="trans-effect moreinfo more" href="<?php echo PupilRegistration::getSlug();?>">Anmäl dig / mer info

                                      <?php do_atomic( 'close_entry' ); // oxygen_close_entry ?>
                                  <?php do_atomic( 'after_entry' ); // oxygen_after_entry ?>                                  <?php get_sidebar( 'after-singular' ); // Loads the sidebar-after-singular.php template. ?>                                  <?php do_atomic( 'after_singular' ); // oxygen_after_singular ?>                                   <?php endwhile; ?>                          <?php endif; ?>
                      <?php do_atomic( 'close_content' ); // oxygen_close_content ?>                      <?php get_template_part( 'loop-nav' ); // Loads the loop-nav.php template. ?>
                              <?php     $args = array( 'post_type' => 'personnel', 'posts_per_page' => -1 );     $personnel_query = new WP_Query( $args );     ?>
     <?php     while ($personnel_query->have_posts()) : $personnel_query->the_post();      $image = get_field('image_personnel');     $size = 'thumb-listing-personnel';     $use_image = wp_get_attachment_image( $image, $size );     //No image returned, use default     if (strlen($use_image) === 0) {         $use_image = $person->getDefaultImageHtml();     }     ?>
     <a href="<?php echo get_permalink();?>" id="personel-<?php echo get_the_ID();?>">         <?php echo $use_image; ?>             <?php echo get_the_title();?>
          <?php      endwhile;     ?>

     <?php     wp_reset_postdata(); //Restore to current post AFTER the loop because the_post() is used     ?>
                  <?php do_atomic( 'after_content' ); // oxygen_after_content ?>          <?php get_footer(); // Loads the footer.php template. ?>      It seems to work fine, but when using any cache plugin like W3 Total Cache or WP Super Cache **it show incorrect post OR give me a file not found error.** BUT not always and there's the confusion. When it happens I could go the admin dashboard, update permalinks and then delete the store cached and then it works again) My **GUESS** is that these first rows are the issue. They don't seem to return the correct post -id everytime. (Sometimes it work, sometime it don't)               global $post;      $person_id = $post->ID;      $person_name = $post->post_title;      It might be something else also, please give me any pointers if you have any to share :-) **UPDATE:** (on request) Here's the code in the functions.php of the child-theme I'm using for registering the custom post type personnel               function personnel_with_cats() {             //Register custom post type for personnel         $personnel_labels = array(           'name' => 'Personal',           'singular_name' => 'Personal',           'add_new' => 'Lägg till',           'add_new_item' => 'Lägg till ny personal',           'edit_item' => 'Redigera personal',           'new_item' => 'Ny personal',           'all_items' => 'All personal',           'view_item' => 'Visa personal',           'search_items' => 'Sök personal',           'not_found' => 'Inga person bland personalen funnen',           'not_found_in_trash' => 'Ingen personal hittad i sopkorgen',           'parent_item_colon'  => '',           'menu_name' => 'Personal'         );         $personnel_args = array(           'labels' => $personnel_labels,           'public' => true,           'publicly_queryable' => true,           'show_ui' => true,           'show_in_menu' => true,           'query_var' => true,           'rewrite' => array( 'slug' => 'personal' ),           'capability_type' => 'post',           'has_archive' => true,           'hierarchical' => false,           'menu_position' => null,           'supports' => array('title','editor','author','comments'),               );         register_post_type( 'personnel', $personnel_args );                   //Register custom taxonomy for personnel-categories         $personnel_cat_labels = array(           'name' => 'Personalkategori',           'singular_name' => 'Personalkategori',           'search_items' => 'Sök kategori',           'all_items' => 'Alla kategori',           'parent_item' => 'Föräldrakategori',           'parent_item_colon' => 'Föräldrakategori:',           'edit_item' => 'Redigera kategori',           'update_item' => 'Uppdatera kategori',           'add_new_item' => 'Lägg till ny kategori',           'new_item_name' => 'Namn på ny kategori',           'menu_name' => 'Personalkategori'              );         $personnel_cat_args = array(           'hierarchical' => true,           'labels' => $personnel_cat_labels,           'show_ui' => true,           'show_admin_column' => true,           'query_var' => true,           'rewrite' => array('slug' => 'personal/kategori')         );              register_taxonomy( 'categorypersonnel', array('personnel'), $personnel_cat_args );         }          //Hooks for personnel     add_action( 'init', 'personnel_with_cats' );


title: Enqueue script throws error in console

text: WP version 3.9 I am editing the customizer. I have an upload field for uploading a logo. ![enter image description here](http://i.stack.imgur.com/28AKt.png) When I try to upload I receive an error. TypeError: wp.media.model.settings.post is undefined![enter image description here](http://i.stack.imgur.com/YTDdQ.png) I tracked the problem and it is coming from this ADMIN JS which I am including. THE ERROR WILL APPEAR EVEN IF THE JS IS EMPTY               function woop_admin_background_scripts() {             wp_enqueue_script(             'woop-custom-background-ext-js',             get_template_directory_uri() . '/functions/custom-backgrounds.js',             array( 'wp-color-picker', 'media-views' ),             'v1.0',             true         );              }         add_action( 'admin_enqueue_scripts', 'woop_admin_background_scripts' );      What I tried is to remove the $deps. If it is empty it works correctly.                       array( 'wp-color-picker', 'media-views' ), >>>> '',      I cannot understand what is the problem. Why it gives me JS errors because a JS is enqueued. What it will be the solution, how to solve that issue ? Thank you


title: Generate activation url

text: For my registration I am using custom registration form.It works fine.It sends email with username and password. What I am looking I want to generate url so that when user click it automatically complete activation .I do not want them to write username or password manually.My code for sending email                               $random_password = wp_generate_password( 12, false );                 $status = wp_create_user( $username, $random_password, $email );                 if ( is_wp_error($status) )                      echo "Username already exists. Please try another one.";                 else {                     $from = get_option('admin_email');                     $headers = 'From: '.$from . "\r\n";                     $subject = "Registration successful";                     $msg = "Registration successful.\nYour login details\nUsername: $username\nPassword: $random_password";                     wp_mail( $email, $subject, $msg, $headers );                          echo "Please check your email for login details.";                 }


title: Wordpress - registering sidebar and adding a button directly after .textwidget

text:
I have registered a new widget area, code as below and want to add a button after the `.textwidget`, however cannot seem to do it properly. Adding it after the `</li>` results in the button not being contained within a container and thus messes up the page - which is to be expected. It's not possible to add a container to the `<li class="parallax">` boxes using conventional methods - the only way i can think of is via jQuery which really isn't ideal. I want to know if there's anything i can add to the register sidebar function, or something else, in order to get a `<button>` directly after the `.textwidget`. At the moment i have the button inside the `.textwidget` by adding the code in to the widget areas in the back-end, but it's not quite as i want it. Of course i could absolutely position the buttons and what-not, but there would be an issue with extending the button outside of it's parent container (it has some padding too). The functions.php               if (function_exists('register_sidebar')) {          register_sidebar(array(             'name'=> 'Parallax Area',             'id' => 'parallax',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));     }      The HTML

                          <?php                          if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Parallax Area')) : ?>                     <?php endif; ?>

      The current HTML output

Computer Repair

Here will be some text that explains the contents of this box and allows them to click through to a page.                          <button class="btn-action">Learn More...</button>

Computer Repair

Here will be some text that explains the contents of this box and allows them to click through to a page.                          <button class="btn-action">Learn More...</button>

Computer Repair

Here will be some text that explains the contents of this box and allows them to click through to a page.                          <button class="btn-action">Learn More...</button>

Computer Repair

Here will be some text that explains the contents of this box and allows them to click through to a page.                          <button class="btn-action">Learn More...</button>


title: Responsive scaling of image for the_post_thumbnail()

text:
In my functions.php file, I have:               add_theme_support( 'post-thumbnails' );     add_image_size( 'kev-feature', 650, 342, true );      In a template file, I have:
<?php the_post_thumbnail('kev-feature'); ?>
      I have a responsive design, and I want the image that should max out at 650x342 to scale down as the browser shrinks. It currently isn't doing it. I have noticed that the img html tag that is outputted has the height and width hardcoded into it, so I'm assuming that's why it's not scaling. What am I doing wrong here?


title: How to display WooCommerce price in two currencies?

text: Is there a way to display prices in two currencies? Need to display prices in LVL and EUR but checkout in LVL.   Also, how to add new currency to WooCommerce?


title: Add a Menu Link (to a Wordpress Page) in the Admin Menu/Sidebar

text: I am trying to add a link, in the Admin Sidebar, that links to one of the pages I've created in the PAGES section. For example, I've created an ABOUT page. So in the sidebar I would like a link to "About" that loads this link: `post.php?post=7&action=edit` Why? I am trying to do this because I am working on a website that has 4 custom posts types and 3 pages. The custom post types have admin menu links, so I think it would be a better user experience if the 3 pages also had direct links in the sidebar, instead of needing to click PAGES and then seeing the list of 3 pages and having to click "EDIT" (and then I would hide the PAGES section link from the admin menu). I was headed down this road, but it doesn't seem to be what I want/need (I can't get it to link to where I want): http://codex.wordpress.org/Administration_Menus#Inserting_the_Pages


title: Custom URL scheme - paramters on custom post type

text: I have a custom post type set up as Event. Within this post type I have various bit's of content / custom meta which will be used on two or three different pages. I was wondering lets say I had my custom post type url as `http://www.mysite.com/my-custom-post-title/` and on that page I had 3 links that when clicked would load the relevant content i.e. `http://www.mysite.com/my-custom-post-title/faqs/` `http://www.mysite.com/my-custom-post-title/directions/` I could achieve what I want with query string parameters on the initial URL but was wondering if I could use pretty URL's rather than have `http://www.mysite.com/my-custom-post-title/?subconten=faqs` I know you can do your own rewrites I am just not sure how best to approach it. Update: So assuming I have the following URL: `http://www.mysite.com/events/my-custom-post-title/info/directions/` I have added the following action `add_action('init','custom_rewrites'); function custom_rewrites() { global $wp,$wp_rewrite,$wp_query; $wp->add_query_var('content_filter'); $wp_rewrite->add_rule('events/([^/]+)/info/([^/]+)/', 'index.php?post_type=portfolio&name=$matches[1]&content_filter=$matches[2]', 'top'); $wp_rewrite->flush_rules(false);   // print_r( $wp_rewrite ); }` Still nothing - I have found that if I dump query vars to the screen on the 404 page "direction" returns as attachment. Anyone have an idea how I can get this working? Steve


title: Populate wordpress menu with link to custom field value (file download)

text: I have an additional menu that appears on some single.php pages. To this menu I would like to add an li with a link to a PDF which is uploaded to the post by a custom field (advanced custom fields helps with this). I found a snippet on how to add todays date to my menu, and thought I could maybe use this as a starting point. However I´m not good enough coder to know where to go from here. I would appreciate some help with it! This is the snippet I´m starting with: http://pastebin.com/xHHxuHdQ I need to make it display this instead:               <a href="<?php the_field('mcf_uppsagning-pdf'); ?>">Uppsägning      I cant just replace it though and I dont know the syntax enough to know how to modify it. Please help :) Thanks


title: Replace image urls(absolute instead of relative) by using filter in single page

text: I'm using a plugin called Foliopress WYSIWYG. While using this plugin, images found in the_content loop using relative image path instead of absolute paths. So all the feed images looks broken. This plugin stores images in `http://mysite.com/images` folder instead `wp- content/uploads` folder. So i would like to use filter to replace relative path. I mean if any img src file looks like `/images/2010/03/example.jpg` then it should be filtered and replaced with `http://mysite.com/images/2010/03/example.jpg` Can anyone give me the snippet? Thanks


title: Plugin for a text modal box

text: I have a contact form with "Accept Privacy Policy" check box. I need to add a link, that will create a modal box displaying the privacy policy. Just like fancy box but for text. I was looking for a plugin that would help me. I looked at OrangeBox and Modal Dialog but it seems they don't do what I'm looking for. Is there a WP plugin or some jQuery that could help me create a custom text modal box?


title: Need help with adding templates (archives and sitemap) to Wordpress child theme

text: I recently switched themes, and my old theme had templates for sitemap and archive (in fact the archive was one of my most viewed pages.) When I switched themes the link to the archive and sitemap page still works, but they are blank pages. I really need to get this fixed, and I have no idea how. I'm assuming I need to recreate a new template in the parent theme for the sitemap and archive page (I'm using a child theme). I've never created one before, and with my old theme it was very simple since I could just use the template. Could someone help me get this up and going on my new theme? Thanks.


title: The 'https_local_ssl_verify' filter

text: I have run into some WordPress code which does POST requests to API sites and in the POST parameters for the SSL property it has               $params = array( 'body' => $_POST, 'sslverify' => apply_filters('https_local_ssl_verify', false));      So why not simply put false or true?


title: Connect external web app to wordpress

text: We have a web app that will allow users to edit their videos; and add intros, outros, and watermarks. Once the user already done on their video. We need to provide an option to post or syndicate their video as a draft on their WordPress site. Our plan is to create a WordPress plugin that the user needs to install on their WordPress site. But our problem are the following:   1. How can we authenticate our web app to the user's WordPress page?   2. Looking int HTTP API most of the options are only for retrieving contents. Is there also a way to create pages?


title: Unexpected token ILLEGAL, even on clean install - jquery-issue?

text: update i get even more issues and errors;               POST http://literaturen.org/wp-admin/admin-ajax.php          200 OK             1,39s        jquery...=1.11.0 (Zeile 4)     GET http://fls-eu.amazon.de/1/batch/1/OE/A1PA6795UKM...26pc0%3D831%26ld0%3D831%26t0%3D1399322099520:831          204 No Content             197ms        csm-ba..._V1_.js (Zeile 232)     Content Security Policy: Ungültige Quelle chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl kann nicht verarbeitet werden     Content Security Policy: Unbekannte Quelle chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl konnte nicht verarbeitet werden          Given URL is not permitted by the application configuration.: One or more of the given URLs is not allowed by the      App's settings.  It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.          ping?c...dk=joey (Zeile 1)      and the following errors:               SyntaxError: illegal character          !function(a,b){\"object\"==typeof module&&\"object\"==typeof module.exports              load-s...ver=3.9 (Zeile 2, Spalte 15)     SyntaxError: illegal character          ...c,d){var f;return f=c&&c.hasOwnProperty(\"constructor\")?c.constructor:function(...          load-s...ver=3.9 (Zeile 1, Spalte 60)     ReferenceError: jQuery is not defined          })( jQuery );          customize.php (Zeile 560)     ReferenceError: jQuery is not defined          jQuery(document).ready(function()      **note:** i do not know why i do get all those nasty errrors. I've been working on a new project with wordpress. However, I start noticing that some features on the back office (like slide down menus and widgets) weren't working. So I fired up debugging console of my browser and found that there is an intermittent issue: > Uncaught SyntaxError: Unexpected token ILLEGAL load-scripts.php:1 load- > scripts.php?c=1&load%5B%5D=jquery,utils,json2&ver=xyz other times... to be frank: I had issues > Uncaught-syntaxerror-unexpected-token-illegal > > was not able to do configurations of the widgets in wp 3.9 was not able to > access the set-options page was not able to switch the accessible mode btw .- see the page \- a non profit page: it is BETA-BETA **btw** \- the `magic_quotes_gpc`, `magic_quotes_runtime`, are not set off do you think that this may help. WHAT I WAS INVESTIGATIN SO FAR: > Uncaught SyntaxError: Unexpected token ILLEGAL load-scripts.php:1 > > Uncaught ReferenceError: jQuery is not defined load-scripts.php:2 > > (anonymous function) Similar issues found in different browsers: Chrome, Safari and Firefox. Next step was googling for some answers and found a reference for javascript diagnose here. When I enable `SCRIPT_DEBUG`, the error stops, and everything runs smoothly again. At this moment I don't have some plugin nor theme installed and been running in localhost. Couldn't find yet a solution. Any ideas?


title: Why is my no-results.php template moving my sidebar and footer into the main container?

text:
I'm really stumped on this one but I'm hoping it's just another case of "It's late and you're missing something simple." My `index.php` contains an `if` statement: If there are posts, run the loop and display them, else display the `no-results.php` template. For some reason, though, my `no-results.php` is breaking my layout by placing both the sidebar and footer inside of my `<main>` element where the content resides. # PHP Here is my `index.php` code:               <?php get_header(); ?>                         <?php if ( have_posts() ) : ?>              <?php /* Start the Loop */ ?>         <?php while ( have_posts() ) : the_post(); ?>             <?php                 /* Include the Post-Format-specific template for the content.                  * If you want to override this in a child theme, then include a file                  * called content-___.php (where ___ is the Post Format name) and that will be used instead.                  */                      get_template_part( 'content', get_post_format() );             ?>         <?php endwhile; ?>          <?php /* Post Navigation */ ?>     <?php mytheme_content_nav( 'nav-below' ); ?>          <?php else : ?>         <?php get_template_part( 'no-results', 'index' ); ?>     <?php endif; ?>                    <?php get_sidebar(); ?>     <?php get_footer(); ?>      And here's my `no-results.php` code:               <?php /* This template shows a message when no search results are found */ ?>

<?php _e( 'No Results Found', 'clarity' ); ?>

<?php _e( 'Please try a new search below.', 'mytheme' ); ?>

             <?php get_search_form(); ?>

      # Generated Markup For most of my templates, the generated markup looks like this:

      When I search the blog and turn up no results (`no-results.php`), the generated markup looks like this instead:


title: What's the impact on WordPress' performance regarding the amount of classes/files in a plugin?

text: I'm refactoring a WordPress plugin and I have two main classes with an average of 500 lines between the two. There are other files in the plugin, but these are the ones where I keep most of the functionality. I am refactoring in order to make a more elegant code out of this monster, and separating functionality into other objects to keep my code more cohesive and friendlier for potential contributors. My intention is to instantiate only one object every time the plugin is used, and get the rest of the functionality out of different classes with static methods (so I won't be needing their state). Does having many classes in different files have a relevant impact on the system's performance? Considering the situation, is it worth having static functions from auxiliary classes in different files or should I keep everything in fewer files to avoid impacting the system's performance?


title: How to show multiple attachements together with Scribu's Posts 2 Posts connector?

text: I am using Scribu's Posts 2 Posts plugin to connect _posts_ with small galleries attached to an _album_ post type. Everything works great, except that I cannot figure out how to merge the attachments to display together. Right now I am using the code below to display each gallery one below another.               $images = get_children( array(          'post_parent' => $post->ID,         'post_type' => 'attachment',         'post_mime_type' => 'image',          'orderby' => 'menu_order',         'order' => 'ASC',         'numberposts' => 999 ) );          if ( $images ) {         $total_images = count( $images );         $image = array_shift( $images );         $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail', $default_attr );     }          if ($images)         echo do_shortcode('[gallery size="small" columns="5"]');      Is it possible to grab all of the post attachments connect to an _album_ and combine before this script is run?


title: How to add metabox for post of specific category

text: I want to add Metabox for the posts of category=18 and i am using the following code but unable to do so . So please help me out->                add_action('admin_init','my_meta_init');          function my_meta_init()     {         $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;              // checks for post/page ID         if ($post_id->post_category[0] == 18)         {             add_meta_box('team_meta', 'My Custom Meta Box 1', 'team_meta_1', 'post', 'normal', 'high');                   function team_meta_1(){         global $post;         // Noncename needed to verify where the data originated         echo '<input type="hidden" name="eventmeta_noncename" id="eventmeta_noncename" value="' .          wp_create_nonce( plugin_basename(__FILE__) ) . '" />';              // Get the location data if its already been entered         $designation = get_post_meta($post->ID, '_designation', true);              // Echo out the field         // echo '<input type="text" name="_description" value="' . $description  . '" />';         echo '<textarea name=_designation rows="6" cols="100">'.$designation.'</textarea>';              }              function my_meta_save($post_id, $post) {              // verify this came from the our screen and with proper authorization,         // because save_post can be triggered at other times         if ( !wp_verify_nonce( $_POST['eventmeta_noncename'], plugin_basename(__FILE__) )) {         return $post->ID;         }              // Is the user allowed to edit the post or page?         if ( !current_user_can( 'edit_post', $post->ID ))             return $post->ID;              // OK, we're authenticated: we need to find and save the data         // We'll put it into an array to make it easier to loop though.              $events_meta['_designation'] = $_POST['_designation'];                   // Add values of $events_meta as custom fields              foreach ($events_meta as $key => $value) { // Cycle through the $events_meta array!             if( $post->post_type == 'revision' ) return; // Don't store custom data twice             $value = implode(',', (array)$value); // If $value is an array, make it a CSV (unlikely)             if(get_post_meta($post->ID, $key, FALSE)) { // If the custom field already has a value                 update_post_meta($post->ID, $key, $value);             } else { // If the custom field doesn't have a value                 add_post_meta($post->ID, $key, $value);             }             if(!$value) delete_post_meta($post->ID, $key); // Delete if blank         }          }           add_action('save_post','my_meta_save');     }               }


title: Conditionally include files in functions.php?

text: I have a bunch of functionality being added to a Wordpress site including files in functions.php but I'm worried about performance. All of these files are included for every page request and not all pages require all the extra functionality. Drupal's menu system allows you to only include files for certain URLs and this is supposed to reduce overhead. Is there a similar approach for Wordpress or I shouldn't fret over this? Thanks! Update to clarify: I meant including PHP files with extra functionality in new classes or functions. I'm not talking about CSS, Javascript or templates, which of course, have their own ways of being included.


title: Showing anchor links in sidebar for headings only on a certain page

text:
I want to be able to add anchor links to header ids in one of my WordPress pages, and then show links to those ids in the sidebar. The sidebar is built like this in content-page.php:               <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:',     'fruit' ), 'after' => '
' ) ); ?>      So, all the pages might look like this in the sidebar, Fruit being the parent and its children being each type: Fruit   -Apples   \- Oranges   \- Pears   However, the "Apples" page is long and has three distinct sections, marked off with header ids:
Stem
      etc. How can I get WordPress to show the header IDs in the sidebar as links to these discrete sections dynamically on the Apples page? So it would look like:   Fruit   -Apples   -Stem   \- Seeds   \- Skin   -Oranges   -Pears


title: How do you manage large menu hierarchies in WP?

text: Has anyone worked on sites where the menu hierarchies is fairly large?   Not more than 3 levels deep, but more than 40+ menu items? If you only list first level items in the top menu without dropdowns and you want to show children in the left section of your site, how do you do that? As far as I know, there is still no function like `getChildren()` of current selected menu item. My only solution so far is to use `get_page_children()` \- but those children are from current page, not the menu hierarchy.


title: Multisite database upgrade SSL error

text: I have upgraded my Multisite setup WordPress to 3.6.1. And after that, when I do `Network Upgrade > Database Upgrade` it's showing: > Warning! Problem updating `http://www.example.com/site1`. Your server may > not be able to connect to sites running on it. > > Error message: Peer certificate cannot be authenticated with known CA > certificates What happened please?   I'm currently using SSL for that site.


title: Should 'setup_postdata()' be reset with 'wp_reset_postdata()'?

text: Starting with an example makes more sense, so here's an example function:               function seo_meta_tags() {         global $post;              if( is_singular() ) {                  setup_postdata( $post );                  $description = str_replace( '... Cont. reading →', '...', get_the_excerpt() );                  wp_reset_postdata();                  echo '<meta itemprop="description" name="description" content="' . $description . '">';              }     }      _**NOTE:** The code is only to give you an idea of what I am trying to accomplish and not exactly how I am doing it._ Now coming to the point, should `setup_postdata( $post )` be closed with `wp_reset_postdata()` as shown in the example?


title: Custom Taxonomy Template Error: Catchable fatal error: Object of class WP_Error could not be converted to string

text:
Been trying to chase this error down: "Catchable fatal error: Object of class WP_Error could not be converted to string" Here's the page: I have a custom post type and taxonomy: taxonomy: team_categories   * term: "Committees" (among others)     * child terms under committees: Continuing Education, Ethics, Legislative Action, etc (* this part seems to be working)       * team members in each committee (not working) I want to list the child terms on the "committees" taxonomy template page and display the members of each committee. for instance: Continuing Education committee   * jane doe   * john brown   * etc. Ethics committee   * jack jones   * ann acme   * etc. Here is the current code:                   $taxonomyName = "team_categories";         //This gets top layer terms only.  This is done by setting parent to 0.           $parent_terms = get_terms($taxonomyName, array('parent' => 0, 'orderby' => 'slug',   'hide_empty' => false));            echo '
';         foreach ($parent_terms as $pterm) {         //Get the Child terms         $terms = get_terms($taxonomyName, array('parent' => $pterm->term_id, 'orderby' =>   'slug', 'hide_empty' => false));         foreach ($terms as $term) {         echo '
name, $taxonomyName ) . '">' . $term->name . '
';            }        }        echo '
';      The error appears to be on this line:                 echo '
name, $taxonomyName ) . '">' . $term->name . '
';       Hope someone might be able to shed some light on this. **Update:** The following code gets me darn close to what i'm looking for:                               $term_id = 26; // id of committees                     $taxonomy_name = 'team_categories';                     $termchildren = get_term_children( $term_id, $taxonomy_name );                          echo '
';                     foreach ( $termchildren as $child ) {                         $term = get_term_by( 'id', $child, $taxonomy_name );                         echo '
' . $term->name . '
';                     }                     echo '
';      It lists all of the sub categories in the "committees" category Now I'm wondering how to display each categories posts under each category heading. The custom post type's name is "team".


title: Have two (permalinks) urls for a same custom post type

text: I have an specific situation which I´ll try to explain. In the website I developing right now we have fairs (event) and every fair has a profile page. Lets call ns_fair custom post type and its loaded with permalink `http://localhost/website/fairs/fair/{name)`. Hi have a page with the permalink `http://localhost/website/past-fairs/` where I list the archive fairs with a custom WP_Query Loop. When I click a fair, loads in `http://localhost/website/fairs/fair/{name)`. and I need to load in `http://localhost/website/past-fairs/fairs/fair/{name)`. It´s the same custom post, just loaded with another permalink, for website structure purposes only. That´s possible? Any suggestion? Thanks in advance.


title: WordPress php error after editing file with FileZilla

text: I use the free FTP software FileZilla. In most cases, whenever I open any PHP file from FTP using FileZilla, I get this error after editing then saving the file: `Parse error: syntax error, unexpected T_VARIABLE in` `File path here` `on line 1` How do I solve this error and get rid of this problem forever? Should I switch to another FTP program?


title: Change of permalink structure - redirects in htaccess breaks the archive links

text: When I started with my blog, the permalinks and following structure:               http://<domain>/%year%/%monthnum%/%day%/%postname%/      Some time ago, I changed the permalink structure to "`http://<domain>/%postname%/`" only. In order to tackle the external links to the old permalink structure, I added the following line in my htaccess-file:               RedirectMatch 301 /([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ http://<domain>/$4      Now the problem is that the redirect line breaks the archive links, eg. "`http://<domain>/2010/09/02`" is redirected to the front page instead of showing the posts from Sept 2, 2010. Is it possible to correct the redirect directive in htaccess, or am I not going to be able to eat the cake and have it too?


title: what custom post type this archive belongs to?

text: I'm in the process of making few changes to the header of my secondary pages, but I need to identify whether my page is an archive page, and if it is a CPT archive page or not. Is there something quick I can use= Thanks


title: admin-ajax.php vs Custom Page Template for Ajax Requests

text: Is there any reason to use admin-ajax.php for ajax requests versus a custom page template? I didn't know about admin-ajax.php until recently, so what I had been doing is creating a custom page template like this:               <?php     /**      * Template Name: API      */          if ( isset( $_GET['ajax_request'] ) ) {     // do stuff     }      And the ajax call would be to the URL http://mysite.com/api/, which is where I've published a blank page using my API page template. This seems to give me access to all my WordPress functions and spit out data. However, recently I've read up on admin-ajax.php and understand another way to connect to the WordPress database is to call the URL http://mysite.com/wp- admin/admin-ajax.php and have functions like this:               add_action( 'wp_ajax_nopriv_action', 'my_do_stuff' );     add_action( 'wp_ajax_show_action', 'my_do_stuff' );          function my_do_stuff() {     // do stuff     }      Is it wrong to connect the first way? Does admin-ajax.php provide extra security or something? Thanks any input!


title: Category Template: Need to display different content on first page of archives

text: So my issue is that I need to create two versions of a category.php template. Now, I know very well that if I want to display posts from just one category, I duplicate category.php and call it category-xx.php for the slug or ID number. Great. Got that. The problem is the client wants it where on the first page of posts, only 4 posts appear. 6 on all subsequent pages. Worse, she wants a div with additional content to appear above the posts but only on the first page. So http://www.yoursite.com/category/whatever/page/2/ and /page/3/ look different than http://www.yoursite.com/category/whatever/. Now I know I could use conditional comments like is_page() to specify a certain page to display let's say, a certain div. But how would I do it in this sense? Can I do it? There must be some kind of if...else statement that'll make this work.


title: How do i know the current post type when on post.php in admin?

text: Im trying to do something with an admin_init hook if - and only if - the user is editing a post (post.php) with post type "event". My problem is that, even though wordpress points to a global variable calls $post_type. if i do:               global $post_type;     var_dump($post_type);      It returns NULL. but if I do this:               global $pagenow;     var_dump($pagenow);      it returns my current page. i.e. "post.php". I looked into this function `$screen = get_current_screen();` but thats not declared until after the admin_init hooks has run, and then its to late. So my question is, how do I, by the time admin_init is run, find out what post type the current post being edited is. if the url is `post.php?post=81&action=edit` then, how do I know what post type postid=81 is? Thanks Malthe


title: WordPress Front End Profile Upload the User Image

text:
I'm building a website that allows users to register to different groups based on their field of expertise. I have managed to get a profile page on the front but I can't get the user image to be updated from here. The main reason I believe is because the upload button is trying to find the media uploader on the backend. Here is a code example:
Profile Image

             <img class="user-preview-image small-image-bg" src="<?php echo esc_attr( the_author_meta( 'image', $current_user->ID ) ); ?>">

             <input class="form-control image-upload" type="text" name="image" id="image" value="<?php echo esc_attr( get_the_author_meta( 'image', $current_user->ID ) ); ?>" class="regular-text" />             <input type="button" class="btn-primary" value="Upload Image" id="uploadimage"/>


title: Image resize depending on orientation?

text: is there an option or a plugin that resizes an image depending on it's orientation? Reason for this question: Im building an image grid and it would look even better when all images would have the same width.


title: Are there risks associated with using wp_options table using wpdb to update theme options

text: I am making a theme and it has so many options that need to be updated via jquery's ajax.Having looked at ways of updating wp_options via ajax,i have hypothesised that updating the wp_options table would be the easy way out for me. Are there risks if update the options that way or is it safer to go the api way?.


title: Why does my custom taxonomy show a total count across all post types

text: I have created a custom taxonomy 'season' I have 3 custom post types which I want to use this taxonomy. These are   * Races    * Galleries    * Competitors Now, when I view the totals within the taxonomy screen (i.e. the URL in the wp-admin is showing: edit-tags.php?taxonomy=season&post_type=race) The totals are showing the combined number of posts in this category across all my custom posts, and not just the number of 'race' posts which fall into this category. Why is this? and how do I get the taxonomy to only show this custom post type? ![enter image description here](http://i.stack.imgur.com/VRUff.png)


title: member login using photo

text: I'm new in WordPress what I want is my website only can be opened by who was invited by me.. and but I want using an image as my invitation,, not mere a link.. so the image is used to login password but I want to member's comments also connected to their Facebook and or twitter account I will create just 5 to 6 pages of my web one of them a different to each member the rest is completely same and the last is I want to before the members logout they have to give a comments they cannot even close the tabs or browser :smile P.S. this is will be my wedding web so i hope they give me a comment about me b4 they leave


title: Unregister default admin styles from specific admin page

text: I'm trying the following code in theme's function.php:               function mypage_remove_scripts() {         wp_deregister_style( 'wp-admin' );     }     add_action( 'mypage', 'mypage_remove_scripts' );      But that doesn't help. Thanks!


title: Which file do I run a cron job on to make Twitter News Feed update more often?

text: I have installed the Twitter News Feed plugin which only updates once an hour. There is a button to press though that updates it immediately. I presume therefore that there is a file that I can call with a cron that will update as often as I set the cron for. The trouble is I don't know which file to call. Can anyone help me out for what I should look for? These are the files available. Plugin Files twitter-news-feed/twitter-news-feed-admin.php twitter-news- feed/simplepie/README.txt twitter-news-feed/simplepie/simplepie.inc twitter- news-feed/simplepie/LICENSE.txt twitter-news-feed/twitter-news-feed-class.php twitter-news-feed/readme.txt twitter-news-feed/twitter-news-feed.php If you need to know the contents of the files I can add them. You can read about the plugin here: http://wordpress.org/extend/plugins/twitter-news-feed/ Many thanks


title: How to send a BuddyPress user a notification on a plugin event?

text: Done a bit of searching and cant really find the answer. Looking for idea on how I send a user an admin bar notification in BuddyPress after a certain event is actioned in a plugin I'm building? BP Version - 1.6.4, Wordpress Version - 3.5.1


title: How do I retrieve multi-dimensional arrays from the wp_postmeta table, & display on a website?

text: I would like to retrieve multi-dimensional arrays (that have been created with metaboxes), & display them on the front end of a website using shortcodes. My Question: How do I retrieve multi-dimensional arrays from the wp_postmeta table, & display them in a shortcode? Do I use ` extract ` ? Thank-you!


title: How do I control Wordpress redirects?

text: I have a page on a site I'm developing titled 'Athletics.' If I mistype the url as /athletic (instead of /athletics), then my site redirects me to /events/athletic-banquet. How can I control this behavior?


title: How do I mitigate the forward slash problem for URLs of images after a WP migration?

text: I migrated my WP deployment from the old server to the new server. The site still has the same URL (i.e. http://my.site.com) but I've moved my WP deploy from the site URL to a subdirectory of said URL (i.e. the WP deploy used to be found at http://my.site.com, but now it's at http://my.site.com/blog). The good news is that I've got all the textual content migrated. The bad news is that the images aren't loading correctly. I took a closer look at the URLs for images embedded in posts and they all look something like this:               <img style="padding: 7px;" src="/wp-content/uploads/image.jpg" alt="Image" width="172" height="154" align="right" border="0">      Note the forward slash in the `src` attribute. What's happening is that the browser is looking to load the image at http://my.site.com/wp- content/uploads/image.jpg. But the site is deployed at http://my.site.com/blog now. I can find the image if I cut and paste the URL into my browser and pre- prend the correct WP site URL (i.e.http://my.site.com/blog/wp- content/uploads/image.jpg). What kind of WP kung-fu do I need to correct this? I have read: http://codex.wordpress.org/Moving_WordPress I have looked at these: http://interconnectit.com/products/search-and-replace-for-wordpress-databases/ http://wordpress.org/extend/plugins/velvet-blues-update-urls/ And they don't exactly help.


title: Problem with articles feed: XML Parsing Error: XML or text declaration not at start of entity

text: I have a problem with WordPress articles feed. I have discover it analyzing what googlebot is scanning on my site and I disconvered that it is scanning only the feed and not the articles... So I have try to open feeds URL scanned by Googlebot and I have found a bad surprise...if I try to open these links go into error...all times... For example you can try to open this link and say the error: http://www.scorejava.com/2013/04/09/27-aspect-orienting-programming-aop-in- spring/feed/ That in english sound like: **XML Parsing Error: XML or text declaration not at start of entity** I think that it is creating me big indexing problem !!! Why have I this problem? How can I solve it? Tnx Andrea


title: Add hyperlinks in media description

text: I want to add hyperlinks in the description box of a media file in the library but it won't display hyperlinks for some reason. It displays text but as soon as i put a href it hides it. i'm using the theme asteria lite Greetings


title: Yoast SEO Plugin: Double Title isse

text: After researching a lot I found that there are quite a few very common issues with the "Yoast SEO plugin" that haven't been resolved yet. I also ran into those issues (which is why I was researching) and strangely enough there are no solutions for many of those issues yet, although they are so common. Many users of the plugin report the same issues, but in the Wordpress Support forums nobody seems to help them. There is no solution - even for issues that have been reported half a year ago! I hope that my question thread will not only help myself, but other users who ran into the same issues and have been looking forever for a good solution. **Information:** My blog: http://zoomingjapan.com Wordpress Version: 3.5.1 Yoast plugin version: 1.3.4.4 Other: I recently changed from All in ONE SEO to Yoast. **Dublicate Title when sharing on Google+** While search engines and other sharing services don't produce double titles, Google+ does. It is a very common issue. Some possible solutions are: Look at your html code (header.php) and check if there's a double "og:title" tag. If yes, remove. Here are some other solutions that might work. If this doesn't help, check if you use any plugins that generate the "og:title" tag. The Yoast plugin does this, but you can turn it off. I heard that with a recent Jetpack update, you also get the open graph tags, but you can turn it off using this filter:               add_filter( 'jetpack_enable_open_graph', '__return_false' );      as suggested here. None of these have worked for me. I added the filter to get rid of the one in Jetpack and I turned the one in Jetpack off. I use my own code for open graph:               //Adding the Open Graph in the Language Attributes     function add_opengraph_doctype( $output ) {             return $output . ' xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"';         }     add_filter('language_attributes', 'add_opengraph_doctype');          //Lets add Open Graph Meta Info              function insert_fb_in_head() {             global $post;             if ( !is_singular()) //if it is not a post or a page                 return;                 echo '<meta property="fb:admins" content="377035309011137" />';                 echo '<meta property="fb:app_id" content="235244769925765" /> ';                 echo '<meta property="og:title" content="' . get_the_title() . '"/>';                 echo '<meta property="og:type" content="article"/>';                 echo '<meta property="og:url" content="' . get_permalink() . '"/>';                 echo '<meta property="og:site_name" content="Zooming Japan - Detailed Japan Guide"/>';             if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image                 $default_image="http://zoomingjapan.com/wp-content/themes/alltuts/images/linkback_600x156ver2.jpg"; //replace this with a default image on your server or an image in your media library                 echo '<meta property="og:image" content="' . $default_image . '"/>';             }             else{                 $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );                 echo '<meta property="og:image" content="' . esc_attr( $thumbnail_src[0] ) . '"/>';             }             echo "\n";         }         add_action( 'wp_head', 'insert_fb_in_head', 5 );      Removing this code will get rid of the duplicate title in Google+, but of course Facebook sharing cannot generate the right meta title and description anymore. Any other solutions for this problem? EDIT: So when I try to share something on Google+ I get a "double title issue" as seen here: ![Double title issue](http://i.stack.imgur.com/amp3H.jpg) I want to either have "Title 1" or "Title 2", but currently it's "Title 1 Title 2" One title is the one I typed in Wordpress when publishing the post and the other one is the meta title I typed in the SEO Yoast plugin. When sharing on Facebook etc. I don't have the "double title issue".


title: Remove post content from buddypress activity

text: I'm trying to remove the post content from the buddypress activity stream and would like to replace the content/body with a custom field that I've added in. Any ideas where I should be looking? I've been looking around for a while and cant seem to figure it out. I am using WordPress 3.4.1 & Buddypress 1.5.6


title: quicktags "link" button doesn't work, but all other buttons do

text: I've added quicktags to a plain ol' textarea field which sits inside a metabox on a custom post type page. I can see the `link` button on the toolbar, along with the rest of the buttons, but when clicked, the link button does nothing. Using WP 3.6. All the other buttons work except the link button, and there's no errors in the firebug console. Have also tried with chrome.               function my_admin_print_footer_scripts() { ?>              <script type="text/javascript">/* <![CDATA[ */                  var id = "textarea_id"; // textarea's id                  settings = {                 id : id,                 buttons: 'strong,em,link,ul,ol,li,code' // have tried with default settings              }                  quicktags(settings);              /* ]]> */</script>          <?php }     add_action( 'admin_print_footer_scripts', 'my_admin_print_footer_scripts' );      ![enter image description here](http://i.stack.imgur.com/neiMW.png) Is there another bit of code I need to write or another JS file to enqueue? I presume the link button must popup a box for the user to enter the link.


title: What exactly defines a Main Loop and a Secondary Loop?

text: My assumption is that the main loop is always the first loop and you're always supposed to use query_post? Is this correct? Then whenever you you need to feed in some arguments to get a different set or order of posts you use WP_Query or get_posts. These would both be secondary loops? I just feel I'm hardly interacting with the Main Loop at all so I have this feeling, whilst everything works, I'm just not doing things properly.


title: Edit post meta with checkboxes on front end

text:
I'm trying to build an interface so that two custom fields for a custom post type can be edited on the front end with checkboxes. I'd like to display empty checkboxes if neither of those the fields have values, and allow a user to check one or both boxes, and have the corresponding fields be set to true (or just have some value, I suppose - not sure if a postmeta can have a boolean value) (preferably via AJAX). My first thought is to use Scribu's Front End Editor plugin, although it obviously doesn't solve this use case without some tweaking. However, I figured I'd ask to see if anyone else has done something like this before, or has suggestions on how specifically to implement the FEE plugin to do this (or if I should look elsewhere). Edit to expand: this is going on a page listing multiple posts, so I'm trying to figure out a way to make this work for more than just one post on a page. Here's what the page looks like right now: ![enter image description here](http://i.stack.imgur.com/KbJgu.png) And here's the markup for that table:

                             Date/Time	                             Job ID	                             Customer Name	                             File Size	                             Details	                             Download	                             Scheduled	                             Completed

                             8/8/12 1:12pm	                             28	                             Selina Kyle	                             filesize	                             Details	                             Download File	                             <input type="checkbox" name="28-scheduled"  />	                              <input type="checkbox" name="28-completed"  />	                              <input type="hidden" name="post_id" value="28" />

                             8/8/12 1:06pm	                             26	                             Jim Gordon	                             filesize	                             Details	                             Download File	                             <input type="checkbox" name="26-scheduled"  />	                              <input type="checkbox" name="26-completed"  />	                              <input type="hidden" name="post_id" value="26" />

                             8/8/12 1:05pm	                             25	                             Lucius Fox	                             filesize	                             Details	                             Download File	                             <input type="checkbox" name="25-scheduled"  />	                              <input type="checkbox" name="25-completed"  />	                              <input type="hidden" name="post_id" value="25" />

                             8/8/12 12:51pm	                             22	                             Bruce Wayne	                             filesize	                             Details	                             Download File	                             <input type="checkbox" name="22-scheduled"  />	                              <input type="checkbox" name="22-completed"  />	                              <input type="hidden" name="post_id" value="22" />


title: How can I make gallery slideshow width fit to picture width?

text: I am using WordPress 3.8 and I want to make gallery width to fit image width.How can I do that? Currently it look like this:   ![enter image description here](http://i.stack.imgur.com/2Mb0R.png) I want it look like this:   ![enter image description here](http://i.stack.imgur.com/EXoH1.png)


title: Does a query executed through wpdb class get cached?

text: I am not sure how WordPress cache the queries. I had the impression that whenever I execute a query through wpdb class, it gets cached. For example, on codex under Select a Row and Select a Var, it says the whole query is cached for later use. And I think which means if more data is requested in another query, partials or full results of which are already in wpdb cache, then those are used and a query doesn't happen(in case of full results already in cache). Am I correct in understanding? I was trying something and I found that I can't use the cache. For reference, I was listing the recent comments the current user has made. I used `get_comments()` but since it only has post id in the results, I used `get_the_title()` inside the loop for displaying them. Obviously this is expensive in terms of query, so I though I can cache the required rows of post table by querying them beforehand so that `get_the_title()` does no actual query. I did something like               $query = implode( ' OR ID = ', $collect_post_ids );     $query = 'SELECT * FROM '.$wpdb->prefix.'posts WHERE ID = '.$query.';';     $wpdb->get_results( $query ); // just cache it      but that didn't help. `get_the_title()` is still doing queries. Most likely its me who has misunderstood how WP Cache works. So where I am wrong? Here is the full code for reference - http://ashfame.pastebin.com/BpxjHiQr


title: Add SideBar/Widgets Just Below the Post

text: I have created and registered side bar in function.php and using it another place. It's working fine. Now I like to use it just below the post. I have installed some plugins -Bookmarks, related post...etc. They are also coming just below post. I want to show first the sidebar then the plugins. If I put code just after               the_content();       It appears after plugins, but I have to show before plugins. Let me know how to do.


title: Hide price & title in store thumbnail dispay?

text: I'm setting up a WooCommerce site to sell shirts. I have the front page (and the "Store" page" set up to show a grid of thumbnails of the shirt designs. Each item has the price and the title of the design under it by default. I want to "turn off" showing the title and the price in the store view. I _DO_ want them to appear on the individual product page, after a user clicks on a thubnail to go to the product page. Since it is a shirt site, I plan to keep uniform pricing so there is no need to have the same $17.95 price showing up under every shirt, and the title isn't really needed since they can read the graphic on the shirts. So, any idea if this is possible? Where would I go to turn this feature off? I'm running the Rustik theme using WooCommerce. Thanks!


title: Ajax for subscibers not working

text: I have a very simple AJAX function that works fine when logged in as admin, but when logged in as a subscriber the call to admin-ajax.php returns a html page with the header and footer of my theme, and that's it. By doing some wolf fencing I've tracked it down to line 37 of admin-ajax.php `do_action( 'admin_init' );`. It gets there and just returns.


title: Wordpress 3.0 Multisite - Child sites and backends appearing blank

text: I've just installed wordpress on our Rackspace server - I've set wordpress up for Multisite as I have done many times before. The main wordpress site at the root functions fine - however when I add a new site and click on either 'backend' or 'visit' I get 'page not found'. Pages in the main site seem to work fine with the default permalink settings but not custom such as /%category%/%postname%/ I think this must be a server issue but am a bit stumped. Any suggestions appreciated!


title: Custom terms in custom category taxonomy

text: I have a Custom Post Type called 'directory'. I have a custom category taxonomy assigned to the post type called 'directories'. This custom taxonomy has several custom terms (e.g. one is 'art supplies' (slug is 'art- supplies')). I can get all my custom taxonomy terms to list out to the screen as links but I can't find a way that when one of the custom term links is clicked to show all posts assigned to that term. Is there a way to do this and if so, how would I go about it? Thanks for your help. Kev


title: functions.php conditional output for a single plugin

text:
hope I've asked this correctly. Bizarre situation. I have some non-breaking spaces in my titles for typography reasons. They are added automatically where required in place of normal spaces by the following function...               // stop brackets in titles appearing on own line     function clean_orphan_titles($content){          $array = array (             '{ ' => '{ ',             ' }' => ' }'          );          $content = strtr($content, $array);          return $content;          }          add_filter('the_title', 'clean_orphan_titles');      The problem I have is that one plugin doesn't like this - you can see the result here http://skipology.com/temporary-test-page/ However. If I replace `return $content;` with `return htmlspecialchars($content);` the plugin output renders correctly but the rest of my site displays ` ` instead of the space. Can I either create a conditional situation to include both lines with one just targeted at the output of the plugin (Wordpress Popular Posts) or can I create a near duplicate function somehow triggered by the plugin? I can't target a specific page because all pages will potentially contain this conflict. Edit - the conflicting output is from the plugin and shows my post titles as generated by the plugin as 'iPhoneography seascape workflow – {�horizon�}' where the � is the ` ` Edit2 - That helps. What is the Plugin itself doing to filter the post title? This is what I can see...               // TITLE          $title = ($this->qTrans) ? qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($p->title) : $p->title;     $title = strip_tags($title);     $title_sub = strip_tags($title);          // truncate title (section on truncating the title here - I don't use)          $title = htmlspecialchars( $title, ENT_QUOTES, $this->charset );     $title_sub = htmlspecialchars( $title_sub, ENT_QUOTES, $this->charset );     $title = apply_filters('the_title', $title, $p->id);     $title_sub = apply_filters('the_title', $title_sub, $p->id);      Specifically re character sets we have:               var $charset = "UTF-8";      and...               // set charset     $this->charset = get_bloginfo('charset');      and the SQL character set seems to be               $sql = "";     $charset_collate = "";      Edit 3 - I've just done another test and if I manually insert ` ` into a title rather than relying on my functions.php code posted above it's rendered perfectly by the plug in. Is there something wrong with the functions.php? My source code shows the correct behaviour as does my site so I'm confused! e.g. this is the title from a post... `
iPhone photography tip { extend canvas and auto clone }
`


title: WPMU - new users are automatically subscribed to the main blog - how to prevent that?

text: New users added via `wpmu_signup_blog($domain, $path, $title, $user_name, $user_email);` are automatically subscribed to the main blog. Can this be prevented? I only want them to be administrators of their newly created blog. I have no idea where to start looking for that as it seems to be some internal WordPress's mechanism that handles that. http://codex.wordpress.org/WPMU_Functions/wpmu_signup_blog


title: Update an existing post in a custom post type

text: Alright lets say we have a connected user that access one of his post to replace some existing informations in X fields thats already exist with some new ones.. How could i manage to update the old ones with the new ones ? Example : custom post type name = recipe field trying to be updated with new content = $_POST['title'] Thks for the help


title: Custom Post Type URL Rewrite's

text: I am going to try and sum up what I am trying to achieve... Basically I have a custom post type called 'marketing_list' which will have custom fields holding information relating to marketing lists available for purchase. Each marketing list will belong to a category (custom taxonomy). So currently my URL's look like this:   * `/marketing-lists` -> archive page   * `/marketing-lists/post-slug` -> single marketing lists entry   * `/marketing-lists/category/category-slug` -> custom taxonomy What I want to achieve is:   * `/marketing-lists` -> archive page but editable within the admin in case the client wants to update text, like a Page.   * `/marketing-lists/category-slug` -> custom taxonomy   * `/marketing-lists/category-slug/post-slug` -> single entry On top of that I would like to create some additional pages which have a base of `/marketing-lists` i.e   * `/marketing-lists/consumer-marketing-lists` -> single page   * `/marketing-lists/business-marketing-lists` -> single page Is this at all possible? Perhaps their is a better way to achieve this?


title: Query based on custom fields start and end date

text: I have a custom post type called Events, with 2 custom fields, start date and end date. These fields are stored using a timestamp in the database. I want to create a custom query based on these 2 values, so i can list events that are inside the specified date/time range. This is how my code looks like:               $start_date = strtotime($_POST['start_date']);     $end_date = strtotime($_POST['end_date']);     $args = array(         'post_type' => 'event',         'posts_per_page' => -1,         'orderby' => 'title',         'order' => 'ASC',         'meta_query'=>array(             'relation'=>'AND',              array(                 'key' => 'event_start_date',                 'value' => $start_date,                 'compare' => '<=',                 'type' => 'NUMERIC'              ),              array(                 'key' => 'event_end_date',                 'value' => $end_date,                 'compare' => '>=',                 'type' => 'NUMERIC'              )          )     );     $events = new WP_Query($args);            So i'm using a simple NUMERIC meta_query, since all of my values and keys stored in a timestamp. The code looks fine for me, but somehow theres no results in this query. Here is an example: $star_date = 1343779200 $end_date = 1412121600 And one of my event post has these values as a custom field: event_start_date = 1375315200 event_end_date = 1377734400 So it should give me at least one result, because the start_date is smaller and the end_date is higher compared to the event_start_date and event_end_date. Any idea whats wrong?


title: Is the only way to add taxonomy terms via an admin panel?

text: Is it possible to register taxonomy terms programmatically from a plugin? I would like to add a custom taxonomy 'geographical area' and also prepopulate the taxonomy with a list of areas in the UK.               public function sample_taxonomy() {         // create a new taxonomy         register_taxonomy(             'resellers',             'wps-reseller',             array(                 'label' => __( 'Geographical Areas' ),                 'rewrite' => array( 'slug' => 'area' ),                 'capabilities' => array(                     'assign_terms' => 'edit_guides',                     'edit_terms' => 'publish_guides'                 )             )         );     }      Also, how would I run this code only once as part of plugin activation? I am using the Wordpress plugin boilerplate activation functions.


title: WPMU schedule doesn't execute actions

text: Here's a simple event that is correctly scheduled to be executed `daily`. Unfortuantely, it doesn't execute `delete_old_users()` function daily. It is supposed to delete users older than a certain date.               function delete_old_users() {         $old_users = get_site_option( 'old_users' );              foreach ( $old_users as $user_id => $expiration_time ) {             if ( $expiration_time <= gmmktime() ) {                 wpmu_delete_user( $user_id );             }         }         return;     }     add_action( 'delete_old_users_daily', 'delete_old_users' );               function setup_schedule() {         if ( ! wp_next_scheduled( 'delete_old_users_daily' ) ) {             wp_schedule_event( time(), 'daily', 'delete_old_users_daily');         }     }     add_action( 'wp', 'setup_schedule' );      Is there anything I'm missing here? When I manually do `do_action( 'delete_old_users_daily' )` it works. I'm out of ideas. It just doesn't execute my action and I have no idea how to debug that.


title: wordpress ajax relationship query

text:
Using the relationship field from Advanced Custom Fields I link artists to events. Both these artist and events are custom post types. For each event, the post IDs of the related artists are stored in an array as a custom meta field (lineup_artists). On each event page I list all the artists. When you click on an artist, I'd like to show all the events where you can find this artist (through an AJAX call which shows the results in a bootstrap modal). I've tested the AJAX call and it's working, but there's something wrong with the query (takes very long to complete). In my function I have:               $ArtistID = $_POST['ArtistID']; // Gets the ArtistID from the AJAX call          $meta_query = array(         'key'       => 'lineup_artists',         'value'     => '"' . $ArtistID .'"',         'compare'   => 'LIKE'     );              $args = array(             'post_type'         => 'events',             'meta_query'        => array($meta_query),             'posts_per_page'    => 5,             'post_status'       => 'publish',        );      If I dump the results of wp_query, I get the following sql query:               SELECT SQL_CALC_FOUND_ROWS yt_posts.ID FROM yt_posts           INNER JOIN yt_postmeta ON (yt_posts.ID = yt_postmeta.post_id)          WHERE 1=1           AND yt_posts.post_type = 'events'      AND (yt_posts.post_status = 'publish')           AND ( (yt_postmeta.meta_key = 'lineup_artists' AND CAST(yt_postmeta.meta_value AS CHAR) LIKE '%\"17497\"%') )           GROUP BY yt_posts.ID ORDER BY yt_posts.post_date DESC LIMIT 0, 5      When I paste this query in phpmyadmin it takes very long to complete (I've never seen it finish because it takes so long). Is this because the artist IDs are stored as an array? Someone told me that this is not very efficient and that these relations should be stored in a separate table (which I don't know how to do). Is there something wrong with my query or is this a very inefficient way of querying relations? * * * **EDIT:** In reply to kaiser (let's use ACDC as an example :-)): In my event page I have this html/php for each artist (there can be 100+ artists on each event page. `$artistID` and `$artistName` are generated in the `foreach` loop.):               <a class="yt-artist" data-target="#modalArtist" data-toggle="modal" id="ArtistAttr" data-id="<?php echo $artistID; ?>" data-name="<?php echo $artistName ?>"><?php echo $artistName; ?>      This code is generated in a `foreach` loop to get all the artists:               $lineup = get_sub_field('lineup_artists'); // The relationship artists are in a repeater field     if($lineup):     foreach($lineup as $artist):     <a class=... etc      which will result in:               ACDC      So clicking an artist shows the modal, and when the modal is shown the AJAX js is fired:               jQuery(document).ready(function()      {         $(document).on('click','.yt-artist',function()         {             var ArtistID = $(this).data('id');                 var ArtistName = $(this).data('name')             $('#modalArtist').on('shown',function()             {                  jQuery.ajax(                 {                       type: 'POST',                       url: 'http://xxx/wp-admin/admin-ajax.php',                       data:                      {                           action: 'yt_ajax_artist_events_eventpage',                           ArtistID: ArtistID,                                         ArtistName: ArtistName,                     },                     success: function(data, textStatus, XMLHttpRequest)                     {                           jQuery('#modalArtist').html(data);                       },                       error: function(MLHttpRequest, textStatus, errorThrown)                     {                       alert(errorThrown);                     }                 });             });          });      And the function (includes some HTML to inject in the modal):               function yt_ajax_artist_events_eventpage(){              $ArtistID = $_POST['ArtistID'];         $ArtistName = $_POST['ArtistName'];              $meta_query = array(             'key'       => 'lineup_artists',             'value'     => $ArtistID,             'compare'   => 'LIKE'         );              $args = array(             'post_type'         => 'festivals',             'meta_query'        => array($meta_query),             'posts_per_page'    => 5,             'post_status'       => 'publish',            );              $results = '
             <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
'.$ArtistName.'

';         $loop = new WP_Query($args);         while ($loop->have_posts()) : $loop->the_post();              $results .= '
'.get_the_title().'
';              endwhile;         wp_reset_query();         $results .= '
';         die($results);     }       add_action( 'wp_ajax_nopriv_yt_ajax_artist_events_eventpage', 'yt_ajax_artist_events_eventpage' );       add_action( 'wp_ajax_yt_ajax_artist_events_eventpage', 'yt_ajax_artist_events_eventpage' );


title: Query by post title

text: I've used a custom post type for one of my website. Custom post type contains scratch card data along with some custom fields. I've developed an android application to manage those items from android device. In the android app, I want to keep search feature which will help admin users to search card numbers to manage those. I can use wordpress query to search by title.               Code     $args = array("post_type" => "mytype", "name" => $title);     $query = get_posts( $args );      It can only provide result if I provide exact title. But I need to retrieve all items with similar title. Any suggestion?


title: Posts aren't showing up in my dashboard

text: When an admin logs into my site to edit a post, the list of available posts is empty -- even though there clearly are posts on the site. Do you know why this is happening or how to make the posts show up? ![posts do not show up](http://i.stack.imgur.com/pWhfg.png)


title: Shortcode for latest -not expired- posts

text:
I've made a short code (part of a plugin) to display the posts which aren't expired. For saving the expiration date, i made already a meta key called newsbox-date. Handy for micro-news, short messages and holliday announcements. My client will not use the posts for blogging but more for short messages a few times a year. With the shortcode we can paste the newsbox on the homepage and contactpage. (as mentioned: handy for holidays) So far i have this:               function my_recent_posts_shortcode( $atts ) {     extract( shortcode_atts( array( 'limit' => 5 ), $atts ) );     $q = new WP_Query( 'posts_per_page=' . $limit );     $list = '
';     while ( $q->have_posts() ) {         $q->the_post();         $expdate = get_post_meta(get_the_ID(), 'newsbox-date', true);         $nowdatetime = current_time("mysql");         if ($expdate >= $nowdatetime) {         $list .= '
' . get_the_title() . '
' . get_the_content() . '';         }     }     wp_reset_query();     return $list . '
';     }     add_shortcode( 'recent-posts', 'my_recent_posts_shortcode' );      There are a few things i need to handle:   * can i do the filtering of expiration date in the WP_Query already ? Now all posts are first requested, right ?   * When all posts are expired, the div newsbox-posts must not be showed. So, an if-statement must be handled before the div; but i don't know yet the best way to get the meta key in this stage. Thanks for any tips. If this thing is working, i'll share the plugin in the rep.


title: How to change featured content to a different tag in Wordpress Twenty Fourteen?

text: In twenty fourteen theme, we’d like to know how to change the features content tag. Currently it’s set as `featured`. Now, we would like to know how to code this for different page templates. We notice in `page.php` there is a piece of code calling the template part `featured-content`.               <?php     if ( is_front_page() && twentyfourteen_has_featured_posts() ) {         // Include the featured content template.         get_template_part( 'featured-content' );     }     ?>      From our understanding this calls the file `featured-content.php`. In this file, is there a way to decide the tag. We imagine you can do it using an if statement and the `$tag` or `$term` variable inside an array. But we’re not completely sure. Our idea is to create three pages on our site, each using a different tag to show different posts in the featured content section. Can this be done and can anyone provide us with the code or logic to do it? Thanks in advance! the LWdesign team


title: Wordpress 1 domain multiple blogs

text: I need to setup a website with wordpress that 1 domain with have different pages of blogs. For example: \- my website have Home, Artworks, Techniques pages. \- Artworks and Techniques are 2 different blogs. \- Home will shows whichever posts that is latest from Artwork and Techniques. How can I do that with wordpress?? Thanks!


title: 1 WordPress, 2 themes, 2 domains, 2 servers

text: I've got two sites which are hosted on different servers. 1) domain-one.com 2) domain-two.net I installed a WordPress blog on site one at domain-one.com/blog/. I want visitors of domain-two.net to be able to access the blog installed on site one via domain-two.net/blog/. I have a WordPress plugin called "Domain Theme" that changes the look of the blog depending on the domain the visitor is accessing it from. This plugin determines where the visitor is coming from via the $_SERVER['SERVER_NAME'] variable. I have an .htaccess file in domain-two.net/blog/ redirecting requests to domain-one.com/blog/. Going to domain-two.net/blog/dog.php actually shows what's at domain-one.com/blog/dog.php. Unfortunately, the Domain Theme plugin for WordPress can't tell when it's being accessed from domain-two.net because after the rewrite in .htaccess, the value of $_SERVER['SERVER_NAME'] is domain-one.com (not domain-two.net). Because of this, I see the same theme when I access the blog from either domain. Is there a way to redirect requests from domain-two.net that lets the plugin know where they're really coming from?


title: Filter or Hook to catch pre-rendering of post content

text: Is there a filter or hook that is triggered just before post content is rendered? What I'd like to do is to apply a filter to the text content of a post just before the post text is being rendered.


title: custom post type index page

text: I have registered a custom post type and I want to create a page where I will list some posts, it will be like an index page. I have created an archive page called **mycpt-archive.php** and a page called **myCPT.php**. I've added a custom URL in the menu called "myCPT" like this : **www.mywebsite.com/mycpt** Now, when I click from the front-end menu on "myCPT" it displays the **mycpt-archive.php** content and not the **myCPT.php**. I've looked through the template hierarchy from CODEX and it seems I'm on the right track. When I click on "myCPT" from the front-end menu the page displayed is **mycpt- archive.php** not **myCPT.php** which I'm expecting to open. What am I missing here ? Thank you !


title: Save automatically data to user profile once or twice a day

text: **The main goal :** I am working on a panel which will display statistics of my user websites (external website). For that, I use the Google Analytics API. I save the Google Analytics profile number in a custom profile field. For the moment, I run the script (statistics) each time my users want to see them (in front end). And it takes few seconds to generate them. My statistics change approx once a day (It's not hourly stats, but daily stats). So, the idea was to save once a day the statistics to the user profiles. So, like that, it won't take time to generate them each time the user will load a stats page. **The solutions :** So, I started to think about different solutions. But the best would be to save the data without any action from the users. Or maybe when someone visits the website, it would save the data for everyone once the day with wp_cron. For the moment, the only thing I succeed was to save the data when a user update his profile. But it will save only his data, and not for everyone, so it's not what I want.               function my_save_statistiques( $user_id ) {               $visites_totales = 'My stats script....';         update_usermeta( $user_id, 'visites_totales', $visites_totales );     }     add_action( 'personal_options_update', 'my_save_statistiques' );     add_action( 'edit_user_profile_update', 'my_save_statistiques' );


title: Get source from the_post_thumbnail

text: I'm struggling because I'm using the "Sitewide Tags"-Plugin to grab all posts in a network to the main blog. Now I want to embed the post images to the main blog and the only function you're able to use for that is: `the_post_thumbnail ();` But I'm using a grid layout for which I just need the url of the image (src). For that I cant't find the solution and would be very thankful for some help. Best regards, Philipp


title: URL parameters causing 404 on home page, but nowhere else

text: I am writing a plugin that utilizes URL parameters. For some reason, adding one of these parameters to the home page of my website causes a 404 (http://bleaney.ca/?source=asdf). Adding the parameter to any other page, however, doesn't cause a 404 (http://bleaney.ca/work- experience-2/?source=asdf). This 404 issue only manifested itself after I registered the parameter with Wordpress:               add_filter('query_vars', 'register_visitor_identifier_query_vars' );     function register_visitor_identifier_query_vars( $qvars ) {         $qvars[] = 'source';         return $qvars;     }      On the 404 page, the URL parameter is still detected by this code, the page itself just 404s for some reason:               if (isset($wp_query->query_vars['source'])) {         echo $wp_query->query_vars['source'];     }      Any idea what is causing this and how I can fix it? I think the workaround of just setting the home page to have a longer ULR like the work experience link would work, but I'd rather fix this issue if possible, rather than work around it.


title: Why does ini_get('post_max_size') return a different value inside wp_max_upload_size() than outside?

text: This code in an otherwise empty php file:               var_dump(ini_get( 'post_max_size' ));      ...in my Wordpress directory on the server will output `string(3) "40M"` (as expected). Putting the exact same line of code into the function `wp_max_upload_size()` contained in `/wp-includes/media.php` outputs `string(2) "8M"`. How can this be? `phpinfo()` tells me 40M as well.


title: Use [embed] filter in template files

text: WordPress autmatically embeds a youtube video's if I use:               [embed] http://www.youtube.com/watch?v=Xog1T5dUxcw [/embed ]      This is great, but it doesn't work if I use it in an template file. I have a custom field where the admin can put a URL to a YouTube video. I want get the video in the sinle-post using the following code:               <?php       $custom = get_post_custom($post->ID);       $url = $custom['_videoLink'][0];     ?>     <div class="video">       [embed]<?php $url; ?>[/embed]     </video>      How can i convert the Youtube URL into an embed URL using the standard WordPress [embed] function?


title: Passing variable in nested shortcodes

text: How can I pass `style` attribute of `[boxes]` shortcode to `[box]` shortcodes without using global variables? I don't want to use global variables, because I saw on a few articles that using global variables is a bad practice.               [boxes style="style-one"]         [box][/box]         [box][/box]         [box][/box]         [box][/box]     [/boxes]


title: How to redirect a Custom Google Search to a wordpress page/template?

text:
I'm using the Google Custom Search plugin by edwinkwan (the first that appears in the wordpress plugin repository). I added the search box: `<?php display_search_box(DISPLAY_RESULTS_CUSTOM); ?>` in the header. and the results: `<?php display_gsc_results(); ?>` in this page: http://alexchen.info/taiwantalk/search-results (Which is a tempalte called `search-results.php`) Now, I can only see the results if I perform a search in that page (with the search box in the header). If I just search for something, for example, in the front page, absolutely nothing happens. For instance, If I perform search from: **alexchen.info/taiwantalk** Nothing happens. I couldn't find anything like: "the search results page" in my Google Custom Search Panel. Apparently the Custom Google Search is working but the search is not being redirected to `search-results.php` when I perform a search in any other page. Any suggestions to fix this? **EDIT:** I also tried this plugin: **wordpress.org/extend/plugins/google- custom-search-for-wordpress/** but it seem to be based on the code of Google Custom Search of 2010. It requires you to get two pieces of code (the search box and the search results). But Google Custom Search's Panel only provides one. Like this:
Loading
               <link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" />


title: Best Practice for Displaying Categorized Posts on Front Page

text: I am building a custom wordpress theme from a clients mockup. On the homepage there are 2 sliders, and 4-5 areas for recent posts of different types. I would like to have all the content be editable in wordpress what is the best way to create a post, apply some sortof value to it (category,taxonomy,tag,custom post type), and then retrieve more than one loop on a single page or is it best to use feeds? Any suggestions greatly appreciated


title: Can't place two custom post types into the Wordpress search query?

text: I placed the following code into my `functions.php` file:               function filter_search($query) {         if ($query->is_search) {         $query->set('post_type', array('topic', 'reply'));         };         return $query;     };     add_filter('pre_get_posts', 'filter_search');      With that code I can only search for the `reply` custom post type (results with the `topic` custom post type don't show up). Both are custom post types from the bbpress 2.0 plugin. I have to do this: `$query->set('post_type', array('topic'));` in order to make the `topic` custom post type show up (but them I no longer get the `reply` custom post type to show up in the results). Any suggestions to fix this?


title: Wordpress Git Workflow Help

text: I'm looking for a strong streamlined workflow idea for working with Wordpress.   1. Would like to have my git environment on my own server internally, not using Github to handle repos.   2. Automatic creation of subdomains upon git branch creation (development.domain.com , ryan.development.domain.com) - Probably some shell script hook would be ideal for this.   3. Phing PHP/Shell script Handling of the db migration (something like this http://interconnectit.com/products/search-and-replace-for-wordpress-databases/ ) to handle serialized database replacement upon pushing Operation would probably go something like this:   1. getting the current latest wordpress version and branch it out, name of the branch gets a subdomain entry (branchdevelopment.domain.com)   2. submodule the theme you desire if it's available (i'd like to make my own git repo for this, as I use thesis I'd like to have a blank thesis git repo setup to grab from internally on the server that's already been created)   3. checkout and make changes , client reviews, once it's pushed to live, the database script will then kick in automatically changing the serialized url values from localhost (or subdomain) to the live url Is this possible? I've heard Capistrano is also good to utilize with this but not sure how Capistrano entirely works. I run about 200 sites on my own server and would like to start implementing these sites into a strong git workflow environment so i can streamline my work alot better. As of right now, I basically download an image of the site and work on it locally then upload the changes back to the server. This is very tedious in this day and age. Does anybody have any solutions regarding this type of workflow / has worked with this in the past? If so, some resources / answer would be greatly appreciated.


title: How to localize inline script called with ajax

text: I have a loop of posts and I allow a user to edit each post using ajax. When the edit button is clicked for the post I use ajax to retrieve the template part containing the edit form for the post. Easy enough to do by creating a function with 'get_template_part' and then localizing a script where I use $ajax to execute the function. Now here is my problem. I need to process the form with ajax that is in the template part we've called. In order to do anything with jquery for that form, the jquery has to be added as an inline script to the template. So when the button is clicked inside the from to save and edits made, I then need to run my php function that processes any edits made. But I can't do that because I can't actually localize the inline script that will allow me to use that php function I've made. Any ideas. UPDATE: Ok so instead of adding the scripts to the template inline, I register the script inside the function that gets the template part and then print it which I thought would give me a chance to localize. The script works for the template part but it isn't localized.                add_action('wp_ajax_fetch_dashboard_edit_form', 'fetch_dashboard_edit_form');       function fetch_dashboard_edit_form() {         $post_id = $_POST['postId'];         $edit_type = $_POST['editType'];         include(locate_template('edit-'.$edit_type.'.php'));             wp_register_script(          'fod_edit_script',          get_bloginfo('stylesheet_directory') . '/libs/edit.js',          array( 'jquery' ),          null,          true         );         wp_localize_script(          'fod_edit_script',          'editAjax',          array(             'ajaxurl' => admin_url( 'admin-ajax.php' )          )         );         wp_print_scripts("fod_edit_script");      }


title: How do I preserve changes to a theme's functions.php across updates?

text: I'm using a theme called "Pinboard", version 1.1.0. I made some edits to the theme's functions.php in order to display FontAwesome icons before archive titles. For instance, if you're browsing the "foo" tag, then up in the header, where it reads "Currently browsing tag foo", there's a tag icon to the left of "foo". These are the changes I made; they're in the "Highlight current location in the archive" section of functions.php, around line 1306:               elseif( is_author() ) {                         $author = get_userdata( get_query_var( 'author' ) );                         echo ' ' . $author->display_name;                     } elseif ( is_year() ) {                         echo ' ' . get_query_var( 'year' );                     } elseif ( is_month() ) {                         echo ' ' . get_the_time( 'F Y' );                     } elseif ( is_day() ) {                         echo ' ' . get_the_time( 'F j, Y' );                     } elseif ( is_category() ) {                         single_term_title( ' ' );                     } else {                         single_term_title( ' ' );                     }      You can see that I'm echoing `<i></i>` elements with certain classes. I want to preserve these changes between upgrades of Pinboard, but as it stands, updating the theme will obliterate my changes and require me to add them again by hand. What can I do to preserve these changes across upgrades? Is this a place where child themes would be useful, and if so, how? Thanks.


title: Custom taxonomy archive page not working

text: I have a custom post type, `course` with an associated custom taxonomy `curriculum-area`. On the permalink `domain.com/course/`, a list of all courses is shown as expected. However, on the permalink `domain.com/curriculum-area/equality`, it shows the home page. (The home page is a static page). I would like it to, instead, show an archive of all `courses` in the specified `curriculum-area`: `equality`. Also, if I have a `front-page.php`, this archive page also uses the template from `front- page.php`. How can I get the `archive.php` template to be applied to this custom taxonomy?               // functions.php:          <?php          // add thumbnail support     add_theme_support( 'post-thumbnails' );           // add custom post type 'Course'     add_action( 'init', 'register_cpt_course' );          function register_cpt_course() {              // custom taxonomy - curriculum area         $args_curriculum_area_taxonomy = array(             'hierarchical'          => true,             'labels'                => array(                 'name' => 'Curriculum Areas',                 'singular_name' => 'Curriculum Area'             ),             'show_ui'               => true,             'show_admin_column'     => true,             'update_count_callback' => '_update_post_term_count',             'query_var'             => true,             'rewrite'               => true         );              register_taxonomy( 'Curriculum Area', 'course', $args_curriculum_area_taxonomy );              // custom post type - course         $cpt_course_args = array(              'labels' => array(                 'name' => 'Courses',                 'singular_name' => 'course'             ),             'hierarchical' => false,             'description' => 'The place to display courses',             'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields', 'revisions' ),             'taxonomies' => array( 'curriculum_area' ),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'menu_position' => 5,                  'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'has_archive' => true,             'query_var' => true,             'can_export' => true,             'rewrite' => array(                 'slug' => 'course',                 'with_front' => true             ),             'capability_type' => 'post'         );              register_post_type( 'course', $cpt_course_args );          }          ?>


title: How to pass on a value as parameter via url to another page

text: I'm dealing with a problem I can't solve myself. I did a few hours of research about it, but I didn't manage to make it work. I want to send a parameter via the url to the page I'm forwarding to and based on the value of this I want to show a image. Im using the Hana Code Insert Plugin to get my js used in WP. I'm relatively new to WP and have little to no knowledge in PHP, so please consider this. **The Hana-contents are as following:** **shortcut galleryLink and getSelected_05:** http://www.abload.de/gallery.php?key=updfCGrl **The contents of the site are as following:** > toat.me/test-for-ids/ Gallery: [hana-code-insert name='galleryLink' /] Finished... > toat.me/resize-your-image-now/ |img class="aligncenter size-full wp-image-119" alt="" src="http://toat.me/wp- content/uploads/2013/08/blank-t-shirt_white_big.jpg" width="700" height="700" /| [hana-code-insert name='getSelected_05' /] Note: I had to replace the <> tags of the img with | in order to show it in this post. I'm looking forward to helpful answers.