title: Path to image in js with wp_localize_script

text: I'm trying to implement animated svg icons into my Wordpress theme. All's is great, except I can't figure out how to put proper url for svg images in this js file:               var svgIconConfig = {         plus : {              url : 'svg/plus.svg',             animation : [                 {                      el : 'path:nth-child(1)',                      animProperties : {                          from : { val : '{"transform" : "r0 32 32", "opacity" : 1}' },                          to : { val : '{"transform" : "r180 32 32", "opacity" : 0}' }                     }                  },                 {                      el : 'path:nth-child(2)',                      animProperties : {                          from : { val : '{"transform" : "r0 32 32"}' },                          to : { val : '{"transform" : "r180 32 32"}' }                     }                  }             ]         }     };      Here is what I've tried: in functions.php               function svgicons_config() {       wp_register_script('svgicons-config', get_template_directory_uri() . '/js/svgicons-config.js', array(), '1.0.0', 'true'); // Custom scripts       wp_enqueue_script('svgicons-config');     }          $svg_path = array( 'template_url' => get_bloginfo('template_url') );     wp_localize_script( 'svgicons-config', 'svg_path', $svg_path );          add_action('init', 'svgicons_config');      And in svgicons-config.js:               url : 'svg_path.template_url+"/svg/plus.svg"',      and few more variations of this. But no luck. I'm almost sure that I'm making some stupid mistake in this part..


title: What could a hacker do with my wp-config.php

text: I am trying to secure my wordpress blog. I read some posts on the web that I should change my `table_prefix` and hide my `wp-config.php`. However, I do not get it? What could an attacker do with my `wp-config.php`? I mean there are my db configurations, but the attacker needs my `DB_HOST` for example, which is not that easy to get, in order to connect to my db?(In my case its: `define('DB_HOST', 'localhost');`, which the attacker could not use to connect to my db) Or am I missing sth? I really appreciate your reply!


title: Why wold sending headers (for a csv download) throw a Page Not Found error?

text: I'm writing a plugin to download some data into a csv file (from the admin section of my wordpress site.) I've tried two different methods to customize the headers and prevent the wp- admin template from being loaded. One uses the admin_post_ hook. CSV export: link above a list table get permission problem The other uses the admin_init hook: Headers already sent error with CSV export plugin In both cases I get a Page Not Found message (contained within the frontend template of my website.) Strangely, in my method which generates the csv content (referenced by the hooks mentioned above), if I comment out the csv headers and csv content, and just echo "hello" -that will work fine. Unfortuantely, I need more than a 'hello'.               public function print_data()     {         if($_POST['gvt_get_data'])         {             ini_set('memory_limit', '-1');             include __DIR__.'/views/spreadsheet_view.php';             include __DIR__.'/models/gvt2013.php';                  $model = new gvt2013;             $info = $model->get_info();                  $view = new Spreadsheet_View($info);             echo "hello";             //$view->print_sheet();             exit();         }     }      There seems to be something about sending the csv headers which triggers a File Not Found response from Wordpress. Thoughts? Here's the static function which adds the actions:               public static function init()     {         add_action( 'admin_menu', array(self::instance(), '_setup') );         add_action('admin_init', array(self::instance(), 'print_data'));          }


title: Permalinks is not working in my wordpress setup

text: I am newbie to wordpress. I have created a site using wordpress and WAMP stack. In my Apache i have enabled **mode_rewrite** , so my site is showing permalinks perfectly. Now i have hosting provider of .NET and IIS server. So when i migrated my site to live server it is working fine without permalinks. But when i type using raw url like www.example.com/?p=12 it is working fine. So how can i make it work with IIS just like Apached did.. Is there anything in IIS like **mode_rewrite** in Apache


title: Google Language Translator - Manage Translation

text: I installed Google Language Translator wordpress plugin. How can I manage it's translation (https://translate.google.com/manager/website). I can manage the translation if not using a plugin, but instead manually adding the code provided by google translate. Thanks


title: Remove post title in catogory page

text: Read all the posts and forums on the internet, but all the solutions didn't work. My quotation page is here. I try to remove the page title because I already put it under as a quote.So no you see it doubled and we don't want that. Does anybody know how I can do that, the theme is: Novita.


title: Is it ok to delete empty meta values

text: I'm using database peek http://wordpress.org/plugins/database-peek/ to show my database structure and have noticed that wp_postmeta has 95073 rows in it. I noticed that a large part of them have empty values in it. Most of these are caused by a plugin that has custom fields with no meta data in it so it seems to be storing these with no value. It seems to me that they are not needed. Is it possible or more importantly, smart to get rid of these? I've optimized the database and thought that it may fix the problem but it does not which makes me think that maybe it could be dangerous for me to delete them. If it is ok to do, how could I do it? Would a sql command be the best way to do it and if so, what would the command be? Thanks!


title: Rename category part the permalink without .htaccess

text: I have pretty permalinks that look like this: http://mysite.com/category/my-blog-post/ I want to rename "category" into "company-news", to make it look like this: http://mysite.com/company-news/my-blog-post/ I know I could use .htaccess file for that, but it would mess with the PageRank. Is there an alternative solution?


title: Change the text on the Publish button

text: Is there a way to change the text of the publish button on a custom post type to say some different? For example, Save instead of Publish. And also remove the draft button?


title: How Do I Add Next and Previous Links On Single Custom Post Type Only?

text: I'd like to add next and previous post links on single posts which use a custom post type. Prefer links only work for the posts assigned to the custom post type. How would i add it to this:               function wpsites_npp_navigation_links() {     if( 'portfolio_post_type' == get_post_type() ) {?>     <?php previous_post('« « %', 'Previous', 'no'); ?>      | <?php next_post('% » » ', 'Next', 'no'); ?>     <?php     } }          add_action('genesis_after_post_content', 'wpsites_npp_navigation_links', 5 );      Worked this out myself. Here's the solution for HTML 5 enabled Genesis child themes. Change to the old hook if you haven't added child theme support for HTML 5. Example: From genesis_entry_footer to genesis_after_post               function wpsites_npp_navigation_links() {     if( 'portfolio' == get_post_type() ) {?>     <?php previous_post('« « %', 'Previous', 'no'); ?>      | <?php next_post('% » » ', 'Next', 'no'); ?>     <?php     } }          add_action('genesis_entry_footer', 'wpsites_npp_navigation_links', 5 );


title: Image popup in a lightbox / overlay from the backend 3.5 admin area (plugin)

text: Is there a built in way within the backend admin area to have an image show in a popup/lightbox? I built a plugin with help images and want them to show when clicked in a popup overlay / lightbox.


title: Ordering custom posts by meta field date

text:
I've tried every combination of examples here on the boards and nothing seems to get me what I need. I have an events post type with multiple fields in a custom meta box, one of which is a date field that saves in the form yyyymmdd. I need to query only the events that occur today and in the future, and sort in ASC order by date field. This will be used in a custom post type archive page. Metabox function:               function events_metabox() {     global $post;     $typename = 'events';          $meta = get_post_meta($post->ID, $typename, true);          $date = ( !empty( $meta['date'] ) ) ? $meta['date'] : '';     $start = ( !empty( $meta['start'] ) ) ? $meta['start'] : '';     $end = ( !empty( $meta['end'] ) ) ? $meta['end'] : '';     $location = ( !empty( $meta['location'] ) ) ? $meta['location'] : '';     $form = ( !empty( $meta['form'] ) ) ? $meta['form'] : '';          wp_nonce_field( $typename, $typename . "-nonce" );     ?>
         <label for="<?php echo $typename; ?>_address">Location:         <textarea id="<?php echo $typename; ?>_address" name="<?php echo $typename; ?>[location]" class="widefat"><?php echo $location; ?></textarea>         Event location.

         <label for="<?php echo $typename; ?>_phone">Event Date:         <input type="text" id="<?php echo $typename; ?>_date" name="<?php echo $typename; ?>[date]" value="<?php echo $date; ?>" />         Event date.

         <label for="<?php echo $typename; ?>_email">Start Time:         <input type="text" id="<?php echo $typename; ?>_start" name="<?php echo $typename; ?>[start]" value="<?php echo $start; ?>" />         Start time of event.

         <label for="<?php echo $typename; ?>_email">End Time:         <textarea id="<?php echo $typename; ?>_end" name="<?php echo $typename; ?>[end]"><?php echo $end; ?></textarea>         End time of event.

         <label for="<?php echo $typename; ?>_form">Web Form:         <textarea id="<?php echo $typename; ?>_form" name="<?php echo $typename; ?>[form]" class="widefat"><?php echo $form; ?></textarea>         Web Form.
     <?php } ?>      Function saving the custom meta fields:               function events_save_meta($post_id, $post) {     $typename = 'events';     $id = $post->ID;              if(!isset($_POST[$typename])){         return $id;     }          $meta = $_POST[$typename];          if (!wp_verify_nonce($_POST[$typename . "-nonce"], $typename)) return $id;          if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )         return $id;          if( $typename != $_POST['post_type'] )         return $id;          update_post_meta($id, $typename, $meta);     }      Post Query:                $args = array(      'post_type'   => 'events',      'meta_key' => 'date',      'orderby' => 'meta_value_num',      'order' => 'ASC',      'meta_query' => array(       array(          'key' => 'date',          'value' => date('Ymd'),          'compare' => '>=',          'type' => 'NUMERIC'       )      )     );          $events_query = new WP_Query( $args );


title: How to order posts in wp_query by a meta_value of the corresponding author

text: Is it possible to order posts retrieved via `WP_Query` according to a meta value of the corresponding **post author**? Use case: I have premium subscribers and basic subscribers. I want the posts of the premium subscribers to appear before the posts of the basic subscribers in a search result page. One way to solve this, would be to add a `meta_key` to the **post** , indicating the author's subscriber status, but I would have to update all posts of a user everytime this user's status changes. Is there a way to make this work by referring to the user meta values directly?               $args = array(                 'post_status' => 'publish',                 'post_type' => 'listing',                 'meta_key' => '???', // how can I refer to the meta_key of the author of a post ?                 'orderby' => '???',                 'order' => 'DESC'             );          $query = new WP_Query($args);


title: Horizontal Navigation

text: ![Wordpress horizontal line menu](http://i.stack.imgur.com/b3jhi.jpg) Hi. I been fighting with this problem for couple of weeks now. Trying various approaches. From CSS styling to a custom walker. I want to render each level as its own element. The navigation menu(defined in Appearence/Menu in Admin) consists of both Pages, Posts and WooCommerce products and categories. When I'm on the homepage, I want to see LEVEL 1 Menu Objects. When I navigate to a LEVEL 1 page I wan't to show it's Children (LEVEL 2) in its own UL beneath the Top UL. If I navigate to a Child of LEVEL 1(level 2 object) I want to render its children as its own UL. The picture attached shows this scenario where all the levels are shown. This, in the best of worlds, should not be dependent upon a specific number of levels though. This should be a basic thing to accomplish but I fail horrendously - I'm new to WP / PHP ( coming from the .NET world ) Please help. Anything goes, pointer to a plugin, pure code, things to try ...


title: Pass the post ID

text: Okay what I am trying to do is run JavaScript of the user is not logged in! I have been given the following script by the maker of "Restrict Content Pro" (The plugin I am using)               function pw_rcp_add_login_script() {          global $post;          if( ! rcp_is_paid_content() ) {         return;     }          if( rcp_is_active() ) {         return;     }          ?>     <script type="text/javascript">     jQuery(document).read(function($) {         // Replace this with code to open login modal         $('#id_of_modal').open();     });     </script>     <?php     }     add_action( 'wp_footer', 'pw_rcp_add_login_script' );      Now he has said "You will need to pass the post ID of the current page to that function." Can anyone help me with this? Thanks Aled


title: How to count posts of a category and of a category limited by a tag

text: I have two urls, and I want to know how many posts will be displayed there, when I click them. The goal is to show the visitor in the navigation of those urls, how many postings are found there. As far as I can analyze those urls I would say it's about a category and then about a category and a tag. But pleas tell me if I am wrong. Here are the two Urls, which actually end up in a blog-roll page (pseudo code):               http://site_url()/category/<category-name>/     and     http://site_url()/category/<category-name>/<tag-name>      while `category` is the string `"category"` Is my question somehow clear? Do I have to use `count_posts()` function?


title: Loading jQuery With Two Fallbacks

text: CSS-Tricks suggests this code to load jQuery. However, I'm curious if anybody has done the same thing in functions.php with **two fallbacks: the Microsoft hosted jQuery being the first option and locally hosted jQuery being the second** , that is, in the case the Google library decides not to load/crashes/gets eaten by a polar bear/etc.               if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);     function my_jquery_enqueue() {        wp_deregister_script('jquery');        wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null);        wp_enqueue_script('jquery');     }


title: Generate excerpt (respecting <!--more--> if it's there) "by hand"

text: I have a post archive page that's loaded by AJAX so I am manually retrieving the posts via `WP_Query` and then manually displaying `$post->post_content`, etc. The problem is that I'm not using The Loop, so `<!--more-->` in the content is not being parsed. I can manually write code to manually figure out an excerpt, but that seems like a lot when it's already in WP. Is there a way I can pass a raw blog post (retrieved from the database) to Wordpress, and have it give me back an excerpt? I need to tap into the existing functionality, where WP pulls the excerpt from the 'excerpt' field on the post, or it would generate it by looking for the `<!--more-->` break, or failing all else, it would take the first 55 words.


title: Getting grandchildren of a post with a specified custom taxonomy?

text: I have an hierarchical custom post type called **Geographies** , wherein each Geography is assigned to a custom taxonomy (`geographytype`): Area, Country, Region or City. The hierarchy is set as follows:               Area ¬          Country ¬                  Region                  City      As an example: The city of Boston is a child of United States, which in turn is a child of Americas. I want to be able to get children and/or grandchildren of a Geography, _and_ specify its `geographytype` - for example, if I'm viewing **Americas** , I want to get all the cities, including **Boston**. However, it seems like I can only do one or the other. If I use get_pages(), I can get all children and grandchildren by specifying the `parent` parameter, but I can't specify a `geographytype`, so I just get everything. Conversely, if I use WP_Query() I can specify my `geographytype` using the `tax_query` parameter, but it won't give me grandchildren; I can only get _direct_ children using the `post_parent` parameter. I want to be able to do both: get children _and_ grandchildren, _with_ a specified custom taxonomy.


title: WP 3.5 and Galleries - how to count images?

text: I'm trying to figure out how to count and display the number of images in a gallery with WP 3.5. I was following an old post on Ottopress, querying the DB for attachments but it seems the galleries are now contained in shortcodes. Is it possible to extract the shortcode from the post and count the IDs? What is the best way to accomplish this?


title: Main menu not appearing on category pages

text: Im creating a theme based on blankslate/Bootstrap and having an issue with the main nav appearing on category pages (seems to appear everywhere else ok.). In header.php:               <div class="collapse navbar-collapse" id="navbar-collapse-1">                           <?php                           wp_nav_menu( array(                           'menu'              => 'primary',                           'theme_location'    => 'primary',                           'depth'             => 2,                           'menu_class'        => 'nav navbar-nav',                           'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',                           'walker'            => new wp_bootstrap_navwalker())                           );                           ?>      In Functions.php               // Register Custom Navigation Walker     require_once('wp_bootstrap_navwalker.php');     register_nav_menus( array(     'primary' => __( 'Primary Menu', 'themename' ),     ) );      Any help or pointers would be appreciated


title: Custom entry_date function

text: I want to make a custom entry_date function based on the one found in twenty- thirteen. I just want to have the day, the month and the year in separate `<span>`s I don't understand why what I want to achieve will not work. The date is printed but not inside the `<a href="">` tag. What am I doing wrong? My code is:               $date = sprintf( '<time class="entry-date" datetime="%3$s">%4$s%5$s%6$s</time>',         esc_url( get_permalink() ),         esc_attr( sprintf( __( 'Permalink to %s', 'lyod' ), the_title_attribute( 'echo=0' ) ) ),         esc_attr( get_the_date( 'c' ) ),         esc_attr( the_time(d)),         esc_attr( the_time(M)),         esc_attr( the_time(Y))     );      For the record, here is Twenty-Thirteen function:               $date = sprintf( '<time class="entry-date" datetime="%3$s">%4$s</time>',         esc_url( get_permalink() ),         esc_attr( sprintf( __( 'Permalink to %s', 'twentythirteen' ), the_title_attribute( 'echo=0' ) ) ),         esc_attr( get_the_date( 'c' ) ),         esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) )     );      Thank you in advance for the help!


title: Location of core code for database connection and get_header

text: I understand WP well enough to create a custom theme at a basic level, but have no experience with the core code. I've also just finished a book on basic php and mysql coding. I'd like to look 'under the hood' of WP to try and put those together. Can someone tell me:   * Where to find the files that code for the WP-Mysql connection? (as in, `mysqli_connect` ...)   * Where to find the files that code for the `get_header()` function? (which I assume will have something like `include(header.php)` ) Thanks!


title: Query multiple meta key values for template

text: I am using this template: http://demo.undsgn.com/studiofolio/front-page/ I tried to make some modifications because I need the homepage template to display an excerpt beneath each thumbnail. I copied the template called `front-page.php`, renamed it to `front-page-excerpt.php` and made my modifications and it worked. The problem is there is a framework behind it that controls which template is shown on the homepage. The framework is: http://aquagraphite.com/2011/09/slightly-modded-options-framework/ In the backend it looks like this: ![enter image description here](http://i.stack.imgur.com/yv0xS.png) ![enter image description here](http://i.stack.imgur.com/a38qS.png) In the backend my new template isn't showing up, and I think I found the problem. The template is called in the backend options panel like this:                   $querystr = "         SELECT $wpdb->posts.*          FROM $wpdb->posts, $wpdb->postmeta         WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id          AND $wpdb->postmeta.meta_key = '_wp_page_template'          AND $wpdb->postmeta.meta_value = 'templates/front-page.php'          AND $wpdb->posts.post_status = 'publish'          AND $wpdb->posts.post_type = 'page'";              $pageposts = $wpdb->get_results($querystr, OBJECT);      When I change it to:                       AND $wpdb->postmeta.meta_value = 'templates/front-page-excerpt.php'      My modified templates show up, but the original templates are not displayed. I tried to put both in it like this:                   $querystr = "           SELECT $wpdb->posts.*          FROM $wpdb->posts, $wpdb->postmeta, $wpdb->postmeta AS mt1         WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id               AND $wpdb->postmeta.meta_key = '_wp_page_template'            AND $wpdb->postmeta.meta_value = 'templates/front-page.php'         AND mt1.meta_key = '_wp_page_template'         AND mt1.meta_value = 'templates/front-page-excerpt.php'              AND $wpdb->posts.post_status = 'publish'          AND $wpdb->posts.post_type = 'page'";              $pageposts = $wpdb->get_results($querystr, OBJECT);      It doesn't work at all. What am I doing wrong?


title: Remove specific administrator's capability

text: I've created two administrator users X and Y. And now I need to remove capability of 'edit_plugins' from user Y. I've searched and found, http://goo.gl/LttuvX               $user = new WP_User( 'Y' );     $user->remove_cap('edit_plugins');      But it is not working please let me know how to do it. Previously I've created new role with same capability as administrator, but in plugins we create menus like `add_menu_page(..,capability => 'administrator',..);` so new role fails to access plugin pages.


title: wp_insert_post featured image from library

text: I know there are a lot of posts about it, but I don't want to upload a URL image to the library, I already have the image in the library and its IP. How can I use it with `wp_insert_post`?


title: Getting value from database table depending on field value

text: I am using a plugin called formidable which is similar to Gravity Forms in terms of purpose. I have two fields of interest. The first field loads up all the values in the `Town` column of my `wp_locations` table. Using the code below.               function frm_populate_posts_town($values, $field){         if($field->id == 800){ //change 125 to the ID of the field to populate         global $wpdb;         $towns =$wpdb->get_results("SELECT Town FROM wp_locations");         $values['options'] = array();          foreach ($towns as $town) {               $values['options'][$town->Town] = $town->Town;          }              }         return $values;     }      The second field is a hidden field that automatically selects the value in the 'County' Column depending on the value of the first field. (btw `$_POST['item_meta'][802]` represents the hidden field               add_filter('frm_validate_field_entry', 'my_custom_validation_town', 8, 3);          function my_custom_validation_town($errors, $posted_field, $posted_value){         if($posted_field->id == 802){ //change 25 to the ID of the hidden field             $town_b = $_POST['item_meta'][800];//Gets the value from the first field             global $wpdb;                  $query = "SELECT County FROM wp_locations WHERE Town = $town_b";             $the_county = $wpdb->get_var($query);                    $_POST['item_meta'][802] = $the_county;          }         return $errors;     }      The second does not work. ## EDIT I found out that I need to use the action hook frm_after_create_entry and then add a Javascript in order to do 'Text calculations' which is one of the functions the plugin has. Unfortunately I do not know how to add the SQL query as a variable using the value of `#field_800` e.g:               "SELECT County FROM wp_locations WHERE Town =`#field_800`"               <script type="text/javascript">       jQuery(document).ready(function($){     $('#field_800').change(function(){           var val1 = $("#field_800").val();//How can I add mySQL here           $("#field_802").val(val1);     });     });     </script>


title: Ajax WP Query Search Filter

text:
Everything is working great with this Plugin. http://wordpress.org/plugins/ajax-wp-query-search-filter/ I created a search form. When i click submit Search button it displays the results in default format with post thumbnail, then title ,then excerpt By this default function                  function ajax_result($arg, $id,$pagenumber){            $apiclass = new ajaxwpqsfclass();               // The Query             $query = new WP_Query( $arg );             $html ='';             // The Loop         if ( $query->have_posts() ) {             $html .= '
'.__('Search Results :', 'AjWPQSF' ).'
';             while ( $query->have_posts() ) {                 $query->the_post();                     $html .= '
'.the_post_thumbnail('event-home-thumb').'';                     $html .= '
'.get_the_title().'
';                     $html .= '';                     $html .= '
';                  }                  $html .= $apiclass->ajax_pagination($pagenumber,$query->max_num_pages, 4, $id);          } else {                     $html .= __( 'Nothing Found', 'AjWPQSF' );                 }                 /* Restore original Post Data */                 wp_reset_postdata();                  return $html;        }          But I want to display result in other way. I want to show results using my `search.php`.


title: make permalink go to a custom single.php file

text: hope somebody can help me with this because I am struggling for a while. I want to use two single.php on my website, one to display the regular posts and another to display some products that I will style different then the posts. I duplicated the single.php and named it products.php but I cannot figure out how to make the permalink grab my products.php and not the single.php. Please, is there a way to accomplish this? Thank you very much!


title: Parse wordpress blog data using json api and ajax

text:
I have seen lots of responses to how to extract data from wordpress blog posts using the json api plugin. Many uses $.getJSON, $.ajax, .responseData.feed.entries, success function() etc. What is the correct way to parse JSON API datas from wordpress, post the result to a content div page in a jQuery mobile listview. I have the following codes but unable to get the intended result: ### HTML               <!DOCTYPE html>                   <meta charset="utf-8">                       <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">                       <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />

Sysads Posts

Home

Disclaimer

                .js:               $( document).ready(function (){         url = 'http://hopexxx.com/category/daily-devotion/feed/' ;         $.ajax({             type: "GET",             url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&callback=?&q=' + encodeURIComponent(url),             dataType: 'json',             error: function(){                 alert( 'Unable to load feed, Incorrect path or invalid feed' );             },             success: function(data ){                 var postlist = data.responseData.feed.entries;                 var html = '
' ;                 for (var i = 0 ; i < 10 ; i++) {                     var entry = postlist[i];                     html += '
';                     html += '';                     html += '
' + entry.title + '
' ;                     html += '
' + entry.author + '
' ;                     html += '
' + entry.publishedDate + '
';                     html += '
' + entry.contentSnippet + '
';                     html += '';                     html += '
';                 }                 html += '
';                 $( "#postlist" ).append(html);                $( "#postlist ul[data-role=listview]" ).listview();                  }});         });      I hope my question is not outside the site rule.


title: Can WordPress handle following functionalities?

text: Now i am planning a development of a new web site and searching for a CMS. I know WP not bad, but never tried to build a complex community information site using this engine. Among basic requirements there are following, i would call them "community":   - user-panel (user profile with settings, history of activity etc)   - users possibility to rate topics/comment/post   - posts output according to those ratings   - site log in/register via Facebook/Twitter account etc Are there any popular, stabe extensions that could handle those "community" needs without deep rebuilding of engine? _I know that all of those features can more or less be made using CMS with some extension such as Joomla, Drupal and LiveStreet, but in this project i want to exclude them._


title: Creating tabs shortcode

text:
Tab 1

The Second Tab

Tab C

Configurations

This example has the animation disabled, so tab-switching is instantaneous. It also sets the active class names to custom names for more control over CSS stylization.

Heading 2

Stuff from the second tab.

Heading 3

More stuff from the last tab.

      http://codex.wordpress.org/Shortcode_API I'm trying to set a shortcode for tabs in wrodpress without js but php is not my strong point. I really need help with this. Thanks in advance ! **Edit:** Ok i've found helpful example. I decided to share with it. > **Answer**               $tabs_divs = '';          function tabs_group($atts, $content = null ) {         global $tabs_divs;              $tabs_divs = '';              $output = '

'.do_shortcode($content).'
';         $output.= '
'.$tabs_divs.'
';              return $output;       }                 function tab($atts, $content = null) {           global $tabs_divs;              extract(shortcode_atts(array(               'id' => '',             'title' => '',          ), $atts));                if(empty($id))             $id = 'side-tab'.rand(100,999);              $output = '
                 '.$title.'
         ';              $tabs_divs.= '
'.$content.'
';              return $output;     }          add_shortcode('tabs', 'tabs_group');     add_shortcode('tab', 'tab');


title: How to change image's author via a function when using GravityForms uploader?

text: I am wondering if there is a way to manually change the author of images. I am using Gravity Forms which sets the post author to the current user but does not set them as the author of the images they upload. I figure there might be a way to add a function which finds the current user and then sets the author of the images they upload to that user.


title: Custom post type and taxonomy slug issue

text: I'm working with custom post types in WordPress and have a question about slugs. Let's say that we need to create custom post type Quiz with taxonomy Quiz Category. I've used the following code:               // Create and register custom post type quiz     function create_posttype_quiz() {         $labels = array(             'name'               => _x( 'Quiz', 'post type general name' ),             'singular_name'      => _x( 'Quiz', 'post type singular name' ),             'add_new'            => _x( 'Add New', 'quiz' ),             'add_new_item'       => __( 'Add New Quiz' ),             'edit_item'          => __( 'Edit Quiz' ),             'new_item'           => __( 'New Quiz' ),             'all_items'          => __( 'All Quiz' ),             'view_item'          => __( 'View Quiz' ),             'search_items'       => __( 'Search Quiz' ),             'not_found'          => __( 'No quiz found' ),             'not_found_in_trash' => __( 'No quiz found in the Trash' ),              'parent_item_colon'  => '',             'menu_name'          => 'Quizzes'         );         $args = array(             'labels'        => $labels,             'description'   => 'Holds our quiz and quiz specific data',             'public'        => true,             'menu_position' => 5,             'supports'      => array( 'title', 'editor' ),             'has_archive'   => true,             'rewrite' => array('slug' => 'quiz'),             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,              );              register_post_type( 'quiz', $args );         }     add_action( 'init', 'create_posttype_quiz' );          // Create and register quiz categories     function create_taxonomies_quiz() {         $labels = array(             'name'              => _x( 'Quiz Categories', 'taxonomy general name' ),             'singular_name'     => _x( 'Quiz Category', 'taxonomy singular name' ),             'search_items'      => __( 'Search Quiz Categories' ),             'all_items'         => __( 'All Quiz Categories' ),             'parent_item'       => __( 'Parent Quiz Category' ),             'parent_item_colon' => __( 'Parent Quiz Category:' ),             'edit_item'         => __( 'Edit Quiz Category' ),              'update_item'       => __( 'Update Quiz Category' ),             'add_new_item'      => __( 'Add New Quiz Category' ),             'new_item_name'     => __( 'New Quiz Category' ),             'menu_name'         => __( 'Quiz Categories' ),         );         $args = array(             'labels' => $labels,             'hierarchical' => true,             //'show_admin_column'=> true,             'rewrite' => array('hierarchical'=>true, 'slug'=>'quizzes', 'with_front'=>false),         );         register_taxonomy( 'quiz_category', 'quiz', $args );     }     add_action( 'init', 'create_taxonomies_quiz', 0 );      Everything works fine, I'm able to create and edit quizzes, add them to quiz categories etc. Also, I can access quizzes on frontend, e.g. site.com/quiz/sample-quiz-one, site.com/quiz/sample-quiz-two... and list quizzes in quiz categories, e.g. site.com/quizzes/category-one, site.com/quizzes/category-two... The problem is that I can't list quizzes under **site.com/quizzes** but at **site.com/quiz** instead. ( **site.com/quizzes** will create page not found error). Basically, I would like to be able to:   * access a single quiz at url: **site.com/quiz/sample-quiz-one**   * list all quizzes at **site.com/quizzes** rather than **site.com/quiz**. Is it possible to achieve this without htaccess or any other redirection, but using the code above (maybe some args I'm not aware of)?


title: theme functions (hooks)

text:
This question was already asked in WordPress, but there was no answer for it. Just wanted to try in this forum if anyone knows about it because i have also same question. > want to edit my theme having jquery slidebar, how do i go to that script?, > its showing up "$theme->hook('content_before');" in content div tag.can > anyone help please? My Theme index.php contains below
              <?php $theme->hook('main_before'); ?>
                  <?php $theme->hook('content_before'); ?>                  <?php                  if (have_posts()) : while (have_posts()) : the_post();                     /**                      * The default post formatting from the post.php template file will be used.                      * If you want to customize the post formatting for your homepage:                      *                       *   - Create a new file: post-homepage.php                      *   - Copy/Paste the content of post.php to post-homepage.php                      *   - Edit and customize the post-homepage.php file for your needs.                      *                       * Learn more about the get_template_part() function: http://codex.wordpress.org/Function_Reference/get_template_part                      */                          get_template_part('post', 'homepage');                      endwhile;                      else :                     get_template_part('post', 'noresults');                 endif;                       get_template_part('navigation');             ?>                  <?php $theme->hook('content_after'); ?>
              <?php get_sidebars(); ?>              <?php $theme->hook('main_after'); ?>


title: Remove Custom Taxonomy Metabox from Custom Post Type Screen

text: I have two hierarchical custom taxonomies, each on a corresponding custom post type. I would like to remove the metabox for each on the post type's edit screen. I have read remove custom taxonomy metabox form custom post type and How do you remove a Category-style (hierarchical) taxonomy metabox? but I'm still stuck. The function I'm using is:               function remove_taxonomies_metaboxes() {         remove_meta_box( 'partner_typediv', 'partners', 'normal' );         remove_meta_box( 'person_typediv', 'people', 'normal' );     }     add_action( 'admin_menu' , 'remove_taxonomies_metaboxes' );      I unprefixed the post_types and custom_taxonomies, but that's it. I've tried using the `admin_menu` hook and the `add_meta_boxes` hook recommended by the Codex. I've tried both `normal` and `side` for the third parameter. The above function is located in an `mu-plugins` file below the function that registers the post types and taxonomies. * * * EDIT: It was a typo in the register_taxonomy function. I'm a horrible person. Thanks for everyone for the help. I still learned some stuff!


title: How to disable the "Post Lock/Edit Lock"?

text: I want to disable this just for one Post Type, as it doesn't really matters if there's another user editing it (the main content editing area is Ajaxified and non-admins can only see that). ![enter image description here](http://i.stack.imgur.com/JIKlb.png) I looked at the core functions but couldn't find an entry point. From the function `wp_set_post_lock` I'm guessing that I'd have to intercept the `get_post_meta`, but is there an _official_ way to do it? And there's a second lock that doesn't seem to be affected by the filter `wp_check_post_lock_window` (as shown by birgire, here in an Answer). I've tried `remove_filter( 'heartbeat_received', 'wp_refresh_post_lock', 10, 3 );` at various points but it keeps beating without respecting `remove_filter`. ![enter image description here](http://i.stack.imgur.com/L2eLk.png)


title: Footer in middle of page in different browers

text:
For some reason whenever I add a widget to the footer of my site, it moves to the center of the page - but only in Chrome and Safari. Firefox the footer stays put at the bottom. The only way I can think to change this is to increase the padding-top size. This puts the footer back at the bottom and looks fine in Safari and Chrome, but obviously looks terrible in Firefox. What am I doing wrong? Site link Footer.php -

          <?php if( is_front_page() ) {      echo do_shortcode('[responsive_column_widgets]');     }     ?>
          <?php wp_footer(); ?>                          Style.css -               #footer{     margin-top: -90px; /* negative value of footer height. this need to be  */     height: 100px;     clear:both;     padding-top:20px;     margin: 10px;     text-align: center;     color:#fff;     }     #footer img {     padding:3px;      margin:3px;     }


title: How to exclude categories from recent posts, recent comments & category widgets?

text: I use the bellow function (thanks to @helgatheviking!) to exclude categories from the wordpress loop. It works very well - posts of selected categories are excluded from the loop on the main blog listing page, from category listing pages and from archives, **but not** from Recent Posts and not from Recent Comments in sidebar. How can be extended the action of this code also on them?               add_action('pre_get_posts', 'wpa_31553' );          function wpa_31553( $wp_query ) {              //$wp_query is passed by reference.  we don't need to return anything. whatever changes made inside this function will automatically effect the global variable              $excluded = array(272);  //made it an array in case you need to exclude more than one              // only exclude on the front end         if( !is_admin() ) {             set_query_var('category__not_in', $excluded);             //which is merely the more elegant way to write:             //$wp_query->set('category__not_in', $excluded);         }     }      **UPDATE:** A small clarification, the excluded categories have not disappeared also from the Categories widget. Just disappeared all posts from these categories when I open them with a mouse click. I would like that they disappear also from the Categories widget.


title: Customized wp_new_user_notification

text: Customized wp_new_user_notification I'm kind of inexperienced with it comes to editing Wordpress functions, yet i'm currently trying to customize `wp_new_user_notification` in order to personalize the email that administrators and users receive once they register. I'm aware there's some plugins that allow this kind of customization, but I would rather spend some more time on a problem and try to learn/understand it, rather than just install a plugin. Hence, I've placed this function in my `functions.php`, and I believe I'm supposed to add one or more filters, such as:               add_filter('myfunction', 'wp_new_user_notification', ?, ?)      or maybe not. I've read and attempted to follow several tips/tutorials/questions (such as for example), but no matter what I do, I keep receiving emails with standard text/contents (as if my functions is not being considered by Wordpress). Can anyone help me solve this problem? Thanks in advance!


title: Post by email is not working

text: I'd like to post to my **Wordpress** blog through the **Post by email** feature. All emails sent via Gmail are arriving but from some other email clients they not. (Gmail is not my default client - just used for testing) What could cause this problem? Is it possible that the email needs to be sent through SMTP with authentication? Thank you.


title: Redirecting deleted posts url to another WordPress install

text: On a WordPress site `http://www.example.com/` (MAIN SITE) there are 540000+ posts. I want to reduce number of posts to enhance site speed. I've installed new WordPress at `http://www.example.com/business-consultants/` (NEWSITE) and here I moved from MAIN SITE 3135 posts tagged 'Business Consultants'. Currently, I've set 301 redirect on MAIN SITE to redirect posts tagged 'Business Consultants' to the new WordPress install, that is               {MAIN_SITE}/{slug} => {NEW_SITE}/business-consultants/{slug}      What I do is checking post tag, and if 'business-consultants' is present, redirect request to new the new site using `wp_safe_redirect()`. The problem is that to make redirect works I need the post are actually available in MAIN SITE, what I'm looking for is a solution to make redirect work even if posts tagged 'Business Consultants' are deleted from main site.


title: wp_logout action not working

text: I'm trying to remove some cookies set to control persistent login when the user specifically wants to log out of a website. I thought it would be as simple as:               function remove_user_cookie() {              unset($_COOKIE['woai']);         unset($_COOKIE['woak']);          }     add_action('wp_logout', 'remove_user_cookie');      I've also tried:               function remove_user_cookie() {              if( $_GET['action'] == 'logout' ) :                  unset($_COOKIE['woai']);             unset($_COOKIE['woak']);              endif;          }     add_action('wp_logout', 'remove_user_cookie');      However, the users cookies remain in place, so they keep getting logged back in automatically. I'm not sure if the wp_logout action just isn't working, or if it's clashing with my code that logs the user in automatically. Right now, I have this in the header.php:               <?php if( !is_user_logged_in() ) :              // check if user has cookies         if ( isset($_COOKIE['woai']) && isset($_COOKIE['woak']) ) :                  $args = array(                 'meta_key' => 'login_key',                 'meta_value' => $_COOKIE['woak'],                 'meta_compare' => '=',                 'fields' => 'ID',                 'include' => $_COOKIE['woai']             );             $user_query = new WP_User_Query($args);                  if( $user_query->results[0] != '' || $user_query->results[0] != NULL ) :                      // get user id and login name                 $user_id = $user_query->results[0];                 $user_login = get_user_by( 'id', $user_id );                      // log the user in                 wp_set_current_user( $user_id, $user_login->user_login );                 wp_set_auth_cookie( $user_id );                      do_action( 'wp_login', $user_login->user_login );                  endif;              endif; // end if cookies          endif; ?>      And when the user is logged in, they get a new key set with this:               function set_user_cookie($user_login) {              // if they have cookies, delete them         if ( isset($_COOKIE['woai']) && isset($_COOKIE['woak']) ) :             unset($_COOKIE['woai']);             unset($_COOKIE['woak']);         endif;              $user_id = get_user_by( 'login', $user_login );              // generate new key for user         $salt = wp_generate_password(20); // 20 character "random" string         $key = sha1($salt . $email . uniqid(time(), true));              // set new cookies         setcookie("woai", $user_id->ID, time()+31536000);  /* expire in 1 year */         setcookie("woak", $key, time()+31536000);  /* expire in 1 year */              // update the db         update_field('field_53c3de9cd031e', $key, 'user_'.$user_id->ID.'');          }     add_action('wp_login', 'set_user_cookie', 10, 1);


title: Allow AJAX call to other roles than admin

text: On my website, registered users (subscriber role) can send drafts and, if admins validate them, they are published. I'm trying to add a tag box to frontend editor used to send new posts. To implement the autocomplete feature I'm making an AJAX call to this URL:               http://example.com/wp-admin/admin-ajax.php?action=ajax-tag-search&tax=post_tag      That works great for an administrator user, but it doesn't work for subscribers. Does anyone know any way to achieve this without calling to `admin-ajax.php`?


title: If User is NOT Logged in and Page ID is not 6 - Redirect to Login

text: I am trying to redirect users based on the following...   * If Role = Customer & Page Is NOT ID 6 Then Redirect To Checkout   * If Not Logged in & Page Is Not ID 6 then redirect to login   * User role = member and Page ID is 6 redirect to home page              //If Role = Customer & Page Is ID 6 Then Redirect To Checkout     if ( user_can( $current_user, "customer" ) && ! is_page( 6 ) )      {     wp_redirect(home_url().'/checkout');     exit;     }          elseif ( ! is_page ( 6 ) )     {     //If Not Logged in & Page Is Not ID 6 then redirect to login     auth_redirect();     }               elseif ( user_can( $current_user, "member" ) && is_page( 6 ) )     {     // User role = member and Page ID is 6 redirect to home page     wp_redirect(home_url());     exit;     }     ?>      Which as far as I can see should work, but its not, it gives me a blank page. The script is being run from header.php and is the first thing in the PHP file. The first rule - If Role = Customer & Page Is ID 6 Then Redirect To Checkout works correctly and they are redirected to the checkout page. The second rule prevents anybody from logging in The third rule works correctly Am I doing something wrong?


title: Some Javascript and CSS not being compressed

text: Most of my site is being compressed by mod_deflate but there are still several JS & CSS files that are not. I cannot for the life of me figure out why these files are exempt. Thank you for any insight! The files in question can be seen via a PageSpeed Insights query: http://developers.google.com/speed/pagespeed/insights/?url=www.limbsaver.com&tab=desktop My .htaccess file is here: http://pastebin.com/0nFd5rPt


title: if there is only one post in the category, directly open

text: I have a few categories. in each of them, I have only one post. by clicking on a category, I have to click on that single post to enter. I wish, by clicking on the category, enter directly in that one post. This method avoids having to click two times in the post. Any suggestions for what I have to use code in archive.php?


title: Windows Live Writer inconsistent with Media Library

text: I'm considering moving my existing blog from DasBlog to WordPress. While doing some tests to see if I did like the platform I ran into following problem: I'm using Windows Live Writer to write my blog posts. I'm used to add the pictures on the original size and remove the default link (to the full size picture). When I publish this post to WordPress, some pictures end up in the picture library and others don't, even in the same post. It would be nice to have a consistent way of storing my pictures. Preferably without the use of the media library, as I don't see the use of it (yet?) and it gives unwanted links and records in the posts table.


title: How can I make my Blog category unindexed in Google?

text: My Blog posts can break my SEO, as they're not about the themes my website discusses. So how do I avoid this?


title: How to manage multiple wordpress project with shared code base

text: I need to build several highly customized WordPress instances beyond look and feel changes. For example, in one of the instances, any categories with children need to display in its own dropdown on the post edit page. I can not use multi-site setup as each instances may need to be highly customized. I would also like to have these individual projects to share the same base code, i.e. standard WordPress installation with some shared logic like security patches, caching, and so on. Currently, I have the following layout in my source control:               root         +---wordpress_base         +---project1         +---project2      wordpress_base contains the wordpress source tree. project1 and project2 contains only the files that are changed for customization. During deployment, my ant script will combine wordpress_base with the custom code from a specific project. Is this a good way to manage mutliple WordPress source code? I have no expertise in php/wordpress development. Feel free to let me know what I am doing is stupid and suggest the right approach.


title: Removing categories, Comments etc from posts?

text: im wondering if there is a way to completely remove this feature from my website as i have no need to categorise any of my posts - i plan to post projects in pages from my left sidebar with a static front page. I am really new to this and read that i may need to edit the theme (Editor is my current one, though there's nothing there yet so willing to change if there is a theme with an easier way to do it) I am not at all familiar with coding and went to the editor page to have a look after reading a way to remove categories, comments etc, but would have NO idea at all where to type the changes. I removed author, comments, tags, comments and dates from the screen options on my posts page but it still appears on my (currently test) first post. As i say i'm just getting started, am very novice at this and want to make sure things will look as i want them to before i start making pages and posts. Thanks so much for any help :)


title: Incoming URL variables to custom metabox

text: Is it possible to take values from an incoming URL variable and write it to a custom meta box? My client has something like the following for a URL (marketing purposes): http://somesite.com/this-page/?phone=5551112222&unique_id=1234 They want to be able to capture the phone and unique id and write them to a custom meta box and then output that custom meta to a page. Basically, they want to be able to create a handful of marketing landing pages without having to create one for every phone number (plentiful) and unique id they have. I think they're more interested in dynamically writing the phone on the page and the unique id into Gravity forms (which I have figured out). Or, if I'm thinking about this in the wrong way, please point me in the right direction. TIA!


title: Filter front page posts by category

text: I have three categories (news, pics, vids), but I have all of them showing up on my front page. I would just like the front page to have the news category (and possibly uncategorized category) to show. What is the best way to do this? Plugin? Or a piece of code on the front page?


title: wordpress wp_enqueue_script() not working

text:
I'm trying to add this social-network button:               Add in Svejo           to my blog posts. But loading this in every post would really slow my page so I've try to implement it with **wp_enqueue_script()** inside my **functions.php**               function socialNetworks(){         $opentag = '
';         $closetag = '
';              $socials['svejonet'] =             'Add in Svejo'.             wp_enqueue_script( 'none', 'http://svejo.net/javascripts/svejo-button.js', array(), false, true);              echo $opentag;         foreach ( $socials as $key=>$val ){            echo '
'.$val.'
';         }         echo $closetag;        }      However the script does not load.   Appreciate any help.


title: How to use pre_get_posts?

text: I am having a problem with the custom category template pagination and i search and read that using pre_get_posts fix the pagination problem. I read the pre_get_posts information in the WordPress Codex but i didn't understand how to use it.               <?php     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $args = array(                 'post_type' => 'post',                 'meta_key' => 'hmeromhnia_lhkshs',                 'orderby' => 'meta_value_num',                 'order' => 'ASC',                 'posts_per_page' => 9,                 'paged' => $paged                 );               // get results     query_posts( $args );?>          <?php if ( have_posts() ) : ?>     <?php while ( have_posts() ) : the_post(); ?>          // The Loop          <?php endwhile;?>     <?php endif; ?>          <?php if ($wp_query->max_num_pages > 1) tie_pagenavi(); ?>          <?php wp_reset_query();  // Restore global post data stomped by the_post(). ?>      This is the code i use for the query and the pagination doesn't work. I can't understand where and when to insert the pre_get_posts. Generally don't know how to use it. Please help me!


title: How to preview a page instead of a category?

text:
Is it possible to make the code below preview a page instead of a latest category post?

Gift Vouchers

        <?php     //The Query     query_posts('posts_per_page=1&cat=7');     //The Loop     if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>        <?php if ( has_post_thumbnail()) the_post_thumbnail('medium-thumbnail'); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
     <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_time('F jS, Y') ?>
<a rel="bookmark" href="<?php the_permalink(); ?>"><?php echo strip_tags(get_the_excerpt());?>

     <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
     <?php endif;     //Reset Query     wp_reset_query();     ?>
      Thanks,


title: How to rename a custom field?

text: I have 3000 posts with that custom field name 'refer' and i need to change it to 'ref' for theme needs, instead of doing it manually i need a query or technique to change them all. **Question 1**   I am trying to rename a custom field, from 'refer' to ref. what is the query needed to rename a custom filed. it would be better if its done using function.php(instead of doing in phpmyadmin). **Question 2**   I also have a lot of unwanted custom fields which are need to be deleted, how should i go about. help me out guys.


title: When to use actions and when to use filters

text: I'm trying to understand where to use filters and where to use actions. Suppose I have a query in a plugin, which later add on modules might modify to change the results of the query, thus modifying the arguments. Would this be an ideal implementation of this concept, or should I be using actions here? // Function to display list of pages               function get_page_list() {         $pages_args = array(             'post_type' => 'page',             'posts_per_page' => '1'         );           $pages_query = new WP_Query( apply_filters( 'myfilter', $pages_args ) );                   if( $pages_query->have_posts() ) {             while ( $pages_query->have_posts() ) : $pages_query->the_post();                   echo get_the_title();             endwhile;             // Reset Post Data             wp_reset_postdata();         }                    else echo 'no results found';                           }     add_action( 'wp_footer', 'get_page_list', 1);                function change_page_to_post( $pages_args ) {         $pages_args = array(             'post_type' => 'post',             'posts_per_page' => '1'         );           return $pages_args;     }     add_filter('myfilter', 'change_page_to_post');


title: Can't login to my admin area

text: I don't know what did I change, other than creating a new ftp account because the other one wasn't working with my ftp client. Now when I go to the login page, it doesn't accept my correct wp password, and this happens in the url: http://www.ieltsonlinecourses.com/wp- login.php?redirect_to=http://www.ieltsonlinecourses.com/wp- admin/profile.php&reauth=1 I haven't set any redirection of any kind. Please help me out, I can't login back to my own site! Thanks, Capex.


title: image in my post disappeared after I upload website to remote server

text: Before I upload my website to server, I created post with images which are uploaded to media, their url are, for example: http://localhost:40952/wp- content/uploads/2011/09/study_in-En.gif After I uploaded website to server, the link to the images in the post is not updated, therefore, the images are disappeared in post. Is there anyway I can update the images link automatically? It is very painful to go and fix every link url. Thanks.


title: Delete Categories and Tags from frontend

text: There is a function to generate post delete link from frontend: `get_delete_post_link( $id );` Are there any functions to generate categories and tags delete link on frontend? I have been looking for a core function for a while and couldn't find any. I tried to delete a tag using wp_nonce_url() without any success:               <a href="<?php echo wp_nonce_url('http://localhost/todo/wp-admin/edit-tags.php?action=delete&taxonomy=post_tag&tag_ID=2');?>">Delete Tag      When I click the link I get "Are you sure you want to do this?" and below that "Please Try Again" the nonce url generates fine. and needless to say I am logged in as admin. But I am still not able to delete the tag. Any help would be much appreciated. Thanks


title: Multisite with entirely different domains?

text: Just trying the multisite feature for the first time. The primary hostname is blog.domain1.com. When trying to create multiple sites, it only allows me to create XXXXX.blog.domain1.com. But what I really want is blog.domain2.com, blog.domain3.com, etc. All on the same Apache instance, same database, same IP. Is that doable directly with WP? I could try some Apache rewrite wizardry, but it just seems ugly. Any suggestions?


title: How do I create shortcodes for my wordpress themes?

text: I have seen many professional wordpress themes for sale that have shortcodes built in with which you could easily make posts like this:               [alert_box]This is an alert box which based on this short-code automatically     switches the CSS so it is easier than messing with classes every time[/alert_box]      How can I do this? I know that it requires you to add something to the functions.php, though I haven't been able to figure out how. Thank you, any help is appreciated.


title: How to parse row results from $wpdb -> get_results

text: I have the following:               $query = 'SELECT * FROM wp_pod_tbl_add_questions WHERE id LIKE '. $id;                                                  $row = $wpdb -> get_results($query);      How do I get the columns named 'id' and 'name' from $row?


title: Remove border attribute from Pin It Button image to pass HTML5 validation

text: I am using the Pinterest "Pin It" Button plugin http://pinterestplugin.com which uses this code on my blog pages:               <img border="0" class="pib-count-img" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" />      `border="0"` is causing my blog to fail HTML5 validation. I keep getting the error: 'The border attribute is obsolete. Consider specifying img { border: 0; } in CSS instead.' How can I remove the `border` attribute from the image used for the Pin It button so that my blog pages pass HTML5 validation?


title: Using password protection to load different page elements?

text: I have a page that is password protected, and I wish to removed some parts of the theme, and add others. Can I do that? Is there a check I can do in the theme files to see if a user has entered the password or not?


title: I am extending Walker_Nav_Menu: How can I get the number of children elements of the current item?

text: I am trying to extend the Walker_Nav_Menu walker to make some changes to the way WP outputs menus. The method I have to override is start_el, so I created my Walker and copied the base method:               <?php     class myCustom_Walker_Nav_Menu extends Walker_Nav_Menu {         function start_el(&$output, $item, $depth, $args) {             global $wp_query;             $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';                  $class_names = $value = '';                  $classes = empty( $item->classes ) ? array() : (array) $item->classes;             $classes[] = 'menu-item-' . $item->ID;                  $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );             $class_names = ' class="' . esc_attr( $class_names ) . '"';                  $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );             $id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';                  $output .= $indent . '<li' . $id . $value . $class_names .'>';                  $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';             $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';             $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';             $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';                  $item_output = $args->before;             $item_output .= '<a'. $attributes .'>';             $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;             $item_output .= '</a>';             $item_output .= $args->after;                  $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );         }     }       ?>      My problem is that I dont seem able to get the children for the current item ($item). Can somebody help me?


title: Can't call Javascript function - scope?

text: I get a method not defined error when trying to call a function loaded with `wp_enqueue_script` from `site.js`. I'm guessing it's because of scope caused by the jQuery ready wrappers? How do I get around that? **site.js** (loaded in `head`)               jQuery(document).ready(function($) {       $(window).load(function() { // wait until everything has loaded         doSomething(); // results in face palm       });     });      **my-script.js** (loaded in footer)               jQuery(document).ready(function($) {            function doSomething() {         alert("Time for a coffee break!");       }     });      **functions.php**               wp_register_script( 'my-script', get_template_directory_uri().'/js/my-script.js', array( 'jquery' ), '', true );     wp_enqueue_script( 'my-script' );     // Pass in PHP variables     wp_localize_script( 'my-script', 'my_script', localize_post_vars() );


title: Admin ToolBar not being displayed at top of site

text: Not sure what's going on, but even when I checked the "Show Toolbar when viewing site" and on functions.pho placed: `if (! current_user_can('manage_options')) { add_filter('show_admin_bar', '__return_false'); }` I can see the space where the admin bar is supposed to be placed but it is empty, a white bar, nothing on it, checked the source code and found this: `<style type="text/css" media="print">#wpadminbar { display:none; }</style> <style type="text/css" media="screen"> html { margin-top: 28px !important; } * html body { margin-top: 28px !important; } </style>` So not sure what else to do, any help? Thanks! A.


title: Menu id in nav menu ignored

text:
<?php      wp_nav_menu(          array(              'theme_location' =>'main_menu',             'container' => false,             'menu_id'=> 'nav'         )     );      ?>      After updating WordPress to 3.8 menu id is not working. Where is the problem ? I like to get menu as

Home

About


title: WP Theme Customizer - Responsive Elements

text: Within WP Theme Customizer, I am wondering if it is possible to allow users to set the size of a thumbnail based on the size of the screen? For example, the user could select (1) for screens above 981px, the thumbnail would be 300px, and (2)for screens less than 980px, the thumbnail would be 200px. I developed two options: Thumbnail Size - Medium Screen   Thumbnail Size - Large Screen                   <?php if( get_option('thumbnail_size_medium') ) { ?>.thumbnail {width: <? php echo get_option('thumbnail_size_medium'); ?>;}<?php } ?>              <?php if( get_option('thumbnail_size_large') ) { ?>.thumbnail {width: <?php echo get_option('thumbnail_size_large'); ?>;}<?php } ?>      With the code above, I would be using two, separate options to update the same CSS element - .thumbnail. Within my CSS stylesheet, I use "@media" to make responsive elements. Within the Theme Customizer, how do I account for the screen size?


title: Query users base on custom meta data

text: I have no idea how to write this and need a helping hand. What would be the query for users with custom role of "gamer"and by custom meta "location" and SORT by custom meta "position"? I've tried coping others and using their queries but I can't quite get it to work. Thanks in advance for any help!


title: Custom single.php files for different post formats

text:
I have 3 custom post formats. One is for image, one for video, and, one for gallery besides the default post and they each have a view comments link on the bottom right corner at the end of the post. Here is the code for that(it's in every formats php file):

 <a href="<?php comments_link(); ?>"> View responses

 -->
      **Check it out here:** http://benlevywebdesign.com/wordpress On the single.php page I would like to get rid/remove the view comments link because you don't need to see it when you are viewing the comments already(its redundant). I am new at wp and php so I need help I have already read the wp codex that tells you to just make single.php and single-post_type.php and I didn't work. I am not sure what to do now. Here is the current loop code in the single.php file: (it says in comment code "You are now viewing single.php" to see if goes to the single.php page as a test)
          <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>              <?php get_template_part('content', get_post_format()); ?>          <?php endwhile; else: ?>
Hmmm? Can't. Find. Post.
     <?php endif; ?>


title: Wp_redirect and sending variables

text: How to send some variables with wp_redirect() from function.php file in my theme folder?               if ( $post_id ) {             $variable_to_send = '1';             wp_redirect( home_url(), $variable_to_send );             exit;     }      And on homepage I will catch the variable in if-else condition to show some confirmation or not depending if $variable_to_send = '1' or not. How to do that in WordPress?


title: Create a short code to display a specific loop

text:
I'm breaking my head trying to create a short code to display certain loop, however I'm totally cut, I can not figure it out how to do it, since it's the first time I try to do it... I do now want to set any parameter, just put exactly as it if... I would appreciate if anyone can light me... This is the code I want to put into the shortcode

        <?php       $the_query = new  WP_Query(            array(               'post_parent' => '8',               'post_type' => 'page',               'posts_per_page' => 4,               'sort_column'   => 'menu_order'           )       ); ?>      <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
             <?php the_post_thumbnail('home-thumb') ?>
<?php the_title() ?>
             <?php the_excerpt() ?>             <a class="read-more" href="<?php the_permalink() ?>">en savoir plus <img src="<?php bloginfo( 'template_url' ); ?>/images/read-more.png">
       <?php endwhile; ?>      <?php wp_reset_query() ?>


title: Changing the Permalink Structure without Resetting the Facebook Like Counts?

text: When changing the permalink structure of a blog, Facebook and Twitter will treat the articles with new URLs as brand new articles and will reset that Tweet/Like counters. Is there a way to resolve this issue? Thanks.


title: Block metabox - No expanding, no moving around

text: I would like to make metaboxes as fixed elements, removing the expand function and the drag-and-drop function. Any ideas?


title: OOP Plugin and Menu - Call to undefined function register_setting()

text:
WordPress documentation seems spotty on object-oriented code. I'm setting up a few plugins and the first should register settings and a menu page. It's throwing "undefined" for the `register_setting()` or `add_settings_field()` calls. Should these go elsewhere? I'm not seeing the admin settings page get created either? Thanks for any help.               <?php     //$c = new mySettings();     class mySettings {              public function __construct() {             $this->add_hooks();             $this->register_settings();         }         public function add_hooks() {             add_action('admin_menu', array($this, 'admin_menu'));             add_action('admin_init', array($this, 'register_settings'));         }         public function register_settings() {             //exit('register_settings'. microtime());             register_setting('mySettings', 'mySettings', null);             add_settings_field('myUrl', 'API URL', array($this, 'myUrl_callback'), 'my');             add_settings_field('myOauthUrl', 'API Host', array($this, 'myOauthUrl_callback'), 'my');             add_settings_field('myClientId', 'API Client Id', array($this, 'myClientId_callback'), 'my');             add_settings_field('mySharedSecret', 'API Shared Secret', array($this, 'mySharedSecret_callback'), 'my');         }         public function admin_menu() {             exit('admin_menu'. mircotime());             add_options_page('my API Settings', 'my Settings', 'manage_options', 'my-my', array($this, 'settings_page'));         }         public function settings_page() {             if (!current_user_can('manage_options')) {                 wp_die(__('You do not have sufficient permissions to access this page.'));             }             print '
my API Settings
<form action="options.php" method="post">';             print settings_fields('mySettings');             print do_settings_sections('mySettings_selections');             print submit_button() .'</form>';         }         public function myUrl_callback() {             $options = get_option('mySettings');             $option = isset($options['myUrl']) ? $options['myUrl'] : '';             print '<input id="myUrl" name="mySettings[myUrl]" type="text" value="' . $option . '" />';         }          }


title: Wrap wp_nav_menu output around option tags for select menu

text:
I have set up a wp_nav_menu in Wordpress. I have 2 parent categories, with 2 sub-categories each, so this produces a nested list. My current code to call this menu is...               <?php wp_nav_menu(              array(                  'theme_location'    =>  'shop-categories',                 'container'         =>  'nav',                 'container_class'   =>  'shop-cat'             )          ); ?>      ... which outputs this... (I have simplified the code so you just get an idea of the markup)

           Clothing

T-Shirts

Tops

           Accessories

Earings

Hats

             Now I would like to output this...               <select>       <optgroup label="Clothing">         <option value="T-Shirts">T-Shirts</option>         <option value="Tops">Tops</option>       </optgroup>       <optgroup label="Accessories">         <option value="Earings">Earings</option>         <option value="Hats">Hats</option>       </optgroup>     </select>      ...is this possible to do dynamically? Or will it be better to do this manually? I have had a look around but couldn't find any help on this. Any help appreciated.


title: Is it possible to get the currently logged in admin's IP?

text: Given a wordpress (3.4.x) install that only has 1 admin, how would I grab, from within a plugin, the IP of the currently logged in admin, if there is an admin logged in? In other words: I need to obtain the IP of the admin, IF there is admin is logged in, and use this IP for other purposes. The request will not necessarily come in from the person logged in as admin. If there is no admin logged in, the function should return empty, as I only need the IP of the admin WHILE he/she is logged in.


title: Walker_Nav_Menu creating too many closing tags?

text:
created this walker below to create a set of tabs. All looks ok but in the source there are several more than there should be causing validation errors. I only want to generate a tab for 'question' post types. code -                       $mmArgs  = array(               'menu'            => 'competitionmenu',                'container'       => 'div',                'container_class' => 'summary_chart_tab_icons',                'menu_id' => 'summary_chart_tab_icons',               'menu_class'      => 'summary_chart_tab_icons clearfix',                'echo'            => true,               'walker' => new summary_walker_2013_TABS()         );              wp_nav_menu($mmArgs);          class summary_walker_2013_TABS extends Walker_Nav_Menu{          function start_el(&$output, $item, $depth, $args){              global $wp_query, $current_user;         $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';              $class_names = $value = '';              $classes = empty( $item->classes ) ? array() : (array) $item->classes;              $voted = hasVoted($item->object_id,$current_user->ID);         $voteMade = $voted[0];              $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );         $class_names =  ($voted ? ' voted' : '');         $icon_state=  ($voted ? '-voted' : '');              $class_names = ' class="tab-icon '.the_slug($item->object_id). esc_attr( $class_names ) . ' clearfix " ';              $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';         $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';         $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';         $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';              $icon_name = child_template_directory. '/images/images/tab-icon-'.the_slug($item->object_id).$icon_state;              if($item->object=='question' ) :                   $question = get_post($item->object_id);                  $output .= '
post_name.'"  ' . $class_names .'>';                  $output .='
';                  $item_output .=  ''.$args->after;                  $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );              endif;            }      } and extra closing li s are in twos before each * . I think it might be the menu items that aren't 'questions' coming through but how can i omit them in a walker? best, Dc


title: subdomain mulitsite on localhost in a subfolder

text: I have a sudomain-based WPMU installation locally with xampp. My `vhosts` lists domains like follows:               127.0.0.1 mainDomain.com     127.0.0.1 siteA.mainDomain.com     127.0.0.1 siteB.mainDomain.com     127.0.0.1 siteA.com     127.0.0.1 siteB.com      The `WordPress MU Domain Mapping` PlugIn maps "real-domains" on system- subdomains. To have a standard project structure, I would like to move my installation from the documentRoot to a subfolder. My question is, what do I need to do, to accomplish that and will it have any consequences for the compatibility between my local- and a live-system?


title: Wordpress functions give fatal error in included php file

text: First, my problem is similar to this thread. However, the solution posted there doesn't work for me. I'm creating a plugin that displays a contact form on a page using the Shortcode API. Plugin folder contents:   * contact.php (main plugin file)   * validate.php (included php file) The main file has the usual plugin header, and WordPress functions called in it work as expected [i.e: get_permalink()] The validate.php file is included in contact.php as follows:               define ("PLUGIN_PATH", plugin_dir_path(__FILE__));     include_once dirname( __FILE__ ) . '/validate.php';      My problem is any WordPress functions called in validate.php will throw a fatal error. PHP functions work as expected, only WordPress functions are throwing a fatal error:               Fatal error: Call to undefined function sanitize_text_field() in /{FULL WEBSITE PATH}/ralrom-contactform/validate.php       How should I be including the validate.php file to be able to call WordPress functions from it? I have tried "require" and "include" variations and all throw the same fatal error. **Before using multiple files, I had a working version as a single file shown here:** Orignal working code under a single php file: http://pastebin.com/qM5aj9qY Broken code under two php files: http://pastebin.com/KUCbg6rJ


title: Function to remove all classes on images inserted into posts?

text: I'd like my images to have no classes assigned to them by default, as I (sometimes) add my own classes to create custom 2 column layouts... can I do this without hacking the core? From my googling it looks like image_send_to_editor would work, but creating a regex for this is beyond me...                     to


title: Getting thousands of registration spam

text: We have tried the range of Captcha options, and now have Facebook Connect with Akismet installed as a constant, but still can't stop thousands of spam registrations from attacking our WordPress site. There must be a solution. Can anyone help?


title: $before/after_widget/title not displaying anything

text:
I have built a custom widget with this code:               class rfw_dock extends WP_Widget {         function __construct() {             parent::__construct('rfw_dock', __('TITLE'), array( 'description' => __( 'DESCRIPTION')));         }         function widget($args, $instance) {             $title = $instance['title'];             $rss_url = $instance['rss_url'];             $rss = fetch_feed($rss_url);             $rss_items = $rss->get_items( 0, 1 );             echo $before_widget;             if ( $title )                 echo $before_title . $title . $after_title;             foreach ($rss_items as $item) {                 echo '
get_permalink() ) .'" target="_blank" rel="nofollow">
'. $item->get_title() .'

';             echo $after_widget;             }         }         function form($instance) {             $title     = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';             $rss_url     = isset( $instance['rss_url'] ) ? esc_attr( $instance['rss_url'] ) : '';             $number    = isset( $instance['number'] ) ? absint( $instance['number'] ) : 6; ?>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title (optional):' ); ?>              <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />

<label for="<?php echo $this->get_field_id( 'rss_url' ); ?>"><?php _e('Enter the RSS feed URL here:'); ?>             <input class="widefat" id="<?php echo $this->get_field_id( 'rss_url' ); ?>" name="<?php echo $this->get_field_name( 'rss_url' ); ?>" type="text" value="<?php echo esc_attr( $rss_url ); ?>" />
<?php          }         function update($new_instance, $old_instance) {             $instance = array();             $instance['title'] = strip_tags($new_instance['title']);             $instance['rss_url'] = strip_tags($new_instance['rss_url']);             $instance['number'] = (int) $new_instance['number'];             $instance['show_feed_title'] = ($new_instance['show_feed_title']==true);             $instance['feed_words'] = (int) $new_instance['feed_words'];             $instance['content_display'] = strip_tags($new_instance['content_display']);             return $instance;         }     }     register_widget('rfw_dock');`      And registered this sidebar:               register_sidebar( array(         'name' => __('Søstersider'),         'before_widget' => '
',         'after_widget' => '
',         'before_title' => '
',         'after_title' => '
'     ) );      Pretty straight-forward, right? Well, my problem is that the `$before_title`, `$after_title`, `$before_widget` and `$after_widget` doesn't return anything, even though they're specified in the code. Isn't those variables how you're supposed to define the information in the register_sidebar? At least, it is in default-widgets.php. I'm sorry, but I'm not the best in PHP, although I consider myself to have a medium-levelled knowledge in it. I've tried a lot before posting this, but nothing works. Can someone please help me out? Thanks.


title: Covert Wordpress Blogname into JQuery

text: Here is the blogname in php `<?php $blog_title = get_bloginfo('name'); ?>` I want to convert it to javascript. The file I want the blog name is in a .js file so I cant create the variable with php.


title: Woocommerce display one random product via php

text: I am trying to display one random product in my template header. So each time someone visits or refresh there will be a different product displayed in the header. I searched and found this               <?php     echo do_shortcode('[products ids="1, 2, 3, 4, 5"]');     ?>      But this only displays products which have ids mentioned in this call. Is there anyway to get one random product?


title: How to block a someone from commenting?

text: I keep getting spammed by the same user, well different name and site listed but always the same email, IP, and comment. the email is `1p@ultradrugbuy.com`, the IP is `31.184.238.9`, and the message is long and always the same. I want to do 2 things:   * How can I block this person from commenting?   * I have over a hundred pending from them, is there a way to mark them all as spam?


title: How can i increase the login expiration length?

text: As the title says, how can i increase the login expiration period? Running a local install it's a little annoying to have to keep logging in, despite the fact i have the browser remember login credentials it's an extra step i have to perform everytime i fire up the local server. I assume if i increase the cookie expiration period i'll avoid the need to keep logging in(as often). Have googled and searched the forums, but all i found were unresponded to threads and i'm not in the mood for digging through code to work it out. I don't need an in-depth answer, just some pointers on suitable hooks(if any exist for this purpose), i can work out the rest from there. Off to find somewhere cool to sit now, upstairs is roasting hot right now(hot weather here) i think the laptop might just die if i keep it on any longer, i'll be keeping tabs on the question from another system in a cooler area of the house though and looking forward to any pointers you guys have for me.


title: Display thumbnail of child, parent and ancestor using featured thumbnails

text:
I have tried to achieve that the Home page displays featured images of all it's child pages and in turn some child pages are displaying the featured images of their child pages. This is my code so far!               <?php             global $post;                  if ( is_page() && $post->post_parent ) :                   elseif ( is_page() && $post->post_parent && $post->child_page ) : ?>                  <?php else : ?>                 <?                 $child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT');                      if ( $child_pages ) :                     foreach ( $child_pages as $pageChild ) :                         setup_postdata( $pageChild );                         $thumbnail = get_the_post_thumbnail($pageChild->ID, 'index-thumb');                         if($thumbnail == "") continue; // Skip pages without a thumbnail                 ?>
                         <?php                             echo '
' . get_the_post_thumbnail($pageChild->ID, 'index-thumb', array('class' => 'img-responsive', 'id' => 'img-center')) . '
';                             echo '
' . get_post(get_post_thumbnail_id($pageChild->ID))->post_title . '
';                             echo '
' . get_post(get_post_thumbnail_id($pageChild->ID))->post_excerpt . '
';                             echo '
' . get_post(get_post_thumbnail_id($pageChild->ID))->post_content . '
';                         ?>
                 <?                     endforeach;                 endif;                 ?>             <?php endif; ?>


title: Sort posts after filtering them through multiple taxonomies

text: I'm using scribu's Query Multiple Taxonomies to filter posts through multiple taxonomies (which works great!). However, I'd like to allow people to perform further sorting on the results based on custom fields which have numeric values (eg. `rate_per__private_session` or `rate_per_group`) by clicking on a link. I thought that something like the following would be all there was to it but clearly it is not.               <a href="<?php query_posts($query_string . '&meta_key=rate_per_private_session'); ?>">Sort by Rate per Private Session |      <a href="<?php query_posts($query_string . '&meta_key=rate_per_group'); ?>">Sort by Rate per Group      How do I do this?


title: WordPress and $_GET Params

text: This is an odd problem that I have never run into before with WordPress. I have a site, permalinks enabled. The url can be http://mysite.com/page-name/?anyParamName=testing then when I use `print_r($_GET);` or echo `$_GET["anyParamName"]` I get an empty array or nothing respectively. A pure PHP file works fine so its not a server issue. Does WordPress do anything with rewiring the get params? Really puzzled by this.


title: Password protect media attachment - share across guests

text: I'd like to show certain content to people with a password, specifically links to media files like this:               <?php if($currentuserid == foobar): ?>        LINK     <?php endif; ?>      If I were to create a user with ID `foobar`, and then give its password to several people, would it cause any problems if they all decided to use it at once? I would only want to use their logged-in status to show/hide certain content - they would not be accessing the admin side.


title: Switching theme only changes style sheet being used

text: I have a plugin that I'm using to switch themes for a specific user for development. When logged in as that user they see the different style sheet but the themes files, function.php, header.php, etc are the active theme for everyone else. What I am doing wrong?               function change_user_theme($template) {         global $user_ID;              if ( in_array( $user_ID, array( 5 ) ) ) {             $template = 'fezmobile';         } else {             $template = 'fezforprez';         }              return $template;     }          add_filter('template', 'change_user_theme');     add_filter('stylesheet', 'change_user_theme');     add_filter('option_template', 'change_user_theme');     add_filter('option_stylesheet', 'change_user_theme');


title: How to query and update one colum in postmeta table?

text: I'm trying to make a popularity calculation for all posts, based on page view and date of creation. Initially, there's a default popularity value saved in postmeta. Every hour I want to recalculate the popularity among all posts by cron job. How can I update all post's popularity in postmeta table?


title: How to determine whether we are in add New page/post/CPT or in edit page/post/CPT in wordpress admin?

text: This seems like simple thing but I need way to determine whether the current screen is for **Add New** or **Edit** ( a sort of wordpress admin conditional tag). Is there a built in function for this already, or ... any idea how to accomplish?


title: What is wrong here? Issue with post_id and meta_value

text: I'm trying to create a loop to read all the meta_value records from a given post_id. The idea is to gather all the meta_value's data from wp_postmeta table related to post_id number and print them as a list. But so far, I couldn't make this work. The issue is my 'custom_fields' variable. There I need to put my meta_key. But I have several meta_key per post_id. For example, the post_id 2171 has data2,date3,data4,data5.. data19 as meta_key. So, how can I get this working?               function jb_applicant() {        global $wpdb;        $custom_fields = get_post_custom(2171); //2171 is the post_id that I'm trying to gather the data from        $my_custom_field = $custom_fields['data2'];        $op = '';        foreach ( $my_custom_field as $key => $value ) {           $op .= $key . " => " . $value . "<br />";        }        return $op;     }     add_shortcode('applicant', 'jb_applicant');      Thanks


title: Add multiple="multiple" attribute to categories dropdown

text: I have a dropdown with Regular select. I need a dropdown with Multiselect. I added the JavaScript script file inside `header.php`, now I need add string `multiple="multiple"`. In firebug I `multiple = "multiple"` in a string > ![enter image description here](http://i.stack.imgur.com/qxB6c.png) Now I need add string `multiple="multiple"` in to this block but I don't know how do this:               <?php        $terms = wp_get_post_terms( $post->ID,"listing_category" );       $terms = isset($terms[0]) ? $terms[0]->term_id : "";            if(get_field("custom_attributes_input_types","options") == "Dropdowns"):         wp_dropdown_categories(            array(              'taxonomy' => 'listing_category',              'hiera`enter code here`rchical'=>1,              'show_option_none'=>__('Choose Category:','um_lang'),              'name' => 'listing_category',              'hide_empty' => false,              'selected' => $terms           )         );       else:     ?>


title: Wordpress : Explain Plugins & Theme string value in database

text: i have installed wordpress and i i have installed couple of plugins and i have got two themes already came with wordpress. What i am asking about today is : what does the Plugins & Theme string value in database mean ? Example [When plugins are active] , there is a value on table of :               a:3:{i:0;s:19:"akismet/akismet.php";i:1;s:9:"hello.php";i:2;s:37:"one-click-logout/one-click-logout.php";}      Example [When there are themes on the Themes folder] , there is a value on table of :               a:2:{s:12:"twentyeleven";s:7:"/themes";s:9:"twentyten";s:7:"/themes";}      I could get an explanation of what does the "a" and "i" mean from HERE , but the "s:" is what i do not know what does it mean. If i tried to change the s:37 to s:6 or any other value , the plugin becomes deactivated , so the s:37 <<< the 37 must mean something or related to the plugin somehow and that`s what i am trying to find out.


title: Why are theme templates organized as multiple point of entry PHP files instead of reusing your theme's index.php?

text: I've started to develop my own theme in the past couple weeks (and extracting WP functionality here and there in the past year), and I'm finding the structure of the WP templates awful redundant. Although that yes, technically, the blog starts somewhere higher above to load the WP functionality, the main WP_Query object, and some global variable preparation - I don't understand why every themes that I've stumbled upon so far splits the template files as:   * 404.php;   * archive.php;   * index.php;   * single.php;   * page.php;   * search.php;   * ... etc; Those files basically duplicate a lot of PHP code to fetch the Header, Sidebar and Footer. Wouldn't it be cleaner to have one (1) `index.php` file that includes the **Header** , **Sidebar** , **Footer**... and within the `index.php` file - you could decide how to show the content? I'm not sure I understand the need to have separate files. If you need to change the title in your `<head>` tag, why not use the power of **output-buffering** (`ob_start()` and `ob_end_clean()`)to get the posts first / the page / the single post / the search results... Is there performance issues using this technique? Could I run into problems if I wish to make my theme **mobile-friendly** , and readable by **RSS feed readers**? **-------------- EDIT:** I bring up this question because there is PHP methods that exists to detect in which section the user is visiting (ex: `is_single()`, `is_page()`, `is_archive()`, `is_home()`, etc...) and I would like to know if those could be used to achieve a central point for my `index.php` file.


title: Hide admin toolbar based on a query string

text: As far as I know the showing and hiding of the admin toolbar on the front-end is a global setting, which applies to any page containing `wp_footer()`. I want to have more specific control over the visibility admin bar—specifically, to be able to hide it based on a URL query string, such as (e.g., `?hidetoolbar` at the end of a URL). I know that I can hide the toolbar from a specific **template file** by adding this to the top:                    add_filter('show_admin_bar', '__return_false');      What hook would I use to apply the filter conditionally in **functions.php**?


title: The Pagination doesn't work

text:
i have made a new WordPress Theme and ive done .. but i have one problem. I can't get the pagination work. I use the "wp-paginate" plugin and i have put the folloing code on my index.php               <?php if(function_exists('wp_paginate')) {     wp_paginate();     } ?>      But that doesn't work for my site. There is still nothing on the frontend and in the markup. What can i do? Here is my index.php:                   <?php get_header(); ?>

              <?php if ( ! have_posts() ) : ?>
Nicht gefunden!

Sorry, leider konnte der gewünschte Artikel nicht gefunden werden. Vielleicht hilft Ihnen die suche ja weiter!
         <?php endif; ?>              <?php while ( have_posts() ) : the_post(); ?>                  <?php get_template_part( 'loop-index', 'index' ); ?>
              <?php endwhile; ?>
           <?php if(function_exists('wp_paginate')) {         wp_paginate();     } ?>          <?php get_sidebar(); ?>          <?php get_footer(); ?>


title: Two wordpress mu installs, same settings/plugins/themes?

text: I run two wordpress mu installs. They are both indentical in terms of plugins, themes and network-wide settings. The reason I run two is because they have different root-domains and different superadmins. Is it possible to simplify this setup somehow?