How to separate metabox data in front/backend

I just created a kind of long metabox using a tutorial at wptuts but I am lost in two things:   1. The output of the metabox displays all data grouped (ex. in grouped checkboxes they are all in a whole even if I have different groups) and I'd like to grab the titles of each group and display them in different tables, divs or blocks.   2. Don't know how to display the saved data in the post, and also display it in separate blocks. Sorry for being such a noob heh but I want to learn how to code it for my themes, instead of using plugins. IM HUNGRY FOR KNOWLEDGE! My code is this:               <?php          $prefix = 'dbt_';     $meta_box = array(     'id' => 'features',     'title' => 'Property Features',     'page' => 'post',     'context' => 'normal',     'priority' => 'high',     'fields' => array(         array(             'name' => 'Price (in USD)',             'desc' => '',             'id' => $prefix . 'text',             'type' => 'text',             'std' => ' '         ),                array(             'name' => 'Price (in Mexican Peso)',             'desc' => '',             'id' => $prefix . 'text',             'type' => 'text',             'std' => ' '         ),              array(             'name' => 'Address',             'desc' => '',             'id' => $prefix . 'textarea',             'type' => 'textarea',             'std' => ''         ),              array(             'name' => 'Property for',             'id' => $prefix . 'select',             'type' => 'select',             'options' => array('Sale', 'Rent', 'Vacational Rental')         ),              array(             'name' => 'Area (m2)',             'desc' => '',             'id' => $prefix . 'text',             'type' => 'text',             'std' => ' '         ),              array(             'name' => 'Area of terrain (m2)',             'desc' => '',             'id' => $prefix . 'text',             'type' => 'text',             'std' => ' '         ),              array(             'name' => 'Number of rooms',             'desc' => '',             'id' => $prefix . 'text',             'type' => 'text',             'std' => ' '         ),              array(             'name' => 'Number of bathrooms. Include half bathrooms (ex. 2 1/2)',             'desc' => '',             'id' => $prefix . 'text',             'type' => 'text',             'std' => ' '         ),              array(             'name' => 'Service Bathroom',             'id' => $prefix . 'checkbox',             'type' => 'checkbox'     ),          array(             'name' => 'Furnished',             'id' => $prefix . 'checkbox',             'type' => 'checkbox'     ),     array(               'label' => 'Property specs',               'desc'  => '',               'id'    => $prefix.'checkbox_group',               'type'  => 'checkbox_group',               'options' => array (               'one' => array (               'label' => 'Livingroom',               'value' => 'one'           ),               'two' => array (               'label' => 'Diningroom',               'value' => 'two'           ),               'three' => array (               'label' => 'Breackfast area',               'value' => 'three'           ),                   'four' => array (               'label' => 'TV room',               'value' => 'four'           ),                  'five' => array (               'label' => 'Studio',               'value' => 'five'           ),                  'six' => array (               'label' => 'Integrated Kitchen',               'value' => 'six'           ),                  'seven' => array (               'label' => 'Laundry Room',               'value' => 'seven'           ),                  'eight' => array (               'label' => 'Service room',               'value' => 'eight'           ),                  'nine' => array (               'label' => 'jacuzzi',               'value' => 'nine'           ),                  'ten' => array (               'label' => 'terrace',               'value' => 'ten'           ),                  'eleven' => array (               'label' => 'balcony',               'value' => 'eleven'           ),                  'twelve' => array (               'label' => 'Warehouse',               'value' => 'twelve'           )     )       ),                     array(               'label' => 'Installed',               'desc'  => '',               'id'    => $prefix.'checkbox_group',               'type'  => 'checkbox_group',               'options' => array (               'one' => array (               'label' => 'Air conditioner',               'value' => 'one'           ),               'two' => array (               'label' => 'Stationary gas',               'value' => 'two'           ),               'three' => array (               'label' => 'Water heater',               'value' => 'three'           ),                   'four' => array (               'label' => 'Hurricain shutters or hurricain protection',               'value' => 'four'           ),                  'five' => array (               'label' => 'Telephone line',               'value' => 'five'           )     )       ),              array(               'label' => 'Outdoors',               'desc'  => '',               'id'    => $prefix.'checkbox_group',               'type'  => 'checkbox_group',               'options' => array (               'one' => array (               'label' => 'Parking space',               'value' => 'one'           ),               'two' => array (               'label' => 'Garden',               'value' => 'two'           ),               'three' => array (               'label' => 'Pool',               'value' => 'three'           ),                   'four' => array (               'label' => 'Tennis court',               'value' => 'four'           ),                  'five' => array (               'label' => 'Children playground',               'value' => 'five'           )     )       ),              array(               'label' => 'Facilities',               'desc'  => '',               'id'    => $prefix.'checkbox_group',               'type'  => 'checkbox_group',               'options' => array (               'one' => array (               'label' => 'Spa',               'value' => 'one'           ),               'two' => array (               'label' => 'Gym',               'value' => 'two'           ),               'three' => array (               'label' => 'Party salon',               'value' => 'three'           ),                   'four' => array (               'label' => 'Snack-bar',               'value' => 'four'           )          )       ),              array(               'label' => 'Luxury Features',               'desc'  => '',               'id'    => $prefix.'checkbox_group',               'type'  => 'checkbox_group',               'options' => array (               'one' => array (               'label' => 'Clubhouse',               'value' => 'one'           ),               'two' => array (               'label' => 'Dock',               'value' => 'two'           ),               'three' => array (               'label' => 'Waterfront',               'value' => 'three'           ),                   'four' => array (               'label' => 'Golf course',               'value' => 'four'           )               )       )          )     );               add_action('admin_menu', 'mytheme_add_box');     // Add meta box     function mytheme_add_box() {     global $meta_box;     add_meta_box($meta_box['id'], $meta_box['title'], 'mytheme_show_box', $meta_box['page'],    $meta_box['context'], $meta_box['priority']);     }          // Callback function to show fields in meta box     function mytheme_show_box() {     global $meta_box, $post;     // Use nonce for verification     echo '<input type="hidden" name="mytheme_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';     echo '
';     foreach ($meta_box['fields'] as $field) {         // get current post meta data         $meta = get_post_meta($post->ID, $field['id'], true);         echo '
',                 '', $field['name'], '	',                 '';         switch ($field['type']) {             case 'text':                 echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />', '
', $field['desc'];                 break;             case 'textarea':                 echo '<textarea name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="4" style="width:97%">', $meta ? $meta : $field['std'], '</textarea>', '
', $field['desc'];                 break;             case 'select':                 echo '<select name="', $field['id'], '" id="', $field['id'], '">';                 foreach ($field['options'] as $option) {                     echo '<option ', $meta == $option ? ' selected="selected"' : '', '>', $option, '</option>';                 }                 echo '</select>';                 break;             case 'radio':                 foreach ($field['options'] as $option) {                     echo '<input type="radio" name="', $field['id'], '" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' />', $option['name'];                 }                 break;             case 'checkbox':                 echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';                 break;               // checkbox_group       case 'checkbox_group':       foreach ($field['options'] as $option) {           echo '<input type="checkbox" value="'.$option['value'].'" name="'.$field['id'].'[]" id="'.$option['value'].'"',$meta && in_array($option['value'], $meta) ? ' checked="checked"' : '',' />                   '.$option['label'].'
';       }       echo ''.$field['desc'].'';       break;                  }         echo     '	',             '
';     }     echo '
';     }          do_action('save_post', 'mytheme_save_data');     // Save data from meta box     function mytheme_save_data($post_id) {     global $meta_box;     // verify nonce     if (!wp_verify_nonce($_POST['mytheme_meta_box_nonce'], basename(__FILE__))) {         return $post_id;     }     // check autosave     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {         return $post_id;     }     // check permissions     if ('page' == $_POST['post_type']) {         if (!current_user_can('edit_page', $post_id)) {             return $post_id;         }     } elseif (!current_user_can('edit_post', $post_id)) {         return $post_id;     }     foreach ($meta_box['fields'] as $field) {         $old = get_post_meta($post_id, $field['id'], true);         $new = $_POST[$field['id']];         if ($new && $new != $old) {             update_post_meta($post_id, $field['id'], $new);         } elseif ('' == $new && $old) {             delete_post_meta($post_id, $field['id'], $old);         }     }     }          // check autosave     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {     return $post_id;     }


permalink for category pages and posts

Can you please help me? For getting post url I use: `<?php the_permalink() ?>` But for pages and for categories? If I use `<?php the_permalink() ?>` on categories it displays post url.


Making Custom Fields Standard in the Admin UI

I've added a few different `custom_post_types` to my Wordpress 3 installation. They are all a bit different from eachother, and should store unique information in `custom_fields`. But while one may store a `product_id`, another will not. One will have a `source_url` and another will not. Rather than having to instruct my editors on which custom fields should be used with which custom posts, how can I make each custom post include its custom fields as part of the UI itself? If you visit "daily_cartoon" you would have a screen that asks only for a _title_ , _caption_ , and _media_.   If you visit "daily_product" you would have a screen that asks only for a _title_ , _price_ , _summary_ , etc.


In terms of performance - Is unmanaged VPS better then a managed one - for WP sites?

I am looking into optimizing my WP blogs, and one thing that comes out is that several of the most acclaimed solutions people are offering (Such as eaccelerator and Nginx), are only available if I had an unmanaged account. According to other reasons you might detail, which is better (performance wise) for managing a WP site? (that is assuming you don't have experience in unmanaged solution but was willing to learn)


A good way to maintain a resume on Wordpress?

I'm looking for a way to maintain my personal resume on Wordpress. In the past, I've used an old OpenOffice template, but it doesn't work that well anymore and doesn't support hResume. I've been looking around and none of the Resume plugins work that well. In fact, the best Resume editor I've seen is on http://careers.stackoverflow.com/. But I don't want my resume on someone else's site. I want it on my site. Ideally, it would have nice markup, with hResume microformatting. Maybe ODF and PDF versions automatically generated. Actually, there is no reason for the editor and the display portion to be part of the same tool. I'm hoping there is one out there already so I don't have to write it myself or just hand code it.


Filtering Custom Post Type by Comparing Date and Two Meta Keys

I am probably just overlooking something here, but some pointers would be greatly appreciated. I am trying to create an event website using Wordpress and the Advanced Custom Fields plugin. Now the events have two options, they are either One Day Events, or Multiple Day Events. I have given them fields that the user can put the date in with the date picker. One Day Event - one_day_event_date Multiple Day Event - event_start_date , event_end_date (these output YYYYMMDD format: ie: 20140117) My problem comes when I want to filter the results in the loop. Ideally, I would like to show the events in date order, using the fields one_day_event_date and event_start_date. But I want it to filter older events based on the values one_day_event_date and event_end_date This is the code I have tried so far:               <?php     $currentdate = date("Ymd",mktime(0,0,0,date("m"),date("d")-1,date("Y")));     $args = array(     'post_type' => 'event',     'meta_query' => array(         array(             'key' => 'event_end_date',             'value' => $currentdate,             'compare' => '>',             'type' => 'DATE'         ),         array(             'key' => 'one_day_event_date',             'value' => $currentdate,             'compare' => '>',             'type' => 'DATE'         )     ),     'orderby' => 'meta_value_num',     'order' => 'ASC'     );     $query = new WP_Query( $args ); ?>


Is it possible to remove this action? (as it's added just before it's called)

In wp-signup.php there are these lines:               add_action( 'wp_head', 'wpmu_signup_stylesheet' );     get_header();      I need to remove `wpmu_signup_stylesheet` from the `wp_head` action, but I seem to be struggling, I assume it is because the action is being called straight after. Here is what I've tried from a plugin:               // Called from an action that is added with:     // add_action('wp_head', array($this, 'remove_signup_style', 11));     remove_action( 'wp_head', 'wpmu_signup_stylesheet');


Access tinymce from thickbox

Basically, I have a custom tinymce button which opens a thickbox window in iframe mode. Is there a way to access the tinymce from the iframe? Wordpress media uploader seems to do it somehow. Stuff like `$('#content', window.parent.document).tinymce().getContent()` does not work. Wordpress 3.4.1 Thank you! PS. If that's impossible, I'll have to do use the tinymce default popup window, but Good God it's ugly.


How do I add the same contact form to multiple wordpress sites and capture the response in one place or database?

I own a network of 100+ Wordpress based websites. All website are separate installations of Wordpress and are on different servers. I would like to   1. create one contact form   2. have it shown in the sidebar all of my Wordpress websites and    3. capture the responses in one database (instead of getting 100's of emails).  Ideally the form would be created and hosted in one place and then embedded into the other blogs (via iframe or other method?). That way I'd only have to make changes to the form in one place and have them apply to all sites. I know there are countless plugins for creating contact forms, but none that would seem to address this situation. Any help would be greatly appreciated. Further, I'm not opposed to hiring someone to help with this situation if it's beyond the scope of this websites. All the best, JB


Are there any scripts, classes, and/or functions built-in to WP for a plugin to export/import its saved data from wp_options?

In WordPress, are there any supported 'script plugins', Classes, and/or a WordPress function that will allow a plugin to use to export/import its own data from the database to a txt/json file? A way to assist in handling data for a back-up feature in a plugin. Original the code I have worked on a localhost, but not when I went live, and for various reasons. Initially when this was posted, as Oli had pointed out in his answer, "You cannot do AJAX file uploads. They're not supported but you can fake it." How can I upload files asynchronously with jQuery?. Since then, some more answers have been added. Most of the issues surface when using a form and an ajax function. Especially when a file ($_FILE) is involved. To explain, I'm trying to take the following route **HTTP->JS->PHP(AJAX)->JS(AJAX)->PHP(iFrame)** instead of **HTTP->JS->PHP(iFrame)** by canceling the form submit so that ajax can take over and then have an iFrame created and targeted (btw, is this a design flaw?). Basically I'm in search of something, preferably WordPress supported (script/class/function), to handle data between **JS to PHP** and **PHP to JS**.


Featured image upload finished hook

I'm looking for a way to hook into the process of uploading a featured image. Ideally I would want to be able to do some stuff right when the upload has finished, before the thumbnails are generated. What I wanna do is when the image is finished uploading, the user will be presented with the possibility to resize and crop their image before it's actually set as the featured image. Is this possible, or should I rather be thinking of a custom uploader that I use to later set the finished image as the featured image?


security concerns if using html data-* attribute for l10n?

I need to pass a localized multidimensional javascript object to a page. The object is constructed using php and represents some wp-theme settings. I cant find a way to utilize wp_localize_script for this, as it will not parse multidimensional arrays. Instead I've come up with the solution to use a html5 data-* attribute for this and then using jQuery to retrieve it, hoping for this method to provide x-browser compatibility. So on the page where I need to access the localized data I let php output:               <div id="localized" style="display:none" data-localized='{"user": "Doe", "skills": {"html":5, "css":4, "php":3} }'>      I then get that localized data using:               var my_localazed_data = $('#localized').data('localized');      It works fine. But my concern here is: 1) Is this browser compatible? 2) Are there any security concern to be aware of as compared to using wp_localize_script?


Aptana: WordPress Code Hinting

Does anyone use Aptana for WordPress plugin development? Is there a way to set-up WP code hinting with Aptana? Thank you.


How to assign a post to a post parrent?

I want to be able to add posts to a post parent in wordpress. Is there a way? There is such option for pages but I need it for posts to. Any ideeas? Ty!


Canonicalization issue regarding academic URL vs. blog URL

I'm sorry if what I am about to write is long-winded. I only wish to be clear. I am an academic in the scientific community. I maintain a web site for my research, teaching, and other professional activities. Until recently, the content for this site was hosted in a directory on my university department's own server. The address is of the typical form **(universityname).edu/~(myusername)** I decided that I wanted to use WordPress in order to host and manage my page. So I set up a WordPress.com blog and then replaced the index.html file in **(universityname).edu/~(myusername)** with a new one consisting of a single frame, containing the WordPress.com blog. Now when a user visits **(universityname).edu/~(myusername)** , he or she sees the blog instead. This has been pretty nice because, even when the user clicks on links between pages or posts in the blog, the only thing showing up in the address bar of the browser is **www.(universityname).edu/~(myusername)** , because the blog is constrained to a frame. However, the effect of this change on the search side of things has not been so kind to me. Before, when someone searched for my name in Google, the first result was always **(universityname).edu/~(myusername)**. This is the most desirable outcome, for professional reasons. (Having my academic URL come up first suggests that I am an accredited professional, and not just some crank with a blog!) But now, Google seems to have canonicalized my web presence under the blog's WordPress.com address. It has completely forgotten about my academic URL and considers the WordPress.com address to be the best address representing me on the web. Unfortunately, WordPress.com doesn't support the canonical tag, so I can't tell the blog to advertise itself as my academic URL in the header. (It doesn't seem to help at all that I have used the WordPress.com dashboard to turn on no-indexing of the blog.) One obvious solution would be to use the departmental server to host my content again, and use a local installation of the WordPress platform. For reasons beyond my control, the platform will not be deployed on the departmental server at this time. Another solution would be to use shared hosting with WordPress.org support, because the WordPress.org platform does support the canonical tag (albeit via a plug-in). But this seems to usually require purchasing a domain name and other fees, and there is no guarantee that Google will listen to the canonical tag (it might use whatever domain name I end up with instead). Is there a way I can more cleverly integrate the WordPress.com blog into a page hosted on my department's server? Is there some PHP code I can write to retrieve the blog's contents in a way that Google won't treat as a link / "perceive" the blog? Please note: I am a PHP novice at best. I just feel there should be a simpler solution to all this, within the constraints of what I have described above. Thanks!


How to use multiple query with same meta key

I use these codes to print custom field query. My custom field key is `out_wiki`                   <?php if( get_post_meta($post->ID, "out_wiki", true) ): ?>
                 <a href="http://en.wikipedia.org/w/index.php?search=<?php echo get_post_meta($post->ID, "out_wiki", true); ?>" target="_blank">
              <?php endif; ?>      I want to store multiple values in same custom field key and print them at once. How can I do that?


Issues with wp_enqueue_script and jquery-ui

wp_enqueue_script('jquery-effects-shake');      ..doesn't seem to work, no matter where I put it. I've tried the following and lots of googling:               function my_callback() {         wp_enqueue_script('jquery-effects-shake');     }     add_action('wp_enqueue_scripts', 'my_callback');      and               <?php         wp_enqueue_script('jquery-effects-shake');         get_header();      ?>      Thanks!


How to read configuration file in wordpress or PHP

I am not sure how relevant this is,i am working with Java based web- application, so in some cases we need to define some properties which can be used in entire web application like   1. Google API Key   2. Any other such key value We tend to define a property file with extension .properties and than JAVA API provide a way to read this file, all we need to pass key name to the API and it wil return the value. While working with Wordpress API, i need to have such use case where i want to define such properties so that i can read them where ever i need those values, i am aware that WordPress read data from its config file but not sure how. This is what i am trying   1. Define a file in my theme folder say customProperties   2. Define some key value pairs inside the file and than where i need them, all i need to pass the key and it should return me the value associated with it. I am sure this can be done with the help of DB, but i am looking for file based approach. One option which seems relevant to me is to define those in my theme's `function.php` file any pointer for this?


Deploying to Multiple Servers with WP Stack

I'd like to start using Git as a VCS for our website, and after doing some research, I've decided that Wordpress-Skeleton & WP_Stack would accomplish everything. However, we have 3 servers that each run identical code, but have different database configurations, different data, and different rewrite rules. Using WP-Stack, I know that you can deploy to several servers (as is commented in config/SAMPLE.production.rb & config/SAMPLE.staging.rb), but I don't see any mention of changing database credentials when we deploy. Having little to know understanding of Ruby, I'm having difficulty reading the code and figuring this out for myself. Would any of your lovely chaps have an explanation for me?


Media library not showing all images

I have a photoblog with contents dating back to 2004. I first started using Movable Type then migrated to Wordpress sometime in 2007. I was using a theme that uses post excerpt with link to image thumbnail for the archive pages. My archive pages worked fine using this theme. I recently changed theme and started using featured image for my archive page, which I used the plugin Auto Post Thumbnail to generate post thumbnails from image attached to post. Using the new theme, I have an archive page that shows post thumbnails using the featured image. Archive pages for years pre-2007 shows broken images. Using media library, I noticed my list of attached files stops at year 2007. I checked my server, my pre-2007 files are there, but they're not 'registered' in media library.   1. When updating a post (pre-2007), a duplicate image (whole image, not thumbnail) is re-uploaded to the folder /archive/2013/10. This messed up my file organisation. How do I make Wordpress stop re-uploading a duplicate image?   2. What do I do to make images uploaded pre-2007 (not uploaded using wordpress) to show in the media library? Wordpress version: 3.6.1 Theme: Twenty Twelve (child theme with modifications) Archive page with broken images http://ayutheos.com/2004/ Individual posts shows images just fine e.g. http://ayutheos.com/2004/12/31/sunset-3/ This is driving me crazy! Any help is very much appreciated.


URL Rewrite doesn't work for nested pages

I am using URL rewrite like this page: unexpected problem in url rewrite It works without any problem, but when I try to use the same rules for nested page, it doesn't work. Say, I have two pages named `page-a` and `page-b`. `page-a` is parent for `page-b`. Now I want to catch the passed variable. The URL structure will be:               page-a/page-b/     page-a/page-b/var1/     page-a/page-b/var1/var2/     page-a/page-b/var1/var2/var3/      So, I created three rules. The full code is as follows:               add_filter( 'query_vars', 'wpse26388_query_vars' );     function wpse26388_query_vars( $query_vars ){         $query_vars[] = 'var1';         $query_vars[] = 'var2';         $query_vars[] = 'var3';         return $query_vars;     }          function wpse26388_rewrites_init(){          add_rewrite_rule(             'page-a/page-b/([0-9]+)/?$',             'index.php?pagename=page-b&var1=$matches[1]',             'top' );              add_rewrite_rule(             'page-a/page-b/([0-9]+)/([0-9]+)/?$',             'index.php?pagename=page-b&var1=$matches[1]&var2=$matches[2]',             'top' );              add_rewrite_rule(             'page-a/page-b/([0-9]+)/([0-9]+)/([0-9]+)/?$',             'index.php?pagename=page-b&var1=$matches[1]&var2=$matches[2]&var3=$matches[3]',             'top' );     }     add_action( 'init', 'wpse26388_rewrites_init' );      I am using Rewrite analyzer and the variables get the correct regex values. Now when I go to that page with parameter like `page-a/page-b/10/20`, the parameters are truncated automatically. `get_query_var('var1')` doesn't get anything. So, if I pass 1, 2 or 3 parameter it will always redirect to `page-a/page-b/`. Can anyone point me what I'm doing wrong? I know this regex capture numbers. But I need regex so that anything that comes after `page-a/page-b/` will be captured by the query variables. I hope someone can help me with this too.


WordPress search with quotations returning to homepage

I'm currently trying to debug a problem with a site. When I use our search, it works perfectly fine, unless I try to search with single or double quotation marks. For example, if I search **facebook** , it works fine, but if I search **"facebook"** it returns me to my homepage. The site can be viewed at: http://ccdev.gnof.org/ **The code for searchform.php:**
          <form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
X Close
     <input type="text" id="searchInput" placeholder="Search GNOF" onclick="value=''" style="width:910px;border:0 none;left:50%; margin-left:-475px;top:20px;position:absolute;box-shadow:none;font-family: 'Open Sans Condensed', sans-serif;font-weight:bold;font-size:40px;margin-top:115px;padding:0 20px;height:100px;background:none;" autofocus="true" name="s"/>     <input type="image" src="http://civiccenter.cc/images/search.png" width="12" height="12" id="searchsubmit" value="Search" border="0" />     </form>
Begin typing to search, then press enter.

      **and the code for search.php:**               <?php          /*      */     ?>          <?php get_header(); ?>

Search Results for <?php echo get_search_query(); ?>

                               <?php while ( have_posts() ) : the_post(); ?>

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

Posted to                              <?php //the_time('F j'); ?>                               <?php //the_category(); ?>                                  <?php                             $categories = get_the_category();                             $separator = ', ';                             $output = '';                             $i = 0;                             $catArr = array();                             $exclude = array('Newsroom', 'Our Community', 'Announcement - Urgent', 'Announcement', 'Grants', 'Front Page Large Feature');                             if($categories){                                 foreach($categories as $category) {                                     if(!in_array($category->cat_name,$exclude)){                                         array_push($catArr, $category);                                          }                                 }                                 $len = count($catArr);                                           foreach($catArr as $cat){                                     $output .= 'term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $cat->name ) ) . '">'.$cat->cat_name.'';                                     $i++;                                     if($i < ($len - 1)){                                      $output .= $separator;                                     }                                      }                                           echo($output);                                  }else {                                 echo 'General';                             }                             ?>                                                                                <?php //comments_number('No Comments', 'One Comment', '% Comments' );?>

                         <?php the_excerpt();?>
<a href="<?php echo get_permalink(); ?>">Continue Reading...

                     <?php endwhile;                           // end of the loop. ?>

                         <?php posts_nav_link( ' • ', 'Older Articles', 'Newer Articles' ); ?>

                          <?php include('sidebar-block-our-work.php'); ?>                          <?php include('sidebar-block-receive.php'); ?>

                                           <?php include('sidebar-banner-our-community.php'); ?>                             <?php get_footer(); ?>      Any help would be greatly appreciated!


Unlimited Page Sitemap Link

I am trying to display all the product links (7000+) of woocommerce, but I get a blank result when doing so. When I set `'posts_per_page'` to 2000, it returns a result. More than 2000 returns a blank page               <?php if ( is_woocommerce_activated() ): ?>
<?php _e( 'Product Categories', 'woothemes' ) ?>

                         <?php wp_list_categories( 'taxonomy=product_cat&pad_counts=1&title_li=' ); ?>

<?php _e( 'Products', 'woothemes' ); ?>

                         <?php                             $args = array( 'post_type' => 'product','posts_per_page' => -1 );                             $loop = new WP_Query( $args );                             while ( $loop->have_posts() ) : $loop->the_post();                         ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?>
                         <?php endwhile; ?>
                          <?php endif; ?>


How to wrap oEmbed-embedded video in DIV tags inside the_content?

I am making a Wordpress Theme for a website with video tutorials. I would like to put the video that is embedded in the content (with oEmbed) in a apart div. **An example** The full content (output from `the_content()`) is something like this:

This is an Test of a tutorial. Bla bla bla
      And I would like to get this to:

This is an Test of a tutorial. Bla bla bla


Why content coming from single?

Below is my **single.php** page's code:                 <?php while ( have_posts() ) : the_post(); ?>
         <?php the_title(); ?>
       <?php         if ( in_category( 'salon' ) ) {              get_template_part( 'content', 'salon' );         }           if ( in_category( 'staff' ) ) {              get_template_part( 'content', 'staff' );         }          else {             get_template_part( 'content', 'common' );         }      ?>       <?php endwhile; // end of the loop. ?>       Normally when I open any post it's fine, but when I open a salon page ( **content-salon.php** ) then the content comes out double because the common page ( **content-common.php** ) is loaded as well. **Common page code** :               <?php the_content(); ?>      **Salon page code** :
           <?php           // The Query           query_posts( array ( 'category_name' => 'salon' ) );                // The Loop          while ( have_posts() ) : the_post(); ?>
<a href="#st_content_<?php echo the_slug(); ?>" rel="tab_<?php echo the_slug(); ?>" class="st_tab">             <?php the_title(); ?>
           <?php endwhile;                // Reset Query           wp_reset_query();                ?>

                <?php           // The Query           query_posts( array ( 'category_name' => 'salon' ) );                // The Loop          while ( have_posts() ) : the_post(); ?>                 <div id="st_content_<?php echo the_slug(); ?>" class="st_tab_view">                  <?php the_content(); ?>
                 <?php endwhile;                // Reset Query           wp_reset_query();                ?>
      Normal logic is when a salon category post is opened it will load the **content-salon.php** page and it's loading without any problem but it also loads the common page too... I have no idea why it's loading **content- common.php** as well. Can you guys tell me where I am making a mistake?


Check if current post is the latest (not last)

I'm having problems finding this: I'd like to create a post navigation which checks if the current post is the newest (latest). If it's the latest post it should give older posts as navigation. I have this already working for the 'last' post:               <?php if( ($wp_query->current_post + 1) < ($wp_query->post_count) ) { ?>                SHOW 5 NEWEST POSTS          <?php }; ?>      How do I create the check for the latest post? Thanks in advance!


Invalid characters in user name when registered

I can´t register a user with ñ (español) beacause is invalid character, (i know it) the questions are: are there any functions that allow that? is a server problem or a wordpress problem?


Make jQuery library load before plugin files

I am using a few jQuery plugins such as validate.js, but they all load BEFORE the Jquery library which is loaded automatically by WordPress and my theme. I need the plugins to load after - so is there a way to make Jquery load first in functions.php - so that I can use it frontend and admin. I am currently loading the following in functions.php               wp_enqueue_script('validation',     get_bloginfo('template_url') ."/js/jquery.validate.min.js");          wp_enqueue_script('scripts',     get_bloginfo('template_url') ."/js/scripts.js");      Any help, massively appreciated!


Add javascript when post is published

I am trying to add javascript when a post has been published so that it's more noticable for my user but I can't figure out what to use. I tryed with publish_post and save_post, but it doesn't work unless I put die; at the end of the code. I've tryed so hard to stay out of the wordpress core code, and I really don't want to have to because of this problem... here's my code :               function run_when_post_published($post_ID){         echo '<script type="text/javascript">             alert("essai");         </script>';     }     add_action('publish_slider', 'run_when_post_published');      Thanks for your help !


Don't display html if custom field is empty

I'm using the plugin WP UI on my custom post type to display the content in tabs. I'm doing this in the template for the custom post type not using the shortcode provided by the plugin. I'm also using Advanced Custom Fields for the fields on the custom post type. However sometimes there won't be any content for the custom fields. The page will then display the tab but it will be empty. In my template i have divs that are used to display the content in tabs. So in my template i have the div for the tab and then the custom field.
Videos

                  <?php the_field('videos'); ?>
       Is it possible to hide the tab if there is no content in the custom field? i.e. not output the div so therefore it won't display the tab. Thanks So there's no confusion, the_field is a function used by advanced custom fields to display the contents of the custom field.


Using same slug name for a page and category

I know it isn't good practice but I'm considering using same name slugs for some pages and categories on a site that I'm working on. It's a small site and it doesn't seem to affect anything in particular. I added one slug and page with the same name and they worked fine, but when creating a second WP forced me to rename the page (being created after the category) with an additional "-2" being added to the slug. Is there a particular order to create the pages and categories in order to avoid this? I've created similar structures before without this appearing. Also checked trash for old pages that might be using the original slug.


Update user meta of author when post content is viewed

I have a value that I'm trying to store as user meta for authors on my site. I need it to update itself every time the content of a post is viewed for that author. Here's as far as I've gotten but it isn't storing the value. I use this in functions.php.               function user_score() {         global $bp;         $author_id = $bp->displayed_user->id; // do stuff to get user ID              $author_posts = get_posts( array(           'author' => $author_id,           'posts_per_page' => -1         ) );              $counter = 0;         foreach ( $author_posts as $post )         {           $score = get_post_meta( $post->ID, 'ratings_score', true );           $counter += $score;         }         update_user_meta( $author_id, 'user_score', $counter );         if ($echo)           echo $counter;         return $counter;     }     add_filter('the_content','update_user_score');     function update_user_score($content){       global $post;       user_score();       return $content;     }


Password reset link not working

For some reason, my password reset link on one of my sites is no longer working...it redirects to a 404 page. It's URL /login?action=lostpassword is not working...any ideas on how to fix this? Thanks in advance!


How show sub menu only using wp_nav_menu()

I am using this code to show the custom menu subpages if you are on the parent page. But what this code also shows is a parent page on a page that has no sub menu, which I would like hidden. Basically only use this code if we are on a page that has a sub page,               class Selective_Walker extends Walker_Nav_Menu     {         function walk( $elements, $max_depth) {                  $args = array_slice(func_get_args(), 2);             $output = '';                  if ($max_depth < -1) //invalid parameter                 return $output;                  if (empty($elements)) //nothing to walk                 return $output;                  $id_field = $this->db_fields['id'];             $parent_field = $this->db_fields['parent'];                  // flat display             if ( -1 == $max_depth ) {                 $empty_array = array();                 foreach ( $elements as $e )                     $this->display_element( $e, $empty_array, 1, 0, $args, $output );                 return $output;             }                  /*              * need to display in hierarchical order              * separate elements into two buckets: top level and children elements              * children_elements is two dimensional array, eg.              * children_elements[10][] contains all sub-elements whose parent is 10.              */             $top_level_elements = array();             $children_elements  = array();             foreach ( $elements as $e) {                 if ( 0 == $e->$parent_field )                     $top_level_elements[] = $e;                 else                     $children_elements[ $e->$parent_field ][] = $e;             }                  /*              * when none of the elements is top level              * assume the first one must be root of the sub elements              */             if ( empty($top_level_elements) ) {                      $first = array_slice( $elements, 0, 1 );                 $root = $first[0];                      $top_level_elements = array();                 $children_elements  = array();                 foreach ( $elements as $e) {                     if ( $root->$parent_field == $e->$parent_field )                         $top_level_elements[] = $e;                     else                         $children_elements[ $e->$parent_field ][] = $e;                 }             }                  $current_element_markers = array( 'current-menu-item', 'current-menu-parent', 'current-menu-ancestor' );  //added by continent7             foreach ( $top_level_elements as $e ){  //changed by continent7                 // descend only on current tree                 $descend_test = array_intersect( $current_element_markers, $e->classes );                 if ( !empty( $descend_test ) )                      $this->display_element( $e, $children_elements, 2, 0, $args, $output );             }                  /*              * if we are displaying all levels, and remaining children_elements is not empty,              * then we got orphans, which should be displayed regardless              */              /* removed by continent7             if ( ( $max_depth == 0 ) && count( $children_elements ) > 0 ) {                 $empty_array = array();                 foreach ( $children_elements as $orphans )                     foreach( $orphans as $op )                         $this->display_element( $op, $empty_array, 1, 0, $args, $output );              }             */              return $output;         }     }      in the template using:               wp_nav_menu(         array(            'theme_location'=>'primary',             'walker'=>new Selective_Walker()         )     );


How to remove and disable access to General Settings Page including its link on the Settings Tab and add a new link as General Settings?


Am getting duplicate data from get_posts()

Am trying to display posts only from the "latest" category on my wordpress blog but am strangely getting the same post displayed twice. What am i doing wrong? ![enter image description here](http://i.stack.imgur.com/RrHXz.gif)               /*     * Theme file:index.php     */         global $post;         $categories=get_categories();         foreach($categories as $categories_item)         {             if(strcasecmp($categories_item->name, 'latest') == 0)//case-insensitive string comparison             {                 $args = array(                 'numberposts'     => 2,                 'category'        => $categories_item->cat_ID,                 'orderby'         => 'post_date',                 'order'           => 'ASC',                 'post_status'     => 'publish'                 );                     $latest_stuff = get_posts( $args );                     echo "
Latest stuff
";                     foreach($latest_stuff as $latest_stuff_item)                     {                         setup_postdata($post);                         echo "
".the_content()."

";                     }                }         }


Wordpress get number of categories

I have a page of multiple categories (mysite.com/?cat=1,2,3,4). My archive template shows the name of the selected category as a heading. Now I have four categories, but only the name of the first shows up. Instead, I'd like to check if more than one category is selected and then show no heading. So, how do I find out how many categories are selected? (-> This needs to work outside the Loop)


Data URI in custom fields

My theme has an option to specify the thumbnail using custom fields. post_thumbnail - http://domain.com/uploads/xx/xx/mythumbnail.jpg I would like to use data uri instead of the the image in the custom field. How can this be done? The reason I want to do this is to reduce the http request on the blog page and the portfolio page. Thanks :)


Sort pod by fields

I'm using Pods plugin (ver 2.2) to create some 'Pods' or Advanced Content Types, as they would refer to it. I created a pod called dj's. I've added three 'cattegories' at dj's called by the stage they're performing (Mainstage, outdoors, club). So in each stage there are other dj's playing. So what I'm trying to do is display those dj's by the stage they're playing.               <?php     $djs = pods('djs');     $djs->find('name');         ?>
     <?php     while ( $djs->fetch() ) :     // set our variables     $name= $djs->field('name');     $permalink= $djs->field('permalink');     ?>
<?php echo $name; ?>
     <?php endwhile; ?>


WooCommerce image output customization

How can I size the product thumbnails differently than the size shown on the checkout page ? ( I want the product thumbs to be square, and the ones on the checkout page to remain vertically oriented ). A link to the site can be found here : www.seekoften.com/eCommerce I have the plugins "simple image sizes" and "regenerate thumbs", but if I change the thumbnails settings in there, it affects the "thumbnails" globally. Is there a way I can customize the output of the thumbnail image sizes on the "single-product page" ( to be square, about 200x200 ) and independent from the image size shown at the checkout page ? I was able to accomplish this custom image sizing for the "mini-cart", and "cart" pages by using this code :               $thumbnail = apply_filters( 'woocommerce_in_cart_product_thumbnail', $_product->get_image(array( 50, 150 )), $values, $cart_item_key );       For the cart.php page, and this one on the mini-cart page: `<?php echo $_product->get_image( array( 50, 100 ) ); ?>`


Changing RSS feed URL structure

I am in the process of creating a wordpress website, and I just have one issue left - RSS feeds. Currently, the website has a `.htaccess` file blocking access to `/category/*` pages. It was part of a requirement that the site is not obviously Wordpress, and `/category` is a decent indicator of that. Each category is fronted by a page, which displays the category content - so `/category/news` becomes `/news`. However, RSS feeds always seem to point to `/category/xxx/feed` - is there a way to remove this `/category/` part? So people could view the RSS feed at `http://example.com/news/feed` ? I've tried fiddling around with the `.htaccess` file, but it's the one area of building a web application I'm not 100% sure on. Every search has returned with results of how to point a feed to Feedburner instead, which is not what I am looking to do at all.


Using Custom Value Options in PHP

I'm currently using a custom field called "Developing" to show whether or not a news story is a developing story. The custom field has a couple of values: a blank option (meaning it is not developing), "Yes," and "Was Developing." This is the code I use to display the word "Developing" in front of a news story title:               <?php if (get_meta('developing') != "") { ?>Developing: <?php } ?>      While it shows "Developing" when I've hit Yes, it also shows "Developing" when I change the option to "Was Developing." I'm assuming this is because I'm calling up the entire thing and not distinguishing between its options in the coding. Does anyone know if I can even do this? For example, can you have different messages show for each option? Something like using "developing's yes option means show this" instead of just "developing means this" like above? Thank you!


List all recent post by categories at the front page (WordPress MU)

I'm looking how can I put on the network homepage all recent post of my WPMU Network. I tried that script but there are not so much informations (I want the same presentation such as a normal post) :                      <?php     $blogs = get_last_updated();          foreach ($blogs AS $blog) {          switch_to_blog($blog["blog_id"]);     $lastposts = get_posts('numberposts=1');     foreach($lastposts as $post) :     setup_postdata($post);     ?>          <a href="<?php the_permalink(); ?>" style='color:white !important;'><?php the_author(); ?>           - <a href="<?php the_permalink(); ?>" style='color:white !important; margin-bottom: 5px;'><?php the_title(); ?>

          <?php     endforeach;     restore_current_blog();     }     ?>      I also bought this plugin but it's not too powerful.


Add Lightbox To WordPress Native Gallery

Is there a way to check if a gallery is linked to an attachment page or to an image file via jQuery or WP filter? I'm trying to add a lightbox to gallery image that is linked to image file. But I can't do it since there's no way to tell the difference between image linked to attachment page or image file in the html codes generated by WordPress.


Remove a message in login page

Under the login page of Wordpress, I have a message saying: > "Only registered and logged in users are allowed to view this site, please > login". The problem is that I am **not** running an English installation of WordPress, and that this message is displayed in English. How can I remove this message or translate it? Under my element inspector, it is appearing like:
Only registered and logged in users are allowed to view this site. Please login now

      I dont know where the code responsible of generating this, also, if it is a core file, I am avoiding touching it. **Question:** How can I use a code in `functions.php` to hide this message or translate it?


Removing Image Attributes

right now my images are outputting like this when I add them to my posts:                     I am using this code to add the highslide rel and class attributes to the image:                   function add_highslide_attr( $html ) {         preg_match_all('/(]*>)(.*)/i', $html, $result);              if( !isset($result) || !isset($result[1][0]) || ! $result[1][0] )             return $html;              $anchor = $result[1][0];              if( strstr($anchor, 'rel=') )             $anchor = str_replace('rel="', 'rel="highslide ', $anchor);         else             $anchor = str_replace('href=', 'rel="highslide" href=', $anchor);              if( strstr($anchor, 'class=') )             $anchor = str_replace('class="', 'class="highslide ', $anchor);         else             $anchor = str_replace('href=', 'class="highslide" href=', $anchor);              $html = $anchor . $result[2][0];              return $html;     }     add_filter( 'image_send_to_editor', 'add_highslide_attr', 10 );      I was wondering if anyone knew how to remove the class part and its attributes from the image tag (the `class="aligncenter size-full wp-image-31055"` part). It would also be cool to remove "domain.com" as well. I've researched this issue for several hours now and the code I've found hasn't worked, so I thought I would ask here. Thank you!


Adding A Login Fail Notice

Im using a custom login page using the wp_login_form tag. I am also using this code below to redirect back to itself if failed login and change the url. How can i add a here also to show when failed login.               add_action( 'wp_login_failed', 'my_front_end_login_fail' );      function my_front_end_login_fail( $username ) {       $referrer = $_SERVER['HTTP_REFERER'];         if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) {        wp_redirect( $referrer . '?login=failed' );         exit;      }}


Unwanted Product Name Appearing Above Category on Main Shop Page

Have just created this shop and still getting used to woocommerce. On the above link, above the category headings and images, are the words "Backsaver – Classic RV Towaid" which is the first item listed in the first category. I don't wan't this appearing here, instead on each page I want it to show what category the shopper is in. So on the main page shop front I just want it to stay "Store" or something similar, and then on the Accessories category page I want it to say Accessories. How can I get it to do this? Where do I need to edit and what do I need to put in?


URL rewrite in theme doesn't seem to be working

so I was asked to create url rewrites for one of the websites we're working on, but the thing is the test rewrite I did, just to try it out, is not really working. here's the code I put in the functions.php file of the theme, to do url rewrites;               add_action( 'init', 'initialize_my_theme' );     function initialize_my_theme() {         register_nav_menu('primary','MainMenu');         add_filter( 'query_vars', 'campedia_set_query_vars' );     }          function campedia_set_query_vars( $vars ) {         //array_push( $vars, 'learner_id' );         return $vars;     }          function campedia_activate() {         // register taxonomies/post types here         flush_rewrite_rules();         add_rewrite_rule('^nutrition/.+','view-profile/#','top');     }     register_activation_hook( __FILE__, 'campedia_activate' );          function campedia_deactivate() {         flush_rewrite_rules();     }     register_deactivation_hook( __FILE__, 'campedia_deactivate' );      now I know you can't just take the examples from the wordpress site and expect everything to work - [cos their examples almost never work for the complicated stuff] - but I got practically all of this code from their website and it's not working, this is the third thing I tried and each time I'm just redirected to the home page. why?!


When activating a child theme, what core settings have to be reset ie; Custom Menus etc?

When activating a child them I often have to reset custom menus. The menus themselves are still created but just have to be activated again. Is there a list of settings which are often unset when a child theme is activated? This isn't about theme settings, but core settings in WordPress


How to create Network of websites with separate database in WordPress

I have 3 websites in WordPress with different databases and themes. For example:   * `www.example.com`,   * `www.example2.com`,   * `www.example3.com` Now I want to create multinetwork of sites, means:   * `www.example.com/example2`, and   * `www.example.com/example3`. So please tell me how is it possible.


Error checking when future updates are automatic

When WordPress 3.8 released, I upgraded most of my sites. However, there is a nagging question in the back of my mind. Will the WP auto update process check whether all the plug-ins are working with the update or will it proceed without that check? In which case how do I stop the auto updates for sites which I know are having plug-ins which may not work with the later versions of WP.


How to toggle a div element between two images when click two submit buttons in a wordpress loop?

How to toggle a div element between two images in a wordpress loop when click two submit buttons simultaneously? I have one div, 1st image should select when i click on the first submit button and then 2nd image while click 2nd button. Now this is coming only for the first post.
                      <?php while ( have_posts() ) : the_post(); ?>
         <?php   the_post_thumbnail(); ?>

                   <?php if (class_exists('MultiPostThumbnails')) :                            MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'secondary-image');                   endif; ?>
             <input type="button" value="" id="btn1" style="background:yellow;" />            <input type="button" value="" id="btn2" style="background:green;"/>                           <?php endwhile; // end of the loop. ?>
        jquery


What are the steps + prerequisites for using an add_filter?

Hey all I'm a WP noob and I have the task of cleaning up the mess other people left when they edited plugin cores. To my understanding, there are such things called filters in WP. I am not sure how to use them though or how they work. For this example below (copied from a tutorial):               function remove_footer_admin () {     echo 'Fueled by WordPress | Designed by Uzzz Productions | WordPress Tutorials: WPBeginner
';     }          add_filter('admin_footer_text', 'remove_footer_admin');      What is going on? So we are overwriting the `admin_footer_text` function? In this case, it's a function from the admin section. To my current understanding (tell me if I'm wrong please), the admin section has loads of default WP functions that are executed in a certain order. This `add_filter` that uses `remove_footer_admin` will be called as an after hook. So whatever WP functions run before `admin_footer_text` will run accordingly, then `admin_footer_text`, then `remove_footer_admin`, then whatever WP functions that usually run after `admin_footer_text`. Is this correct? Also, it seems like add_filter can only be added sometimes? I don't get what the conditions are. Could you please explain in what situation I can use it?


pretty permalink for filtered posts

I am working on a personal book store. I have made CPT " **Book** " and Author as it’s custom **Taxonomy, Author**. Its just like another book site with usual categories like like Suspense , Horror, Comic etc _mydomain.com/books/suspense/_ -> all books from suspense category will show in archive. And made taxonomy archive page as well which going to show all of the books written by specific author Eg: _mydomain.com/author/author-name_ / all books which are related to this taxonomy term. And I have printed Author in bottom of the page , “ **Filter Result by Author** ”, in which I want to filter out only suspense ( if suspense is current category ) by selected author. And want to generate pretty permalink like… Eg: _mydomain.com/author/author-name/suspense/_ -> and show all books by author in this category… with pretty permalink.. ( sorry I am so confused ). thanks in advance.


Archive posts on showing current page instead of archive

I have tried to create an index page of all my blogs on a menu link: Blog I created a new page: Blog (id:267) I copied archive.php to page-267.php Yet, when I view this page, it only shows one result - the Blog Page - why is it not listing all blogs in the archive like the archive page should? What am I missing?


Check if Current Category has Children

I need to tell whether or not the current custom taxonomy archive page I'm viewing has child categories. I've got a situation where there are a lot of custom categories with children and the site is only to show posts at the end of the line. Otherwise it should show a link to the category that's the next step down. I've found this snippet, but it doesn't seem to work for custom taxonomies.               function category_has_children() {     global $wpdb;        $term = get_queried_object();     $category_children_check = $wpdb->get_results(" SELECT * FROM wp_term_taxonomy WHERE parent = '$term->term_id' ");         if ($category_children_check) {             return true;         } else {            return false;         }     }             <?php         if (!category_has_children()) {             //use whatever loop or template part here to show the posts at the end of the line        get_template_part('loop', 'index');             }                 else {            // show your category index page here         }     ?>


Custom Metaboxes, multiple post selection

I have the following custom meta-box, which works to list a post type, I simply want to allow multiple values to be selected but cannot get it to work, it appears if I tell the select to store multiple and set the name to be an array Wordpress does not store any value. http://pastebin.com/VLQGZjmu After hours of trying with different meta-boxes I realise I must be close but am clearly missing something. Many thanks in advance.


Adding nav menu name from plugin options dynamically

I have added my custom nav menu by this way.               function add_last_nav_item($items) {         return $items .= '
More
';     }     add_filter('wp_nav_menu_items','add_last_nav_item');      Now I want to pull "More" from plugin options like               return $items .= '
$nav['menu_position']
';      where $nav is custom stored value               $nav['menu_position'];


Text of posts is suddenly not visible anymore

(WordPress 3.8 running Twenty Eleven theme.) http://www.joyofdata.de/blog/ I just realized that neither on the Wordpress homepage nor after opening a post I can see any text. If I click on edit though or choose a post from the manager then everything seems alright. Everything is in place, including the title of the posts. Just the text of a post is not visible on the blog. If I remember correctly this issue is no direct result of the latest Wordpress update. I don't even have an idea right now where to look for the reason.


Put password on a wordpress link in a article

I've trying to find out how to do this in wordpress and I've searched the web, but I can't find any easy way to make my visitor only see one link if they enter a password to be able to see it. Is there any plugin or solution that could do that ?


How to show all CPT posts in one page?

How can I show all the CPT ( Custom Post Type ) posts in one single page? I can view a single CPT post using single-{CPT name}.php file but I am unable to use the archive-{CPT name}.php I have a CPT as DProject and lets say I have one CPT post SPINNER www.localhost.com/DProject/SPINNER is visible just like single post but what I want is www.localhost.com/DProject to show all the CPT posts in one single page just like default post using index.php and the loop. Please Help.


WordPress Media Uploader Attachment Sizes

I have added WordPress new media uploader to my theme metabox options. It works well but when I click on an image within the media uploader, I do not get attachment sizes while in "select" frame. I don't want "post" frame media uploader with left sidebar to manage galleries, just the uploader with attachment sizes. Anyone know how can I control this? This is how I implement the new media uploader:                  // activate upload button     var file_frame;     $('.fusion-upload-button').live('click', function(e) {         e.preventDefault();              upid = $(this).attr('data-upid');              if($(this).hasClass('remove-image')) {             $('.fusion-upload-button[data-upid="' + upid + '"]').parent().find('img').attr('src', '').hide();             $('.fusion-upload-button[data-upid="' + upid + '"]').parent().find('input').attr('value', '');             $('.fusion-upload-button[data-upid="' + upid + '"]').text('Upload').removeClass('remove-image');                  return;         }              if ( file_frame ) {           file_frame.open();           return;         }              file_frame = wp.media.frames.file_frame = wp.media({             title: jQuery( this ).data( 'uploader_title' ),             button: {                 text: jQuery( this ).data( 'uploader_button_text' ),             },             multiple: false  // Set to true to allow multiple files to be selected         });              file_frame.on( 'select', function() {             var selection = file_frame.state().get('selection');                 selection.map( function( attachment ) {                 attachment = attachment.toJSON();                      $('.fusion-upload-button[data-upid="' + upid + '"]').parent().find('img').attr('src', attachment.url).show();                 $('.fusion-upload-button[data-upid="' + upid + '"]').parent().find('input').attr('value', attachment.url);             });                  $('.fusion-upload-button[data-upid="' + upid + '"]').text('Remove').addClass('remove-image');             $('.media-modal-close').trigger('click');         });     });


Plugin to Display Content on Page

I am creating a plugin in which I will need to display content on a page. I have seen plugins that allow an administrator to put something like [display- content] in the visual editor which displays the plugin content to a website visitor. How is this done?


Is there a function to add additional options to the Twentyeleven option page?

I would like to add additional options like footer text to the Twentyeleven options page via child theme. I know how to create theme option page but if possible I would like to use the one that comes with Twenty Eleven. If not how can I unhook this option page and create my own?


WP Google Fonts question

I'm using Google Webfonts on my Wordpress site (WP Google Fonts plugin) and was wondering whether those fonts are stored on Google server or are uploaded from the server my website is on? I love some of those fonts, but in my case no love could stand the test of few hundred kilobytes each time someone visits my website. Thanks in advance for your help.


Enabling free shipping on Woo Commerce by specific items

I would like to know if it is possible to enable free shipping with Woo Commerce only if certain items (or items of certain categories / shipping classes) are included in the cart. The Free Shipping option only activates on the basis of cart value or via a coupon code so I investigated Flat Rate shipping and discovered that it prioritises the most expensive shipping class over the cheaper ones. This means the free shipping class I created never overrides the default charge. I understand the logic behind this but it's the opposite of what I need as the idea is to incentivise purchases of higher profit margin products by eliminating delivery charges when they're included in an order. I don't know if what I am trying to achieve is simply not possible within Woo Commerce. A coupon that only applies to certain products / categories seems to be the closest I can get but I'd rather not force users to enter a code at checkout. Does anybody know if there any simpler ways to give users who purchase certain products free shipping?


Embedding BitBucket Code in Posting

I want to embed my code at BitBucket in wp post, anyone can suggest me, a good plugin or anytrick to do it?


how to only have one custom post type post?

Is it possible to limit a CPT to just one? What I'd like to accomplish is creating a CPT called "Home". It will manage any and all elements on the home page. I want to program it so when the user clicks on the "Manage Home Page" link they will go straight to the edit post screen. They will skip over the "All Post" screen. Does anyone think this is even possible? Or maybe someone has an idea to accomplish this goal a completely different?


Plugins in mu-plugins folder are not loaded

I'm trying to load plugins automatically by putting the plugins into `mu- plugins` folder. But if the plugin is put in a folder, it isn't loaded. I tried some popular plugins such as W3 Total Cache, WordPress SEO By Yoast, but all of them are not loaded. Does WordPress only loads plugins which are just single files in `mu-plugins`?


wordpress header leaks into body in a specific template

very strange problem, that happens only in one specific template. part of the part "leaks" into the tag - and I can't figure out why. the "header.php" code:               <!DOCTYPE html>                      <meta charset="utf-8" />       <meta http-equiv="X-UA-Compatible"  content="IT=edge,chrome=IE8">       <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> <?php } ?> <?php wp_title(); ?></title>       <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />               <meta name="description" content="****" />        <meta name="keywords" content="****" />              <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />       <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />       <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />       <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />       <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />       <?php wp_get_archives('type=monthly&format=link'); ?>       <?php wp_head(); ?>

         <li style="zoom:1" class="<?php if (is_home()) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="<?php bloginfo('url'); ?>" title="Home">ראשי
         <?php wp_list_pages('title_li=&depth=1'); ?>
                     the template code (the relevant part):                       <?php get_header(); ?>     <?php get_sidebar(); ?>
                   <?php if (have_posts()) : while (have_posts()) : the_post(); ?>             <div class="post" id="post-<?php the_ID(); ?>">
<?php #the_title(); ?>

                     <?php the_content('
Continue reading »
'); ?>                          <?php //if page is split into more than one                         link_pages('
Pages: ', '
', 'number'); ?>

           <?php endwhile; endif; ?>
      the leaking part is everthing after the link rel="prev" be glad for any help with this


Wordpress plugin form not saving data

I am learning development of plugins, I am stuck into saving the plugin options form data. I have a plugin options page, where three fields asking for number of videos, height and width are coded. When I enter the values into it, and hit on save its just saving one value, that is, number of videos. Here is my code                   <?php     add_action('admin_init', 'ozh_sampleoptions_init' );     add_action('admin_menu', 'ozh_sampleoptions_add_page');          // Init plugin options to white list our options     function ozh_sampleoptions_init(){         register_setting( 'ozh_sampleoptions_options', 'ozh_sample', 'ozh_sampleoptions_validate' );     }          // Add menu page     function ozh_sampleoptions_add_page() {         add_options_page('Youtube Video Settings', 'Youtube Video Settings', 'manage_options', 'ozh_sampleoptions', 'ozh_sampleoptions_do_page');     }          // Draw the menu page itself     function ozh_sampleoptions_do_page() {         ?>

Youtube Video Setting Options
             <form method="post" action="options.php">                 <?php settings_fields('ozh_sampleoptions_options'); ?>                 <?php $options = get_option('ozh_sample'); ?>

No of videos:	                         <input type="text" name="ozh_sample[sometext]" value="<?php echo $options['sometext']; ?>" />

Height:	                         <input type="text" name="ozh_sample[hgt]" value="<?php echo $options['hgt']; ?>" />

Width:	                         <input type="text" name="ozh_sample[wid]" value="<?php echo $options['wid']; ?>" />

                 <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
             </form>
         <?php             }          // Sanitize and validate input. Accepts an array, return a sanitized array.     function ozh_sampleoptions_validate($input) {         // Our first value is either 0 or 1         //$input['option1'] = ( $input['option1'] == 1 ? 1 : 0 );              // Say our second option must be safe text with no HTML tags         $input['sometext'] =  wp_filter_nohtml_kses($input['sometext']);         $input['hgt'] =  wp_filter_nohtml_kses($input['hgt']);         $input['wid'] =  wp_filter_nohtml_kses($input['wid']);              return $input;     }         $myoptions = get_option( 'ozh_sampleoptions_options' );      echo 'Niraj';     echo $options['sometext'];          ?>      Its not saving height and width. I know I have to work on `<input type='hidden' name='page_options' value='vidNO'/>` code, but not getting it, Can anyone help me in this???


Problem using the word "RSS" as a tag

I'm using RSS as a tag for some of my blog posts, and I was using them without any problem.               myblog.com/tag/rss/      But I've just realised that Google Webmaster Tools gives me some related errors. The issue is this: when trying to retrieve the feed of this tag, from               myblog.com/tag/rss/feed/      it gets redirected to               myblog.com/tag/feed/      And this gives an error. Anyone knows how to solve it? Thanks!


How to wp_enqueue_script jQuery inside a Plugin

I would like to use jQuery in my Wordpress plugin. I'm trying to load the jquery library using the enqueue script but its throwing an error. _Error: $ is not a function_ Here's the code snippet that's inside my main plugin.php file...               function ($post)     {         wp_enqueue_script('jquery');         ?>         <script type="text/javascript">         function doTestParse(searchString){             var rx = new RegExp('(?![^<]+>)'+searchString, "gi");             $(this).html($(this).html().replace(rx, '<b>$&</b>'));         }         </script>     <?php ?>


Comment Link from get_comments()?

I've got to update a bit of sloppy code that shows the 5 most recent comments across the entire blog. The code is using WordPress' `get_comments()` method, which doesn't appear to return comment id's, or comment links (direct links to comments within posts via the hash-tag). How can I collect more information about the particular comments, and make them links to the actual comments within their parent pages?
Recent Comments

     <?php $comments = get_comments(array('status'=>'approve','number'=>'5')); ?>     <?php foreach ($comments as $comment): ?>       <?php $post = get_post($comment->comment_post_ID, 'OBJECT'); ?>
<?php print $comment->comment_author; ?> on            <a href="<?php print get_permalink($post->post_ID); ?>">             <?php print $post->post_title; ?>
     <?php endforeach; ?>
      This is located on the front page of the site, outside of the loop.


A tool to analyze rewrite rules?

Is there a good tool to analyze my rewrite rules? I always get confused with the regexes and the parameter replacements. _I have created something myself and will post it here so others can use it, but please feel free to add other tools!_


How can I control the Facebook like image?

I have a blog with some posts, and each post has a embedded Facebook like button. Pressing the button opens a dialog so my visitors can share the post on Facebook with a comment. When sharing, however, the image selected by Facebook is a generic mail icon and not the post thumbnail. How can I control the image that is used when sharing?


Landing Page - Redirect Loop?

Recently this solution was given (Thanks Mr.D), for this Wordpress redirect to landing page if not logged in thread               <?php     if($_SERVER['REQUEST_URI'] != '.../' || $_SERVER['REQUEST_URI'] != '.../'){          if(!is_user_logged_in()) {     wp_redirect( 'http://www.mysite.com/landingpage', 301 ); exit;     }     }      I recently tried this piece of code and it works if i substitute say "http://www.google.com" However, if I substitute it with mydomain.com/landingpage i get a redirect loop error. Any ideas? Thanks!


How to model a hierarchy for courses, levels and lessons?

I'm a bit of a wordpress noob and I'm diving head first into a course creation plugin. The structure will go **program > course > level > lesson**. Right now I have lessons set up as a custom post type and levels, courses and programs are taxonomies. Basically I could use help creating a navigation path where you first pick a program, then a course, then a level, then a lesson. I'm racking my brains and I'm kinda stuck. Like I said I'm pretty new to Wordpress and php for that matter... Is this a viable way to go about this by using a custom post types and taxonomies and does anyone have any suggestions or resources? I'm not sure if I should go about creating a custom theme template file for this either, or just use a shortcode in a page for the navigation.                                Program                         |                        / \                       /   \                  Course1 Course2                     /\     /\                    /  \   /  \                  Lv1 Lv2 Lv1 Lv2                 /\   /\   /\   /\               Lessons Lessons Lessons      Below is what I have so far (Sorry, it's quite long). It works well, I just haven't quite figured out how to organize it yet. Below I've just set up the custom post type and taxonomies. That's about it               <?php     /**      * Plugin Name: Course Manager      * Description: Creates Programs, Courses, Levels and Lessons      * Version: The Plugin's Version Number, e.g.: 0.1      */     ?>     <?php     function cm_lesson_cp(){       $labels = array(         'name'               => _x( 'Lesson', 'post type general name' ),         'singular_name'      => _x( 'Lesson', 'post type singular name' ),         'add_new'            => _x( 'Add New', 'Lesson' ),         'add_new_item'       => __( 'Add New Lesson' ),         'edit_item'          => __( 'Edit Lesson' ),         'new_item'           => __( 'New Lesson' ),         'all_items'          => __( 'All Lessons' ),         'view_item'          => __( 'View Lesson' ),         'search_items'       => __( 'Search Lessons' ),         'not_found'          => __( 'No Lessons found' ),         'not_found_in_trash' => __( 'No lessons found in the Trash' ),          'parent_item_colon'  => '',         'menu_name'          => 'Lessons'       );       $args = array(         'labels'        => $labels,         'description'   => 'Enter a lesson description here.',         'public'        => true,         'menu_position' => 4,         'supports'      => array( 'title', 'editor', 'excerpt'),         'has_archive'   => true,       );       register_post_type( 'lesson', $args );        flush_rewrite_rules( false );     }     add_action( 'init', 'cm_lesson_cp' );          //Custom messages for custom post type`          function lesson_messages_cp( $messages ) {       global $post, $post_ID;       $messages['lesson'] = array(         0 => '',          1 => sprintf( __('Lesson updated. View Lesson'), esc_url( get_permalink($post_ID) ) ),         2 => __('Custom field updated.'),         3 => __('Custom field deleted.'),         4 => __('Lesson updated.'),         5 => isset($_GET['revision']) ? sprintf( __('Lesson restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,         6 => sprintf( __('Lesson published. View Lesson'), esc_url( get_permalink($post_ID) ) ),         7 => __('Lesson saved.'),         8 => sprintf( __('Lesson submitted. Preview Lesson'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),         9 => sprintf( __('Lesson scheduled for: %1$s. Preview Lesson'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),         10 => sprintf( __('Lesson draft updated. Preview Lesson'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),       );       return $messages;     }     add_filter( 'post_updated_messages', 'lesson_messages_cp' );               // Register Program Taxonomy               function program_taxonomy_cp() {       $args = array();       register_taxonomy( 'program', 'lesson', $args );     }          add_action( 'init', 'program_taxonomy_cp', 0 );          // Customize taxonomy          function program_taxonomy_setting_cp() {       $labels = array(         'name'              => _x( 'Program', 'taxonomy general name' ),         'singular_name'     => _x( 'Program', 'taxonomy name' ),         'search_items'      => __( 'Search Programs' ),         'all_items'         => __( 'All Programs' ),         'parent_item'       => __( 'Parent Program Category' ),         'parent_item_colon' => __( 'Parent Program Category:' ),         'edit_item'         => __( 'Edit Program Category' ),          'update_item'       => __( 'Update Program' ),         'add_new_item'      => __( 'Add New Program' ),         'new_item_name'     => __( 'New Program' ),         'menu_name'         => __( 'Programs' ),       );       $args = array(         'labels' => $labels,         'hierarchical' => true,       );       register_taxonomy( 'program', 'lesson', $args );     }     add_action( 'init', 'program_taxonomy_setting_cp', 0 );               // Register Course Taxonomy               function course_taxonomy_cp() {       $args = array();       register_taxonomy( 'course', 'lesson', $args );     }          add_action( 'init', 'course_taxonomy_cp', 0 );          // Customize taxonomy          function course_taxonomy_setting_cp() {       $labels = array(         'name'              => _x( 'Course', 'taxonomy general name' ),         'singular_name'     => _x( 'Course', 'taxonomy name' ),         'search_items'      => __( 'Search Courses' ),         'all_items'         => __( 'All Courses' ),         'parent_item'       => __( 'Parent Course Category' ),         'parent_item_colon' => __( 'Parent Course Category:' ),         'edit_item'         => __( 'Edit Course Category' ),          'update_item'       => __( 'Update Course' ),         'add_new_item'      => __( 'Add New Course' ),         'new_item_name'     => __( 'New Course' ),         'menu_name'         => __( 'Courses' ),       );       $args = array(         'labels' => $labels,         'hierarchical' => true,       );       register_taxonomy( 'course', 'lesson', $args );     }     add_action( 'init', 'course_taxonomy_setting_cp', 0 );               // Register Custom Taxonomy "Level"               function level_taxonomy_cp() {       $args = array();       register_taxonomy( 'glossary', 'term', $args );     }          add_action( 'init', 'level_taxonomy_cp', 0 );          // Customize taxonomy          function level_taxonomy_setting_cp() {       $labels = array(         'name'              => _x( 'Levels', 'taxonomy general name' ),         'singular_name'     => _x( 'Level', 'taxonomy name' ),         'search_items'      => __( 'Search Levels' ),         'all_items'         => __( 'All Levels' ),         'parent_item'       => __( 'Parent Level Category' ),         'parent_item_colon' => __( 'Parent Level Category:' ),         'edit_item'         => __( 'Edit Level Category' ),          'update_item'       => __( 'Update Level' ),         'add_new_item'      => __( 'Add New Level' ),         'new_item_name'     => __( 'New Level' ),         'menu_name'         => __( 'Levels' ),       );       $args = array(         'labels' => $labels,         'hierarchical' => true,       );       register_taxonomy( 'level', 'lesson', $args );     }     add_action( 'init', 'level_taxonomy_setting_cp', 0 );


Post type child of another post type

This may be a stupid question but is it possible to have a post type child of another post type? Let me explain with an example: I created 2 post types, "Actors" and "Galleries". What i want is to create a new actor like "Winona Ryder" and a new gallery like "Winona Pictures". The adress in the browser bar should be; www.mysite.com/actors/winona- ryder/galleries/winona-pictures Also this should affect breadcrumbs as well. I guess i have to play around with permalinks. Can anyone take a look at this and tell me if this is possible? Many thanks in advance. And sorry for any bad English


Advanced Custom Fields Repeater sorting by category

Basically in my ACF repeater I have a select field and I want to display the content in sections that relate to the value of the select field..? Example: In the select field I have four options.. - Opt1 - Opt2 - Opt3 - Opt4 and if I select - Opt2 i want to call all content with - Opt2 selected and put it in its own div.. any help?


Text Widget in Footer for just 1 page template

I am building a wordpress website and I want to show a text widget in the footer just for one page template. That widget shouldnot be seen for other pages. Is there any possible way for that?


A friend wants to make a comment on one of my articles, she has to be logged to wordpress?

I have a friend, she does not have a blog or uses WordPress, she wants to drop a comment on one of my articles. Does she has to open a WordPress account? The blog demands a password to drop a comment?


Most elegant way to create html for shortcodes?

Shortcodes seems to be very nice way to introduce complex features to the content blocks, but I don't like to generate html inside shortcode function. Instead I would like to create template file for the shortcode in plugin's view folder, that could be overridden by theme (even in parent/child context). Is there suitable solution for this or should I try to use include or get_template_part function with output buffering? **UPDATE** In practice I have a shortcode (e.g. [membership_information]), that outputs membership information in shortcode hook function about user:               function shortcode_membership_information($atts) {       // Some code ...       $output = '
';       $output .= '
' . esc_html($membership['display-name']) . '
';       $output .= '
' . $membership['due-date']->format('D, m Y') . '
';       $output .= '
' . $membership['start-date']->format('D, m Y') . '
';       $output .= '
';       return $output;     }      I think this approach is cumbersome, error prone and not easily specialized for site-spesific use (if the html code should be modified). What I basically would like to do, is to use somekind of template for this like:               function shortcode_membership_information($atts) {       // Some code ...       $tpl = get_template('membership-information');       $tpl->set('name', $membership['display-name']);       $tpl->set('due-date', $membership['due-date']);       $tpl->set('start-date', $membership['start-date']);       return $tpl->fetch();     }      It would be nice, that the default template implementation would be located inside the plugin, but it could be overridden inside a theme. What I would like to know If there is a mechanism to achieve this kind of feature in WordPress. Thanks


Function to call the attachment image from post

Hey everyone, I can't se the image of the post (it is attached through gravity form as a post-image) with this function I see the missing image icon with the title and the working link but no thumbnail image.? It is suposed to be more or less ( authors last 2 posts in the widget area) I suspect the problem is here :               $output .= '';      So please help me out :D               function get_related_author_posts() {     global $authordata, $post;          $authors_posts = get_posts( array( 'orderby' => 'rand', 'author' => $authordata->ID,      'post__not_in' => array( $post->ID ), 'posts_per_page' => 2 ) );          $output = '
' . "\n";     foreach ( $authors_posts as $authors_post ) {         $output .= '
ID ) . '" title="' .      apply_filters( 'the_title', $authors_post->post_title, $authors_post->ID ) . '">';         $output .= '';         $output .= '
' . "\n";     }     $output .= '
';          return $output;     }


404 Errors due to Tags Getting Converted to Categories

I am having problems on my site thehardtackle.com - webmastertools reports thousands of 404 errors. I have observed a lot of these, and it appears that all the tags on the Website are appearing to the bot like they are a category pages.               thehardtackle.com/tag/Preview      is the correct link since there is a tag called Preview but the google bot also reports a page called -               thehardtackle.com/category/Preview      I had used a tool - (Term Management Tools Plugin) 4 months back to merge tags into category, and Vice versa, although I have deactivated it now,the problem still persists. Further,these categories do not show up on the wp admin, so I am not sure - but could it be that the plugin created entries in the database, but in that case it should have been picked at wp-admin, isn't? Please help I have 7K tags and all of them are replicating into categories.


Form passing arguments by get causes 404

I'm printing a custom list table on a site introduced 2 filter methods for category and title:               <form id="products-filter" action="http://localhost/?page_id=258" method="get">         <p>             <label for="download_category">Branch: </label>             <select name="download_category" id="download_category">                 <option value="11" >Utilities</option>                 <option value="8" >IDE</option>                 <option value="7" selected>Compiler</option>             </select>             <label for="download_title">Search: </label>             <input name="download_title" id="download_title" value="" />             <input type="submit" class="button button-primary" name="blalalbalal" value="Filter" />         </p>     </form>      If I submit this form i get the 404 error page and the url is then:               http://localhost/?download_category=7&download_title=&blalalbalal=Filter      I don't use reserved names. (http://wordpress.stackexchange.com/a/77339/33141) Does somebody know what's wrong? The filter works well when using post.


How to unregister sidebar for template_part?

Can you help me please? I have this code in my index.php:               php get_sidebar();       And I have a template_part 'loop-fullwidth', which I call in index.php. I need to register sidebar for index.php and unregister sidebar for a 'loop- fullwidth'. Can't do it. Tried to write in index.php code like this:               php if(!is_singular('partials/loop', 'fullwidth'));       get_sidebar();     else if:       unregister_sidebar();      But it didn't help. I just start to learn php, can't figure out how to solve this. Can anybody help me please?


Shopping Cart Solution

I have someone who sells a variety of physical products that have different weights and sizes. What's the best way to set that up so customers aren't charged multiple flat rate fees? Also, what plugin would be best for this? I'd like to have one that allows handling fees.


What's wrong with my use of plugin_url()?

I keep getting the following message in the browser `Fatal error: Call to undefined function plugin_url() in` My code at present:               add_action( 'wp_enqueue_script', 'load_jquery2' );     function load_jquery2() {         wp_enqueue_script( 'jquery' );    }                 function add_my_css_and_my_js_files(){             wp_enqueue_script('jquery-validate-min', plugin_url('/activate/jquery_validate_min.js', __FILE__ ) );      }       add_action('wp_enqueue_scripts', "add_my_css_and_my_js_files");       The plugin is in a folder called 'activate' & the JS is in that folder directly, not a sub folder.


How to retrieve images contained in a post

I'm working with the new media manager, and have a little issue to retrieve the attachment of the post. I'm developing a plugin which needs to retrieve all attachments of specific posts. I first thought of using the following code :                  $args = array(              'post_type' => 'attachment',              'numberposts' => -1,              'post_status' => 'inherit',              'post_parent' => $id );          $attachments = get_posts($args);      The issue though, is that this will retrieve the attachment that I have uploaded in this specific post, not the one I current use. For example let's say I have three posts. When I created the first post I've directly uploaded all the images that I would need for the three posts, but only use some of them for the actual post as ACF or gallery. The issue is that when I run the above code, I will have an array with all attachments of the three posts when searching attachments for my first post, and none when searching attachments for the second and third posts. Even though I'm using some images for these last posts. So does anyone have an idea how I can retrieve all the images actually used in a post and not the images that have been attached to this post?


Standard way of creating profile pages with custom content for each user?

I'm in need of a solution that I need a profile page (accessible to only admin and that user) with custom content (i.e. different content for different users), for each new user I've registered. Many ideas are coming in my mind like making a textarea for each user in the admin's WP dashboard and then displaying the textarea's content to the respective users profile page. I'm a WordPress programmer, and I'll come up with a solution of this problem in a way or other. However, I would like to listen which is the recommended and most standardized way of doing this. Any sort of workaround is welcome. However, standardized will be preferred.


How can i add a submenu to a custom menu of another plugin?

I'm writing a couple of plugins. One plugin would be the core plugin with certain bits of functionality. The other plugin would extend that functionality. What I've done is in the CORE plugin, I've created a menu using "add_menu_page" and I also one submenu page in that menu. Now, as users add more extension plugins I want to add new settings menu items under the CORE plugin menu. I tried using add_submenu_page in the extender plugin and this adds the submenu. Problem is it gets rid of the main menu sublink in the menu. The link is added to the menu, but when i click it it does not load the right page. I get a 404. I'm curious what command should I use to add a new submenu page to an already existing admin menu?


Getting content from custom fields of different pages on a single page

I want to get content from one custom field of different pages along side their page titles and I'm using the following code:               <?php         $mypages = get_pages( array(         'sort_order' => 'ASC',         'sort_column' => 'post_title',         'hierarchical' => 1,         'exclude' => '',         'include' => '',         'meta_key' => '',         'meta_value' => '',         'authors' => '',         'child_of' => 53,         'parent' => -1,         'exclude_tree' => '',         'number' => '',         'offset' => 0,         'post_type' => 'page',         'post_status' => 'publish'      ) );              foreach( $mypages as $page ) {                   $content = $page->post_content;                     $new = $page->get_post_custom_values('new_file');             if ( ! $content ) // Check for empty page                 continue;                  $content = apply_filters( 'the_content', $content );         ?>
<a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo $page->post_title; ?>
                                  <a style="display:block; text-align: center;" title="Download Now" href="<?php $new;  ?>"><img src="<?php bloginfo('template_url'); ?>/images/new-file.png" alt="Download the File" />                   <?php         }        ?>      I'm able to get page title but not getting my custom fields value. Please guide me in this regard. Your help'll be highly appreciated in this regard.


Media library orphans

I have this conditional statement that checks if an image has been added to a custom post type and if it hasn't it inserts a default image.               if ( get_post_meta( get_the_ID(), 'team_page_custom_image', true ) ) {          echo wp_get_attachment_image($post_meta_data['team_page_custom_image'][0], 'medium');           }           else {             echo '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/img/team-logo.png" />';         }      It seems works fine except when an image is chosen and then deleted from the media library it leaves a blank spot as there is still a meta value in the database for the post-meta. I know I can just delete them from the database but is there a function somewhere to take care of orphans from media library deletions?


Showing posts from different categories and from custom post type

On my main page, I want to show posts from 3 categories, and 1 custom post type. Is there a way to get them together in one `pre_get_posts` function? Or do I need to query separately - once for the CPT and once for the posts from specific categories?


can't access backend while frontend works perfect

Before 2 days there was a automatic update for wordpress, which I for my website. When the update was over, I tried to access backend but I always get this message:               Fatal error: Call to undefined function wp_is_mobile() in /home/*******/public_html/wp-login.php on line 67      Can you give me any idea what to do, how to fix this. Thanks


Name of last category level for a post

I want to show the last category level of a post for example, I hav a post in category "Course -> resultat -> Trail" I want to show just "trail" Thanks if somenone can help