title: Categories and page filtering with pre_get_posts

text: I have 3 pages, "Page 1" shows custom post-type "articles", "Page 2" shows custom post-type "tips", and "Page 3" shows both custom post-types. This is done conditionally with a custom loop in `page.php`. Both post-types have the default "category" taxonomy as well as an extra custom taxonomy for each type. When you're on a page and click on the category link associated to a post you go to `/category/cat/`. My current `category.php` template pulls in both "articles" and "tips" that match that category. What I want to do is if you click on the category when you're on 'Page 1" then only show "articles" in the category template, if you're on "Page 2" then only show "tips". And on "Page 3" show both. I've been trying to do this with `pre_get_posts` but I'm not sure how to implement it. Should I create different templates for each page? Should I just POST an extra variable and modify the query in `category.php`? Any ideas are welcomed.


I am generating the following notice in the options-framework.php. Notice: Undefined index: in options-framework.php I believe it is something to do with sanitization, but do not know how to resolve this issue. I have the following arrays defined in options.php               // Pull all the custom taxonomies into an array     $options_password_taxonomies = array();     $taxonomies_password_terms_obj = get_terms('password_gallery_category');     foreach ( $taxonomies_password_terms_obj as $taxonomy) {         if( isset( $taxonomy->term_id ) ){             $options_password_taxonomies[$taxonomy->term_id] = $taxonomy->name;         }     }           // Select a Category for your Client Area     $options[] = array(         'name' => __('Password Protected Galleries', 'shutter'),         'desc' => __('Choose a category for password protected client galleries.', 'shutter'),         'id' => 'client_area',         'type' => 'select',         'options' => $options_password_taxonomies);      options-framework.php               // For a value to be submitted to database it must pass through a sanitization filter         if ( has_filter( 'of_sanitize_' . $option['type'] ) ) {             $clean[$id] = apply_filters( 'of_sanitize_' . $option['type'],   $input[$id], $option );         }     }


title: Getting wp.me shortlink for wordpress custom post type

text: There is a button called "get shortlink" for wordpress builtin post type & pages. If we click on it we can get wp.me shortend url for that particular post This can also be got using the function wp_get_short_link() in the template file. However this doesn't seems to work for the custom post type. I used the following code to get shortlink to work on custom post type, but it outputs the default shortlink which is www.mysitename.com/?p=234, but i require wp.me shortlink for my custom post type.               if( !function_exists( 'my_theme_cpt_shortlinks' ) ) {     /**      * Allow shortlinks to be retrieved for pages and custom post types      */     function my_theme_cpt_shortlinks( $shortlink, $id, $context, $allow_slugs=true ) {     /**      * If query is the context, we probably shouldn't do anything      */     if( 'query' == $context )         return $shortlink;          $post = get_post( $id );     $post_id = $post->ID;          /**      * If this is a standard post, return the shortlink that was already built      */     if( 'post' == $post->post_type )         return $shortlink;          /**      * Retrieve the array of publicly_queryable, non-built-in post types      */     $post_types = get_post_types( array( '_builtin' => false, 'publicly_queryable' => true ) );     if( in_array( $post->post_type, $post_types ) || 'page' == $post->post_type )         $shortlink = home_url('?p=' . $post->ID);         //$shortlink =  wp_get_shortlink($post->ID);          return $shortlink;     }     }          add_filter( 'get_shortlink', 'my_theme_cpt_shortlinks', 10, 4 );      Is there any way to modify the above function to get wp.me shortlink for the custom post type instead of default shortlink?


title: Count number of posts of current month

text: I am trying to echo the number of posts for the current month from all categories but it isnt working.               <?php     $month = date('m');     $year = date('Y');     $countposts = get_posts('post_type=post&year=' . $year . '&monthnum=' . $month . '&cat=3');     echo 'New posts '  . count($countposts);     ?>      category 3 is a parent category and has many sub categories. No matter what I do, it returns the value 5. I have published 30 posts for this month to test it but it doesnt count them. :( What Im I doing wrong? **Update** I have tried the following query and returns the same outpout                   <?php     wp_reset_postdata();     $current_year = date('Y');     $current_month = date('m');     $args = array(         'cat'      => 3,         'year'     => $current_year,         'monthnum' => $current_month,         'post_status'     => 'publish',         'post_type'       => 'post'     );     $number_posts = get_posts( $args );     echo 'New posts '  . count($number_posts);     ?>


title: Wordpress plugin creating sidebar on the theme/page

text: I am creating a plugin and I need it to create a sidebar on the page, but I have no idea what to do or what to search. So once my plugin is activated, the sidebar needs to appear. The color and text are set by the user in plugin settings. I have already done that and now I need that sidebar to appear once I activate it. Any suggestions?


title: Custom order categories in admin dashboard

text: everyone, is there way to order categories in add/edit post in admin dashboard. The problem is my order must be custom, not by Name or ID. For example:   * Rumors (id 5)   * News (id 1)   * Features (id 7)   * etc. The ideal solution will be to order categories by description. That way in category description field I will put number or letter and categories will order right. Thank you in advance!


title: This webpage has a redirect loop issue

text: I want to redirect non logged in users to page id = 2 which have registration form.                   function checkLogged()     {         $pg = get_permalink();         if (!is_user_logged_in() && !is_front_page() && $pg != home_url('/?page_id=2'))         {             wp_redirect(home_url('/?page_id=2'));             exit;         }     }     add_action('wp_head', 'checkLogged');      Is this code correct ? I am getting > This webpage has a redirect loop The webpage at > http://abc.com/dsdd_wordpress/?page_id=2 has resulted in too many redirects. > Clearing your cookies for this site or allowing third-party cookies may fix > the problem. If not, it is possibly a server configuration issue and not a > problem with your computer.


title: Theme specific plugin, how?

text: Can someone tell me whether it is possible to create a plugin that is only available to a specific theme and how do I override certain settings in that theme? **The problem** This is basically the story. We've had a third party design and create a wordpress theme for us. Now it's up to us to expand the functionality of the theme by creating a plugin that will only be valid when someone has our theme installed. Are there specific functions available to achieve this? Thanks in advance.


title: How to turn system default url into friendly urls?

text: We have been using wordpress for everything and we are really happy with it! While we can customize the way our friendly urls look though, there does not seem to be a way to do the same for the system default urls? For example, if a user tries to post a comment with a required field left blank, they will land in /wp-comment-post.php with a message that they forgot a required field. Isn't this a bit odd and ugly looking? Why would anyone choose to direct to straight files? Is there a way to customize all these system urls to more friendly versions? I had a good look around the web but the choice of keywords as well as not much interest from people to change this didn't give me any good results! Please keep in mind we are using IIS so an .htaccess solution would not work here, but we could try using the iis rewrite engine? Thanks


title: Retrieve posts by term id custom query

text: i want to retrieve custom posts using using custom query . my taxonomy is recipe_tx and terms (Beef) , (Chicken) etc in it . i have tried using               SELECT p.* FROM wp_posts p, wp_term_taxonomy tt, wp_term_relationships tr      WHERE p.ID=tr.`object_id`      AND tt.`term_id`=tr.`term_taxonomy_id`      AND (p.post_type = 'recipe_cpt')     AND p.post_status = 'publish'     AND tt.`term_taxonomy_id` = 37      but no luck . can someone help me how to get wp posts by their term_id . if beefs id is 37 then i want to retrieve all the posts with `term_id = 37` Thank's


title: Exclude post ID from wp_query

text: How can I exclude one specific post from a WP_Query query? (For example, show all posts apart from a post with the ID 278) I've tried the post__not_in argument but it just removes all posts.. Any help would be great. Here is my current query               <?php         $temp = $wp_query;         $wp_query= null;         $wp_query = new WP_Query(array(             'post_type' => 'case-study',             'paged' => $paged,         ));         while ($wp_query->have_posts()) : $wp_query->the_post();     ?>      Thanks


title: Adding custom URL rewrite rules

text: I want to use 2 custom post queries on the author profile page, both of the queries uses pagination. With the following pagination function, I get this URLs structure:               http://localhost/author/admin/?xpage=2     http://localhost/author/admin/?ypage=2      Is it possible to re-write the above URLs to make them like:               http://localhost/author/admin/x/2     http://localhost/author/admin/y/2      I'm using following function for each of it to create the pagination:               echo paginate_links( array(             'base' => add_query_arg( 'xpage', '%#%' ),             'format' => '',             'prev_text' => __('«'),             'next_text' => __('»'),             'total' => ceil($total / $per_page),             'current' => $page         ));      I have been trying the WordPress function `wp_rewrite` and `generate_rewrite_rule` but could not make it work.


title: Where do I add html code to the menu div?

text: When looking at header.php, I see the following line:               <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>      That function is defined in nav-menu-template.php and generates the 'menu- custom-menu-container' div. Let's I want to add a div after the navigation list inside the 'menu-custom-menu-contaner' div. Where would I do that?


title: Can a Child Category Have More than One Parent?

text: I'm looking at the `get_categories()` function in the WordPress codex to see how I can return all of the children of each "root parent" ( categories that have no parents ). For example, if I am interested in the children for multiple "root parents", I'd like to know if there will be more than one instance of the same child under a different "root parent". So, this leads me to ask: **Can child categories in WordPress have multiple, different parents?**


title: Show post title words one by one

text: How to show post title words one by one, but to exclude words with 3 or less characters. Also it would be nice to be able to exclude some words, for example to make some list of words to exclude from showing. Point is to show post title words one one but to exclude common words with 3 or less characters such as: the, is, at, and, on, it... And also to have option to make list of any unwanted words. This is what I have so far, it gets title words, one by one, but without excluding any word.               <?php     $title = get_the_title();     $parts = explode( ' ', $title );     echo $parts[0];     echo $parts[1];     echo $parts[2];     //...     ?>


title: Posts only displaying on tax archive of first selected tax

text: So I have a c.taxonomy 'Types' under which are 'Type-Term 1' and 'Type-Term 2'. If 'Post A' is tagged as "'Type-Term 1', 'Type-Term 2'" it will only show on the 'Type 2' term archive. How can I have a post that is tagged with both terms show up on both archives? Thanks!


title: Create custom permalinks to show Custom Post Type's relationship?

text: I'm creating a WordPress site that has 3 custom post types registered: `course`, `chapter`, and `lesson`. All of these post types are inter-connected and share a relationship using custom fields. For example, the `chapter` has a custom field that stores the `course` post object in which it belongs to. Same goes for the `lesson` and the `chapter` it belongs to. My permalink settings are using the: `%category%/%postname%/` structure, in which display the post's URL like so: `www.domainname.com/custom-post-type-name/post-name` What i'm trying to accomplish is to create a custom permalink structure that shows the relationship between these 3 post types in the URL. Example below: When user is on course: `www.domainname.com/course` When user is on a chapter: `www.domainname.com/course/chapter` When a user is on a lesson: `www.domainname.com/course/chapter/lesson` While looking in the WordPress Codex, I found the the Rewrite API and WP_Rewrite(), I'm a little lost and i do not know where to begin. Any help on this would be greatly appreciated.


I am in need to do some operation if user clicks on **Network Activate** button on my WP Plugin (in WP Multisite). But I noticed that Wordpress's is_plugin_active_for_network function not working for multisites when I press the Network Activate button from the Main Administrator Panel. It returns nothing, and hence the               if(is_plugin_active_for_network('abc/abc.php'))      is not fulfilled. However when the Network is already Network Activated then the function - **is_plugin_active_for_network** is working fine (It returns **1** \- i.e. **true** ). Can anyone please tell me how can I check whether the **Network Activate** button is clicked by the main administrator?


title: Add the results of a custom query into a do_shortcode

text: I'm trying to add the post list from a custom query               while ( $the_query->have_posts()) : $the_query->the_post();       into the content of a `do_shortcode`. How can I do this?


title: wp_sanitize_redirect strips out @ signs (even from parameters) -- why?

text: In my wordpress site I have a hack that looks at the uri and does a redirect to a subdomain. The problem is wp_redirect calls wp_sanitize_redirect which will strip out @ signs, so when a user tries to load something like oursite.com?email=foo@bar.com The page that gets loaded should be prefix.oursite.com?email=foo@bar.com but instead it's prefix.oursite.com?email=foobar.com (i.e. - no @ sign) The problem is easy to work around - I just manually encode @ signs as %40 before calling wp_redirect. Question: why does wp_sanitize_redirect strip out @ signs, exactly? Anybody could anyway try to load a url with an @ sign in it - is there some security issue I'm not thinking about? EDIT: The function I'm talking about is wp_sanitize_redirect


**How would go about if I just want a temporary function?** (It's a converter just for converting Access to Wordpress tables). I want to execute several times so therefore I want it automated, but I don't know how to execute the function after adding the filter in add_action(). After I'm done converting, I will delete the function. I want to do something like `http://url/index.php?convert`               function addcoursecategoriesfromaccess() {         //code for converting the table     }     add_action('convert','addcoursecategoriesfromaccess');          //If I type http://url/index.php?convert then I want the addcoursecategoriesfromaccess()  to execute     if ($_REQUEST['GET'] == 'convert') {         do_action('convert');     }      I guess I'm missing something very simple, but as a newbie in WP-programming I hope you can help me out :-) I've the code inside functions.php in the theme.


title: get_the_terms return only last term

text: In my custom post type (portfolio_pt) I have some hierarchical category structure something like that:               ParentCat     |-child         |-someItem     ParentCat2     |-cild     ...      When I try to get list of all terms by get_the_terms function for "someItem" post this function return only last category ("Child Cat" without "Parent Cat") example:               global $post;     $terms = get_the_terms( $post->ID, 'portfolio_pt_category' );      I try to use get_the_term_list function but effect is the same, it returns only last category. Thanks for help!


title: How To Include JavaScript Files Only In Single Posts?

text: I know that `wp_enqueue_script()` inserts Javascript files into the WordPress header in the appropriate place. However, I want to include my Javascript in all single posts, ignoring the WordPress home or blog page.   Is that possible at all? I tried this:               <?php     function my_scripts_method() {         if ( is_single() ) {             wp_deregister_script( 'jquery' );             wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');             wp_enqueue_script( 'jquery' );         }     }     add_action('wp_enqueue_scripts', 'my_scripts_method');     ?>      But it's not working...


title: Can't change a label in woocommerce with the normal filter

text: // Hook in       add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );          // Our hooked in function - $fields is passed via the filter!     function custom_override_checkout_fields( $fields ) {      $fields['order']['order_comments']['placeholder'] = 'Special delivery requirements';      $fields['billing']['billing_company']['label'] = 'Company name if applicable';      $fields['shipping']['shipping_company']['label'] = 'Company name if applicable';      $fields['billing']['billing_address_2']['placeholder'] = 'House number / name';      $fields['shipping']['shipping_address_2']['placeholder'] = 'House number / name';      $fields['billing']['billing_state']['required'] = true;      $fields['billing']['billing_state']['label'] = 'County <abbr class="required" title="required">*</abbr>';      return $fields;     }      I've used thIs code to change some fields for the woocommerce checkout form. For some inexplicable reason, the label for the billing state refuses to change. Even though the label for billing company had changed the successfully, the label for the billing state refuses to. It has successfully become required but I can't change the label. Does anyone know what I am doing wrong or if this is a bug.


title: Custom query from plugin table

text: I have a problem, I use booking system pro plugin can I make a query to loop post filtered by availability on booking system pro plugin table?


title: Return all users with a specific meta key

text: I'd like to use `get_users()` to return all users that have a particular meta_key, but I don't want to specify what the value has to be because it will change for every user. The value is a json string. Is this possible?


title: Order the users by the date of their latest post

text: I use the following code for getting the authors of in my multi-author blog and order them by their post count. I want to order them by the date of their last post               $authors = get_users('role=author&orderby=post_count&order=DESC');


title: YOAST extend sitemap

text: I've written a Wordpress plugin that retrieves a json list from a server. This list is used to dynamically display content based based on various url paramters. I want that content to be included in my sitemap without having the need to programatically create "static" wordpress pages for every item since this content is growing on a daily basis. Now i'm looking for a way to add this list to a custom yoast sitemap. Is it possible, whenever yoast updates its sitemap, to include my custom sitemap? And is there a way to force yoast to recreate the sitemap? thanks for your help. cheers.


title: Changing Theme and affecting the SEO

text: I have a WP theme based on the Genesis Framework and I am considering, (I would stress the word considering, because I know what sort of problems it can cause) changing my website theme. Not that there is anything wrong with it, just thinking about a change…if it’s not too stressful… Does anyone know if this can cause any change in SEO rankings please? Thanks in advance.


title: Custom options in plugin, register_settings not working as no options.php?

text:
I'm having trouble getting a custom plugin to save options, as it cannot find options.php (and I don't know where it's supposed to be) The full code for the plugin:               add_action( 'admin_menu', 'dotmailer_menu' );               function dotmailer_menu() {         add_options_page( 'Dotmailer Options', 'Dotmailer Details', 'manage_options', 'dotmailer', 'dotmailer_options' );     }               function dotmailer_options() {     ?>
         <form method="post" action="options.php">         <?php settings_fields( 'settings-group' ); ?>         <?php do_settings_sections( 'settings-group' ); ?>                  API key
             <input type="email" name="apiemail" value="<?php echo get_option('apiemail'); ?>">
             Password
             <input type="password" name="apipassword" value="<?php echo get_option('apipassword'); ?>">

<input type="submit" value="Save" class="button-primary" />
         </form>
     <?php      }          function register_settings() {               register_setting('settings-group','apiemail');             register_setting('settings-group','apipassword');         }      When I submit the form, it simply returns an error saying that it cannot find options.php. Am I supposed to create options.php myself? I have used similar code before without creating options.php myself and not had a problem.


title: Codex: Database Description: meaning of Cardinality

text: The following post outlines how to word cardinality is commonly used when dealing with databases: http://stackoverflow.com/questions/10621077/what-is- cardinality-in-databases. However I have not been able to comprehend how this term is used on the database desciptions page on the codex: Database_Description - Table:_wp_postmeta > Keyname Type Cardinality Field > > PRIMARY PRIMARY 13 meta_ID > > post_id INDEX 15 post_id > > meta_key INDEX 7 meta_key What do 13, 15, and 7 mean here. I have no clue as to what the numbers in the cardinality field refer to on this page. Thanks.


title: Excerpt vs content formatting woes

text:
One of my posts has the following content:               This is a test post. Nothing more,     nothing less.     Three lines before the jump          And a couple of more lines     after the jump.      _Note_ : these were written as you see them, in the WP editor, using the HTML tab - so we have no hidden `<br>` or anything else going on in the post content. _Also_ : No Manual Excerpt was defined for this post. If I use `the_content()`, I get this:
This is a test post. Nothing more,
      nothing less.
      Three lines before the jump

»
       If, however, I use `echo get_the_excerpt();` I get this:               This is a test post. Nothing more, nothing less. Three lines before the jump      No `<p>`s, nor `<br />`s ( _heck_ , not even the `[...]` I was half- expecting!) What I'd really like to achieve in my theme is (within The Loop, of course):   1. If a manual excerpt exists: display that (and I know I'll have to tweak the `[...]`)   2. Else, display the content, respecting any `<!--more-->` you may find. So, I was starting with this               $excerpt = get_the_excerpt();     if($excerpt=='') { //right, isset or empty may be better         the_content();     } else {         echo $excerpt;     }      But I'm getting the feeling there's a better way? Or is there a quick fix for the formatting issue mentioned above?


title: Get the Term List - Ordering

text: I have a country taxonomy with children taxonomies > state & city. For a given entry for a restaurant in Nantucket, I want it to say "Nantucket, Massachusetts, United States (each linked to those taxonomy pages)", but the code I have gotten to work (I'm new to PHP) outputs: Massachusetts, Nantucket, United States               $terms_as_text = get_the_term_list( $post->ID, 'country', '', ', ', '' ) ;      echo strip_tags($terms_as_text);      How to I get this to order by the reverse hierarchical order of the taxonomy > City, State, Country? Thanks, in advance, for any help!


title: wp_list_categories and custom post types

text: I'm confused.   * I have a custom post type "asset".   * I created posts, and they are all at `/asset/post-title`   * I assigned categories to the custom post type, e.g. "patterns"   * The categories page shows the number of posts in each category   * If you look at the post meta for any of these posts in single view, it displays the category(ies) assigned to it. HOWEVER, it you click the category link in the post meta ("patterns"), I get a page "nothing found". If I assign the category to a **normal** post type, those will show of the category page. What did I forget? EDIT: I should also add that the LINK for "patterns" is `/category/patterns`


title: Exporting and importing my Wordpress database, but none of the plugin settings are importing

text: I'm dumping my entire WordPress database, changing all necessary references, and then importing it into another domain. Everything works fine, except my plugin settings are not being set in the new domain. Does anyone know if Wordpress saves plugin settings locally somewhere? Or a reason why it would activate all the plugins, but not set the settings? The plugins I am specifically having trouble with are Adminimize, Admin Menu Editor, and User Roles. This is the closest plugin I could find to solving the issue, but it doesn't work for Wordpress 3.1 - http://wordpress.org/extend/plugins/sk-wp-settings- backup/ Thanks in advance for any help you can give me.


title: Custom Post Type URL Change - (portfolio using portfolio categories)

text: I wonder if you could help me. I'm using a theme which has 'portfolio' as a custom post type. The portfolio items can be categorised in a similar way to standard posts. Currently, theme outputs portfolio URLs in the following format: mysite.com/portfolio/portfolio-post ...where 'portfolio-name' is simply the post title. the middle section of the URL remains static. What I would like to achieve is something like this: mysite.com/portfolio-category/portfolio-post ...where the 'portfolio-category' proportion of the URL is taken from the portfolio category. Each portfolio post will only be assigned to a single portfolio category at any one time. I can send code examples across if this makes it easier for you to understand what i'm trying to achieve. Thanks in advance H


title: using Ajax: call to undefined function get_option

text: I am using ajax on my template to load a file called counter.php. When I click a button, it is supposed to increase the counter. But when I click the button I get this error "Fatal error: Call to undefined function get_option()". This is what I have on counter.php               $post_ID = $_POST['ID'];     $opn_name = 'fb_counter'.$post_ID;     $counter_value = get_option($opn_name);     if($counter_value==NULL){     $counter_value = 0;     }     update_option($opn_name, $counter_value+1);          echo get_option($opn_name);      I am not sure what is wrong. Do I have to include any wordpress files on this php file ?


title: need help with existing code showing subpages

text:
I am helping a friend make some changes to a wordpress theme. At the moment displaying subpages works only for one parent and its subpages (the one with id 31), but we want it to work for all pages (and their children). I want to more or less keep the code as is, just make the necessary changes to apply to all. Although I am pretty good with css and html, php is not really my strong suit, so I would appreciate your help figuring this out. This is the existing code:               $currentPageId = get_the_ID();          $pages = get_pages('child_of=31');     $i=0;     foreach($pages as $child) {     $childrenPageID[$i] = $child->ID;     $i++;     }          if ( (get_the_ID() == 31) || ( in_array($currentPageId, $childrenPageID)) ) {                $taxonomy     = 'portfoliocat';         $orderby      = 'name';          $show_count   = 0;      // 1 for yes, 0 for no         $pad_counts   = 0;      // 1 for yes, 0 for no         $child_of     = 5;         $show_count   = 1;         $title_li     = null;                   $args = array(           'taxonomy'     => $taxonomy,           'orderby'      => $orderby,           'show_count'   => $show_count,           'pad_counts'   => $pad_counts,           'child_of'     => $child_of,           'show_count'   => $show_count,           'title_li' => $title_li          );              ?>

             <?php             $cat = get_query_var('cat');                  // count all categories             $totalCount = count(get_categories($args));             $currentCount = 0;                  foreach(get_categories($args) as $category) {                      // get current number of stack             $currentCount = $currentCount + 1;                  global $wpdb;             $lookForValue = $category->slug;                  $querystr = "SELECT post_id                          FROM $wpdb->postmeta                          WHERE meta_key = 'category-include' AND meta_value = '".$lookForValue."';             ";             $postid = $wpdb->get_var($wpdb->prepare($querystr));                      // logic to remove last trunk                 if ($totalCount != $currentCount  ) {                 echo '
' . $category->name.'   |
';                 }                 else {                 echo '
' . $category->name.'
';                    }             }?>

           }      I know I need to change the if, but no clue what to replace it with. Any suggestions? Thanks in advance! Joanna


title: Categorize wordpress tags

text: I have problem about categorizing wordpress TAG, in my case for language. for example: **postA** : englishtag1,englishtag2,englishtag3, chinesetag1,chinesetag2, **postB** : englishtag2,englishtag5,englishtag4, chinesetag1,chinesetag3, i want to show tag cloud based on the "language": **english tag cloud** : englishtag1,englishtag2,englishtag4,englishtag5 **Chinese tag cloud** : chinesetag1,chinesetag3,chinesetag2,chinesetag4 etc.. is it possible? how to achieve this? Thank you


title: What content should go in index.php?

text:
I'm developing my own theme and came up with an issue that' I am confused with. I have two files that I'm trying to figure out. `page.php` and `index.php`. I know that page.php is used for pages, of course, but when trying to set up a 404 page, for example:               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<?php wp_title(''); ?>
                     <?php the_content(); ?>
             <?php get_sidebar(); ?>

          <?php endwhile; else : ?>     404 not found     <?php endif; ?>      Nothing will be displayed. Now, if I copy this content and stick it in index.php, I will have a 404 page. I have no idea what to do because index.php is required for a theme but I don't know what to do with it. Can someone explain the differences and what kind of content actually goes in it?


title: Wordpress Database Duplicate Entry Error (Cron specific)

text: This is one error that my website is continuously generating in the error log file.               WordPress database error Duplicate entry '59199038' for key 'PRIMARY' for query INSERT INTO `admission_options` (`option_name`, `option_value`, `autoload`) VALUES ('cron', 'a:2:{i:1406114668;a:1:{s:16:\"wp_version_check\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}s:7:\"version\";i:2;}', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`) made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, wp_schedule_update_checks, wp_schedule_event, _set_cron_array, update_option, add_option      Any help on how to correct this will be great!


title: Custom post type - order field

text: In a custom post type, is there a way to include the "order" field that is available for pages? Is there any built-in logic that prevents duplicate values in the "order" field? The idea is to be able to sort a custom post type by a user-specified order, then alphabetically by a string-based custom field.


title: Custom Plugin inlcude wp-load.php in my new.php file

text: I have created a custom plugin in WordPress and uploaded to the WordPress.org But the plugin is rejected due to I was including require_once("../../../../wp-load.php"); In one of my php file which collects the POST response. So how can I include this wp-load.php in right way, to get the approval from WordPress. Please help me on this. Regards Krijesh PV.


title: Changing post category from dropdown

text:
I am showing a list of posts on the front of my wordpress site which each have a dropdown next to them with a list of category's, which are pulled in as follows. As you can see the form submit button is wrapped in `<noscript>` tags so that when an option is choosen from the dropdown at the moment it will redirect to the category that was chosen. I am wanting to change this functionality so that when an option is chosen from the dropdown it will then add the relevant post to the category that was selected from the dropdown but also keep it in all other category's that it was previously in. I am sending the form to `addcat.php` which is where I am thinking I need to add a script to do as I need somehow?               <form action="<?php bloginfo('url'); ?>/addcat.php" method="get">
      <?php       $select = wp_dropdown_categories('show_option_none=Select category&show_count=0&orderby=name&echo=0&child_of=28&hide_empty=0');       $select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);       echo $select;      ?>
<input type="submit" value="View" />

     </form>       At the moment I have in my functions:               function addPostToCategoryLauncher()     {     $newCatId = 28;     $newCatId = get_cat_ID( 'my-category' );     $categories = wp_get_object_terms( $post->ID, 'category', array( 'fields' => 'ids' ) );     array_push( $categories, $newCatId );     $categories = array_unique( array_map( 'intval', $categories ) );     wp_set_object_terms( $post->ID, $categories, 'category' );     }     add_action( 'init', 'addPostToCategoryLauncher' );      And in my addcat.php               if( !empty( $_POST['cat'] ) ) { add_action( 'init', 'addPostToCategoryLauncher' ); }     header('Location: ' . $_SERVER['HTTP_REFERER']);      But this is just saying add to catId=28 but I need it to be the category that was chosen from the dropdown not Id 28, the function also doesn't seem to working so It may need a few tweaks.


title: Can I create front-end editable user profile pages with Wordpress? How do I do it?

text: I'm trying to build a WP site where _using the front-end_ , each user can:   1. Register through the front end using basic fields   2. Log in   3. Create their own profile page using multiple forms   4. Upload text, image and video data using profile forms   5. Create work related information (portfolios made up of images and video) that are separate from profile forms   6. be able to edit both profile and portfolio related information unique to their own profile only So to summarise, we are talking about _2 separate types of information_ : A) user profile information that can be updated anytime after registration B) Portfolio information that uses various media to create a front end profile for the user. This should be editable and updatable **via the front-end** after registration too. So Is this possible to do with Wordperss? What tools and approaches would you recommend?


title: PHP conditional script issue

text: I'm have the 2 seperate block of codes as shown below and the one below doesn't work except if I cut off the first one. Any ideas what the problem could be? **Conditinal script**               <?php { ?>              <?php                  if ( is_front_page() ) {                  get_template_part('home-page-content');                              } elseif ( is_page('archives')) {                          get_template_part('archives');              }         else                  get_template_part('secondary-page-content');                    ?>              <?php } ?>      **Second block of script**                <div id="footer">          <?php echo get_post_meta($post->ID, "biz_code", true); ?>              </div>


title: Can't work out why widget contents disappear from admin

text:
everytime I make a change to any widgets in admin they disappear - sometime just from admin, sometimes from the frontend and sometimes both. I get them back by adding `update_option( 'sidebars_widgets', $null );` to the bottom of functions.php - then I can see them in admin as 'inactive widgets'. Then I manually re-add them all in admin - it's very frustrating! I'm using Canvas with a custom child theme. I added a new widget area by adding               // Underhome widget area     if ( function_exists('register_sidebar') ){       register_sidebar(array(         'name' => 'Underhome widget',         'id' => 'underhome_widget',         'description' => "A widget area underneath the home page content",         'before_widget' => '
',         'after_widget' => '

',         'before_title' => '
',         'after_title' => '
',       ));     }      to functions.php Then I created a page template and added                    <?php if ( dynamic_sidebar('underhome_widget') ) : endif; ?>      I can't see anything wrong with this? maybe it is unrelated? Anyway I'm totally stuck does anyone has any suggestions apart from changing career?


title: Splitting up a submenu into columns, or putting existing menus in another menu as submenu item

text: I have a menu with a long list of submenu items. I'd like to split that up into columns and the easiest way in my mind would be to have them split up into multiple . Is there a way to do this? Alternatively, I've currently have the submenu items in four different menus (so that I can display them in four columns in the footer). Is it possible to put those menus in my main menu as submenu items?


title: How to format shortcode's HTML in external file

text: I need to add a shortcode in my theme and I would like to put the HTML code not in the function which creates the shortcode but in a template file in my theme directory. Now I have               function wpse450_show_video( $atts ) {         extract(shortcode_atts(array(             'id'        => 0         ), $atts ));              if( is_numeric($id) ) {             $ngvideo_title = get_the_title($id);         }         return '<div>'.$ngvideo_title.'</div>';     }     add_shortcode( 'ngvideo', 'wpse450_show_video' );      I would like to put the `<div>'.$ngvideo_title.'</div>` stuff in an external file. How to do this?


title: Is there a better way to do headings for (all) archives?

text: I've been writing wordpress themes for years now and am kind of getting bored of copy-pasting the same bunch of code for archive titles. Let's say I have 1 template for yearly and monthly archives, categories, tag archives, etc. I have a copypasta that spans like 40 lines and is basically a huge if/else thing which generates the relevant heading. Is there something more sane/quick to build the heading text?


title: Listing all sub-pages?

text: I'm wondering how to write a list of sub-pages of actually visited page. So I have 2 pages and 3 sub-pages for each:               Colors [page]     - Red [child of Colors - subpage]     - Blue [child of Colors - subpage]     - Green [child of Colors - subpage]          Numbers [page]     - One [child of Numbers - subpage]     - Two [child of Numbers - subpage]     - Three [child of Numbers - subpage]      And when user visits "Colors" page then my code outputs Red/Blue/Green and if he does vist Numbers it shows One/Two/Three. I'm sure wp_list_pages will do the thing easy, but I'm not sure about parameters.


title: Get url.com/post_type/taxonomy/term work!

text: I'm having trouble get what I want by mixing custom post types and taxonomy. **I want to run this:** > www.url.com/post_type/taxonomy/term **In my case this:** > www.url.com/dossier/theme/sante _(sante is a term of "thermatiques" taxonomy)_ When I enter this url, I do not have a 404 but it shows me all the items post- type regardless of the taxonomy. Taxonomy's code:               register_taxonomy(         'thematiques',         array( 'post', 'dossiers','videos' ),         array(         'rewrite' => array( 'slug' => 'theme'),         'label' => 'Thématiques',         'query_var' => true,         )     );      CPT's code:               function register_cpt_dossiers() {         $labels = array(             'name' => _x( 'Dossiers', 'dossiers' ),             'singular_name' => _x( 'Dossier', 'dossiers' ),             'all_items' => _x( 'Tous les dossiers', 'dossiers' ),             'add_new' => _x( 'Ajouter', 'dossiers' ),             'add_new_item' => _x( 'Ajouter un nouveau dossier', 'dossiers' ),             'edit_item' => _x( 'Modifier le dossier', 'dossiers' ),             'new_item' => _x( 'Nouveau dossier', 'dossiers' ),             'view_item' => _x( 'Afficher le dossier', 'dossiers' ),             'search_items' => _x( 'Chercher dans les dossiers', 'dossiers' ),             'not_found' => _x( 'Aucun dossier trouvé.', 'dossiers' ),             'not_found_in_trash' => _x( 'Aucun dossier trouvé dans la corbeille.', 'dossiers' ),             'parent_item_colon' => _x( 'Magazine parent :', 'dossiers' ),             'menu_name' => _x( 'Dossiers', 'dossiers' ),         );         $args = array(             'labels' => $labels,             'hierarchical' => true,             'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields', 'revisions' ),             'taxonomies' => array( 'thematiques'),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'menu_position' => 5,             'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'has_archive' => 'dossier',             'query_var' => true,             'can_export' => true,             'rewrite' => array( 'slug' => 'dossier/%thematiques%'),             'capability_type' => 'post'         );         register_post_type( 'dossiers', $args );     }      And here is the code that redirects links posts correctly:               function wpa_show_permalinks( $post_link, $id = 0 ) {         $post = get_post($id);         if ( is_object( $post ) && $post->post_type == 'dossiers' ){             $terms = wp_get_object_terms( $post->ID, 'thematiques' );             if( $terms ){                 return str_replace( '%thematiques%' , $terms[0]->slug , $post_link );             }         }         return $post_link;     }     add_filter( 'post_type_link', 'wpa_show_permalinks', 1, 2 );      Thank you for your help!


title: Is there something like theme test drive for plugins?

text: Basically, I'm wondering if there is something like theme test drive (which lets you use and presumably tweak on theme while non admins see another) but for plugins. My goal is to be able to tweak/test a plugin while site visitors see the older stable version.


title: pre_get_posts causes Custom Posts appear under 'Pages' menu

text: In order to enable pagination on for custom post archive I've added pre_get_posts function. But, funnily it caused my custom posts be duplicated under 'Pages' menu. Here is the code that causes the problem. Please, advise.                  function truck_pre_pagination( $qry ) {             if ( $qry->is_main_query() ) {                 $qry->set('orderby','date');                 $qry->set('order','ASC');                 $qry->set('posts_per_page',12);                 $qry->set('post_type','trucks');             }         }         add_action('pre_get_posts','truck_pre_pagination');


title: What is difference between get_bloginfo('url') and get_site_url()?

text: I am developing a plugin. I want to know difference between               get_bloginfo('url');        and               get_site_url();      I got same output, then what's the difference?


title: Recent comments on author page?

text: I'm creating an author.php page and I'd like to show comments as well as posts from a custom post type. I already have the list of posts but I'm looking into an efficient way of displaying the most recent comments from that author as well. So far I haven't found anything except widget and bloated plugins. I'd like to do that particularly in one stream (posts/comments) but I can understand if this is too challenging :) Thanks! Dennis


title: The delete_posts capability?

text: Shouldn't this remove the capability to delete a post? Even if I remove the delete_posts capability for an editor, he still can trash a post and then delete i permanently. That can't be right. How do you remove the capability to trash/delete a post?


title: How to Call a static page in WordPress

text: Hi I created a template within my theme files, just for displaying a map in a lightbox. I need to call this template page from a normal wordpress post, how can I do it? Say in my theme files I have a file called map-template.php From within my post I would like to call that map-template.php file and also pass the ID of the current post as a parameter. Thanks


title: Why was my blog post inserted lot's of ad links by others?

text: I found that my blog posts are inserted lot's of ad links, I'm using WordPress 2.9.2, is there a known security vulnerability in it?   A screenshot : I post some codes on my blog, the ad links are inserted into them. ![enter image description here](http://i.stack.imgur.com/JWTQ8.png) I delete them by hand several days ago, and I found that they're back again!


title: How to change the post form from plugin?

text: I am starting making some wordpress plugin, so I am a beginer. I just wonder how can I change the post form of the pages. For example for adding some other input (of type file or text)? I am trying to use               add_filter('comments_template', 'add_new_fields');      but nothings happens.


title: Can I hook into wp_update_core outside of the admin?

text: I'm trying to bring some of the admin functionality to a custom front end in WordPress. Questions of security and pragmatism of this aside, is there an available hook to trigger wp_update_core outside of the admin?


title: how to hide home nav link in wordpress

text: I'm trying to hide the home navigation link from the theme boilerplate that I downloaded from underscores.me. Wordpress codex says that its not shown by default, but whether I do this:               <?php wp_page_menu( array( 'show_home' => true ) ); ?>      Or this:                <?php wp_page_menu( array( 'show_home' => false ) ); ?>      It still shows the home page nav link. When I don't call the `wp_page_menu` function it doesn't display the menus so I know its the one that's outputting it. Any ideas what's wrong and what else could I try? Thanks in advance!


title: wp_nav_menu log in/out link?

text: I have a wp_nav_menu showing pages, but I'd also like to include a log in/out link, based on the current state of the user, which will redirect them to the home page. I've looked far and wide, but how can I implement this in a wp_nav_menu? Thanks, Dennis


title: Why is $_POST Empty in Profile Edit Admin?

text: This is a very odd problem - post data seems to be empty in the profile editing page of admin. Here is my code: http://pastebin.com/3ejg8P99 What causes this? Is there some "safety" step I've missed or something?


title: Custom Permalinks Break Search Pagination

text: So I'm having a weird issue that I've never seen. I have a search.php set up like this:                     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;      query_posts($query_string . '&paged;=' . $paged);           if ( have_posts() ) : while ( have_posts() ) : the_post();         // post stuff     endwhile; else:          endif;          pagination();                If I use anything but the default permalink structure, it breaks the pagination and returns a 404 and the second page. Ant ideas?


title: How to remove username field from the registration page?

text: I know about http://wordpress.org/extend/plugins/wp-email-login/, but it only takes care of login - not registration. I don't want any javascript-based solution. (I'm aware of Register Plus Redux, but it uses Javascript to take care of this.) I just want to use email-address as username, and I want to see if there's an easy (but non-javascript) way to take care of this.


title: Modify wordpress plugin to auto complete on taxonomies instead of title

text:
I've been trying for hours to modify this plugin to work with custom taxonomies instead of post titles and/or post content http://wordpress.org/extend/plugins/kau-boys-autocompleter/ Added the code / part of the plugin where i think the modification should be done. I could post some stuff I tried but I think it would just confuse people, I don't think I ever came close. Normally I can modify code perfectly but just can't seem to find it. I've tried this method posted here. http://wordpress.org/support/topic/autocomplete-taxonomy-in-stead-of-title-or- content But doesn't work I've tried searching for possible solution around his suggestion but I'm starting to think his suggestion isn't even close to fixing it. Not sure if its allowed but ill pay 15$ on paypal to whoever gives me a clear and complete solution.               if(WP_DEBUG){             error_reporting(E_ALL);         } else {             error_reporting(0);              }              header('Content-Type: text/html; charset=utf-8');          // remove the filter functions from relevanssi     if(function_exists('relevanssi_kill')) remove_filter('posts_where', 'relevanssi_kill');     if(function_exists('relevanssi_query')) remove_filter('the_posts', 'relevanssi_query');     if(function_exists('relevanssi_kill')) remove_filter('post_limits', 'relevanssi_getLimit');          $choices = get_option('kau-boys_autocompleter_choices');     $framework = get_option('kau-boys_autocompleter_framework');     $encoding = get_option('kau-boys_autocompleter_encoding');     $searchfields = get_option('kau-boys_autocompleter_searchfields');     $resultfields = get_option('kau-boys_autocompleter_resultfields');     $titlelength = get_option('kau-boys_autocompleter_titlelength');     $contentlength = get_option('kau-boys_autocompleter_contentlength');     if(empty($choices)) $choices = 10;     if(empty($framework)) $framework = 'jQuery';     if(empty($encoding)) $encoding = 'UTF-8';     if(empty($searchfields)) $searchfields = 'both';     if(empty($resultfields)) $resultfields = 'both';     if(empty($titlelength)) $titlelength = 50;     if(empty($contentlength)) $contentlength = 120;          mb_internal_encoding($encoding);     mb_regex_encoding($encoding);          $words = '%'.$_REQUEST['q'].'%';          switch($searchfields){         case 'post_title' :              $where = 'post_title LIKE "'.$words.'"';             break;         case 'post_content' :              $where = 'post_content LIKE "'.$words.'"';         default :             $where = 'post_title LIKE "'.$words.'" OR post_content LIKE "'.$words.'"';     }          $wp_query = new WP_Query();     $wp_query->query(array(         's' => $_REQUEST['q'],         'showposts' => $choices,         'post_status' => 'publish'     ));           $posts = $wp_query->posts;          $results = array();     foreach ($posts as $key => $post){          setup_postdata($post);          $title = strip_tags(html_entity_decode(get_the_title($post->ID), ENT_NOQUOTES, 'UTF-8'));                   $content = strip_tags(strip_shortcodes(html_entity_decode(get_the_content($post->ID), ENT_NOQUOTES, 'UTF-8')));         if(mb_strpos(mb_strtolower(($searchfields == 'post_title')? $title : (($searchfields == 'post_content')? $content : $title.$content)), mb_strtolower($_REQUEST['q'])) !== false){             $results[] = array(                 'url' => get_permalink($post->ID),                 'title' => highlightSearchString(strtruncate($title, $titlelength, true), $_REQUEST['q']),                 'content' => (($resultfields == 'both')? highlightSearchString(strtruncate($content, $contentlength, false, '[...]', $_REQUEST['q']), $_REQUEST['q']) : '')             );         }     }     printResults($results, $framework);               function highlightSearchString($value, $searchString){              if((version_compare(phpversion(), '5.0') < 0) && (strtolower(mb_internal_encoding()) == 'utf-8')){             $value = utf8_encode(html_entity_decode(utf8_decode($value)));         }              $regex_chars = '\.+?(){}[]^$';         for ($i=0; $i<mb_strlen($regex_chars); $i++) {             $char = mb_substr($regex_chars, $i, 1);             $searchString = str_replace($char, '\\'.$char, $searchString);         }         $searchString = '(.*)('.$searchString.')(.*)';         return mb_eregi_replace($searchString, '\1\2\3', $value);     }          function strtruncate($str, $length = 50, $cutWord = false, $suffix = '...', $needle = ''){              $str = trim($str);         if((version_compare(phpversion(), '5.0') < 0) && (strtolower(mb_internal_encoding()) == 'utf-8')){             $str = utf8_encode(html_entity_decode(utf8_decode($str)));         }else{             $str = html_entity_decode($str, ENT_NOQUOTES, mb_internal_encoding());         }                   if(mb_strlen($str)>$length){             if(!empty($needle) && mb_strpos(mb_strtolower($str), mb_strtolower($needle)) > 0){                 $pos = mb_strpos(mb_strtolower($str), mb_strtolower($needle)) + (mb_strlen($needle) / 2);                 $startToShort = ($pos - ($length / 2)) < 0;                 $endToShort = ($pos + ($length / 2)) > mb_strlen($str);                      // build the prefix and suffix                 $prefix = $suffix;                 if($startToShort){                     $prefix = '';                 }                 if($endToShort){                     $suffix = '';                 }                      // set maximum length                 $length = $length - mb_strlen($prefix) - mb_strlen($suffix);                      // get the start                 if($startToShort){                     $start = 0;                 } elseif($endToShort){                     $start = mb_strlen($str) - $length;                 } else {                     $start = $pos - ($length / 2);                 }                           // shorten the string                 $string = mb_substr($str, $start, $length);                      if($cutWord){                     return $prefix.$string.$suffix;                 } else {                     $firstWhitespace = ($startToShort)? 0 : mb_strpos($string, ' ');                     $lastWhitespace =($endToShort)? mb_strlen($string) :  mb_strrpos($string, ' ');                     return $prefix.' '.(!empty($lastWhitespace)? mb_substr($string, $firstWhitespace, ($lastWhitespace - $firstWhitespace)) : $string).' '.$suffix;                 }             } else {                 $string = mb_substr($str, 0, $length - mb_strlen($suffix));                 return (($cutWord) ? $string : mb_substr($string, 0, mb_strrpos($string, ' ')).' ').$suffix;             }         } else {             return $str;             }     }          function printResults($results, $framework){         if($framework == 'scriptaculous'){                       echo '
';             foreach($results as $result){                 echo '
                                                              '.$result['title'].'                                 '.$result['content'].'
';             }             echo '
';         } else {                 foreach($results as $result){                 echo str_replace(array("\n", "\r", '|'), array(' ',' ', '|'), ''.$result['title'].'
'.$result['content'].'
')                     .'|'                     .str_replace(array("\n", "\r", '|'), array(' ',' ', '|'), $result['url'])                     ."\n";             }         }     }


title: CPT archive 404ing when using a custom taxonomy name as a variable

text: So, I'm using a custom post type archive and generating a JavaScript-based filtering interface for sorting through results. Here's an example: http://www.inverity.org/sermons/ Now, what I'd like to do is pass in variables to my script to allow for filtering based on URL parameters. This works: http://www.inverity.org/sermons/?presenters=4 The problem is, this doesn't: http://www.inverity.org/sermons/?speakers=4 "speakers" is the name of the custom taxonomy I'm using and is the value that I want to filter by. Any ideas why this is happening? Is there anything I can do to get around it and prevent the 404ing?


title: How to single click to download image in single post

text: i have attacment.php like this.               <?php            if ( $attachments = get_children( array(       'post_type' => 'attachment',       'post_mime_type'=>'image',       'numberposts' => 1,       'post_status' => null,       'post_parent' => $post->ID       )));     foreach ($attachments as $attachment) {       echo wp_get_attachment_link( $attachment->ID, '' , false, true, 'Download This Wallpaper');       }       ?>       this code will print attachment link. My question is: How to make this link to be single click to download image and save to computer user?


title: How to get the $atts of a shortcode

text: I have the following shortcode:               [video width="400" height="400" mp4="http://xxxx.xxxx.xxx/uploads/2014/06/Facebook.mp4"][/video]      I need to get every single atts a single variable, I mean, I need something like this               $width = 400     $height = 400     $file = http://xxxx.xxxx.xxx/uploads/2014/06/Facebook.mp4      does anybody have done something like this before? (I'm very newbie in WP)


title: default custom background image not saved in database when creating a new site

text: I am a theme author and the theme I made is used in a multisite environment. I have added the `custom_background` feature to this theme, with a default image and everything works as expected : the user can change the image and see the result live is the Theme Customizer before putting it online. Here is the custom_background declaration:               add_action('after_setup_theme', 'user83643_theme_features');     function user83643_theme_features(){         add_theme_support( 'custom-background' , array(             'default-color' => '1878A0',             'default-image' => get_template_directory_uri() . '/img/default.jpg',             'wp-head-callback' => '__return_false',         ));     }      However, when a fresh new site is created in the network, the default image does not appear in the frontend. I can see it in the backend in the theme customizer, but I have to save it once to activate it on the frontend : `get_theme_mod('background_image')` returns `false` before I save it once. Any idea how to save the default image (and color) in the database upon the first theme activation ?


title: WPMU Development Environment

text: This is my first time playing with WPMU, I'm trying to move an entire WPMU site into a subdomain of itself for a development environment. The site itself is using subdomains so I'm having a bit of trouble getting it working. Has anyone had this task/problem before? I need to move `http://example.com` to `http://dev.example.com`. I have moved all the files into a subfolder and configured it via the server, moved the database into a separate one, updated the home & siteurl in the `wp_options` table and my `wp_config.php` is as follows:               define( 'WP_ALLOW_MULTISITE', true );     define( 'MULTISITE', true );     define( 'SUBDOMAIN_INSTALL', true );     define( 'NOBLOGREDIRECT', 'http://dev.example.com/' ); // added by me in dev only     $base = '/';     define( 'DOMAIN_CURRENT_SITE', 'dev.example.com' );     define( 'PATH_CURRENT_SITE', '/' );     define( 'SITE_ID_CURRENT_SITE', 1 );     define( 'BLOG_ID_CURRENT_SITE', 1 );      When I try to hit the dev subdomain in the browser it redirects to               /wp-signup.php?new=dev.example.com       Can anyone help/give pointers/anything?


title: All-in-One Event Calendar: How do you display the event date?

text: I want something like this to show up: Jan 29 Mon 2-9 pm I can't use `<?php echo $event->get_timespan_html(); ?>` as it would display something like "July 13, 2013 @ 1:00 pm – 3:00 pm." I also tried               <?php echo date_i18n( 'M', $timestamp, true ) ?>     <?php echo date_i18n( 'j', $timestamp, true ) ?>     <?php echo date_i18n( 'D', $timestamp, true ) ?>     <?php echo $event->get_start_time(); ?> – <?php echo $event->get_end_time(); ?>      but for some reason it only displays Jan 1 Thu 1:00 pm – 3:00 pm instead of the correct event information. Help?


title: Validating buddypress custom profile fields

text: I'm using buddypress and I offer users the chance to add links to their social networks (facebook/twitter) by entering the url's into custom profile fields. My issue is that people can;t follow directions and constantly enter in incomplete url's so I need to validate them while they're filling them out on profile edit and registration. I found this nice little function to validate.               function validate_url(url) {       if (/^(https?://)?((w{3}.)?)twitter.com/(#!/)?[a-z0-9_]+$/i.test(url))        return 'valid';                if (/^(https?://)?((w{3}.)?)facebook.com/.*/i.test(url))        return 'invalid';            return 'not a valid link';     }      My question is how can I use this in conjunction with buddypress profile edit. I moved the bp template files to my child theme and started fooling around with the edit template under profiles but couldn’t really get anywhere. Any ideas on the best way to do this?


title: How to activate WordPress widgets but not display?

text: I have activate the widget in my WordPress site in admin panel, but on the front page I don't want to display it. Is this possible?


title: WP 3.1 custom post type permlinks

text:
I know there is alot of discussion about the CPT and permlinks together with the 404. I did not found a solution though I am close. It would be great if someone could assist me to get it working. Ok what I did is:                   function post_type_services()      {             register_post_type( 'services',                     array(                      'label' => __('Services'),                      'singular_name' => __( 'Service' ),                     'capability_type' => 'post',                     'rewrite' => array('slug' => 'service','with_front' => FALSE),                     'public'  => true,                      'show_ui' => true ) );                   flush_rewrite_rules( false );         }     add_action('init', 'post_type_services');      I added a CPT for services. I added a slug and I also added `flush_rewrite_rules(false)` as suggested in many blog posts. I turned on Permlinks with the settings `/%year%/%monthnum%/%postname%` I added a file `single-services.php` which contains following content                  <?php          get_header();      ?>

         <?php query_posts('post_type=services'); ?>         <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

<?php the_title(); ?>
                     <?php the_content(); ?>                     <?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'twentyten' ), 'after' => '' ) ); ?>                     <?php edit_post_link( __( 'Edit', 'twentyten' ), '', '' ); ?>
             <?php endwhile; ?>

Auswahl

                         <?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'menu_class' => 'sb_menu', 'theme_location' => 'leftmain' ) ); ?>
                 <?php get_sidebar(); ?>

                     <?php get_footer(); ?>

      So far so good. What I want is. if I navigate to http://www.mydomain.com/service I would like to see my list of services and when I click on a single service I want to display the single service. What I do get right now is when I navigate to http://www.mydomain.com/service. I get a 404 but when I visit http://www.mydomain.com/service/my-first-service I see the list of services... What did I do wrong? How can I get a list of services when I visit http://www.mydomain.com/service ? P.S.: I use the starkers base template to generate my own...


title: How to set and use global variables? Or why not to use them at all

text: UPDATE: My original question has been solved, but this is turning into a valid discussion about why not to use global variables, so I am updating the question to reflect that. The solution was `<?php global $category_link_prop; echo esc_url( $category_link_prop ); ?>` as @TomJNowell suggested. UPDATE 2: I now have it doing exactly what I wanted. But I'm still using global scope and would be happy to find a better way. I am trying to set up a whole bunch of global variables for the permalinks to categories to be used in various places in my theme. _The main reason for this is for use in both the main navigation, as well as in a series of sub navigations that are chosen based on what category the current post is in._ This is not a theme I will be releasing for use by others, but is built for one very specific purpose. This is how I am currently creating them (I've only pasted in a few of the variables).                   function set_global_nav_var()         {         //proposal         global $prop;         // Get the ID of a given category         $category_id_prop = get_cat_ID( 'proposal' );         // Get the URL of this category         $category_link_prop = get_category_link( $category_id_prop );         $prop = 'Proposal';              //Calvinball         global $cb;         // Get the ID of a given category         $category_id_cb = get_cat_ID( 'calvinball' );         // Get the URL of this category         $category_link_cb = get_category_link( $category_id_cb );         $cb = 'Calvinball';         }         add_action( 'init', 'set_global_nav_var' );      I can now do `<?php global $prop; echo $prop; ?>` int he 4 places that goes and get back the whole link for the code. When that changes I only need to change it in one place. I'm open to alternatives that do not involve the global scope.


title: Add-on domain works in Wordpress but links still lead to subdomain

text: I know this looks like a common question, and I assure you I've tried a bunch of responses, but none seem to work in my case. I'm a Wordpress noob so I might be making some basic error which I can't spot. I will link you to the actual pages in question so you can see what's going on easily. The main domain is: visit-ceed.net We created an add-on domain called reprezentacija.me which can be accessed as a subdomain of the main domain here: http://visit-ceed.net/reprezentacije/. Opening `reprezentacija.me` works fine, but all the links still point to the subdomain. How do I get the links to point to the add-on domain? So, instead of pointing to `http://visit-ceed.net/reprezentacije/category/novosti/fudbal/` the corresponding link should go to `http://reprezentacija.me/category/novosti/fudbal/`. Here is the htaccess file in the `reprezentacije/` directory:               # BEGIN WordPress     <IfModule mod_rewrite.c>     Options +FollowSymLinks     Options -Multiviews     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d          </IfModule>          # END WordPress


title: Display Links in Excerpts?

text: I'm having a problem with the_excerpt and can not find the answer anywhere... I simply want to allow links to be clickable when they are displayed via the_excerpt! There has to be a function for this, rather than relying on a plugin. But I can't find it and the advanced excerpt plugins are so complex that I am unable to find the small snippet which makes this work.


title: Start Query from 2nd Post without offset

text: is there a quick and easy way to load all the posts, starting with the second post and making the first post the last post? If I use offset, I then lose the first post, but I don't want to lose it, I just want to change the sort order, ie. first becomes last and second becomes first post. Thanks for your help.


title: Custom feed parameters / Template overriding

text: Am relatively new to Wordpress development and looking for the best way to customize the output for a specific javascript app that will be pulling in the content dynamically, by using a Wordpress plugin. I can do most of what I need to do by overriding the feed template, allowing custom output by search term, tag, and category. However, getting an individual post for the feed (ie. using p= or page_id= query variables) doesn't seem to be an option by default. What would be the best, cleanest way (ie. least amount of conflicts) to create the custom output post/page output? Simply add a new query_var filter and hook into parse_request, add new query vars for the feed somehow, or some other method to override the template for the content from within the plugin code? Thanks!


title: Loading pages via Ajax and displaying titles

text: A small and possibly simple consultation. I'm loading pages via Ajax like this:               jQuery("div.menu a").addClass("ajax");          var hash = window.location.hash.substr(1);     var href = jQuery('.ajax').each(function(){         var href = jQuery(this).attr('href');         if(hash==href.substr(0,href.length-5)){             var toLoad = hash+'.html #wrapper';             jQuery('#wrapper').load(toLoad)         }                                                });     jQuery('a.ajax').click(function(){                                 var toLoad = jQuery(this).attr('href')+' #wrapper';         jQuery('h2').fadeOut('slow');         jQuery('#wrapper').animate( {           top: '300px',           opacity: 0         } ).animate({top:'-300px'}).hide('normal',loadContent);              window.location.hash = jQuery(this).attr('href').substr(0,jQuery(this).attr('href').length-5);              function loadContent() {             jQuery('#wrapper').load(toLoad,'',showNewContent())         }         function showNewContent() {                  jQuery('#wrapper').show('slow').animate( {               top: '0px',               opacity: 1             } );             jQuery('h2').fadeIn('slow');         }         return false;     });      While doing this I also have the Title of the current page displayed at the header.php via `echo get_the_title();` . Obviously this function is not updated and my question is: **Is there a way to fetch the title of the page loaded via Ajax?**


title: Do I Need to Prefix Variables Inside Functions?

text: Sorry, this is a noob question. But, I want to follow the best practices. I read that functions and global variables should be prefixed in plugins. So, for example, `myfunction()`, should be `lax_myplugin_myfunction()`. And a variable, such as `$myvar`, should be `$lax_myplugin_myvar`. Do I need to prefix a variable if it's in a function? For example,               lax_myplugin_myfunction() {          $count = 50;          return $count;          }      Should I prefix `$count` and make it `$lax_myplugin_count`? Or I don't have to bother with it as it's in a function. What's the best practice? Thank you.


title: Custom post type Vs. data in own table

text: I'm trying to get started with WP development. So far I've been using it with other's people plugins and themes so I'm kind'a stuck. I've read many many many things about, but I can't find simple answer when to use what. e.g. I'd like to create order page (webshop without payments, just simple order that resides on system and administrator then have a chance to check, confirm, set status to that order to "products sent" and so on). So now, I should have - users, articles (distributed in some categories, with some brand tags) and orders and my plan was to create wp_MyArticles table, with menu in wp dashboard, where admin could do certain things with it. But then, 50% of people told me NOT TO mess with WP database, and create my own table, but to rather use custom post types, with custom fields. I've read again tons of blogs / pages but still, I'm not sure, what do I get with custom "post" (Article), when I need to list it, select few of articles, add them to orders. Where to put orders ? How to create subpages that will deal with orders, with articles ? And most important, I'm trying to find how to code my own plugin for members area, so that even as administrator I avoid dashboard, and work only on "my backend" part? My idea is not to buy / use some ready made plugin, but to learn how to do it on my own, but it seams I can't google right things, all blogs and how to's are copies of copies of copies of same examples and are using same plugins. So, any how to / why / what to read is needed and appreciated.


title: How do i include tinymce editor in frontend?

text: I am trying to add tinymce editor in my frontend from where users can post. But no luck so far. Here is the code: **PHP:**               add_action('wp_print_scripts', 'my_enqueue_scripts');          function my_enqueue_scripts() {                   wp_enqueue_script( 'tiny_mce' );             if (function_exists('wp_tiny_mce')) wp_tiny_mce();     }      **Javascript:**               jQuery(document).ready(function(){     tinyMCE.init({             mode : "textareas",             theme : "simple",              /*plugins : "autolink, lists, spellchecker, style, layer, table, advhr, advimage, advlink, emotions, iespell, inlinepopups, insertdatetime, preview, media, searchreplace, print, contextmenu, paste, directionality, fullscreen, noneditable, visualchars, nonbreaking, xhtmlxtras, template",*/             editor_selector :"editor"         });     });      **HTML:**               <textarea rows="8" cols="40" name="description" id="editor" class="required"><?php echo $description;?></textarea>      **Problem:** Texteditor not adding to textarea. Although the tinymce js file is loading.


title: How to install Google Analytics onto site without internet access

text: I just created an intranet site for the company that I work for. The IT department will not allow my site to access the internet for security reasons, but my boss still wants Google Analytics installed. I usually just use Joost De Valk's GA plugin, but I don't think it will work since I don't have internet access. Any ideas about installing GA without an internet connection?


title: add_rewrite_rule not loading correct page nor getting variables

text: I've trying to get a showreel title and video id into an URL that can then be accessed by the page. i have the two in the same URL and it either doesn't work or only one comes in. Currently the page isn't being found ? (i am constantly flushing the permalinks) Url i want to get variables from will look like directors/test- director/showreel/ **showreel-name** /video/ **111** / The site currently sits in a testing folder called *independent_02* but not sure if that affects anything? here's the code;               function wpse13483_init() {              add_rewrite_rule( 'directors/(.+?)/showreels/([^/]+)?/?$', 'index.php?category_name=$matches[1]&showreel=a', 'top' );         add_rewrite_rule( 'directors/(.+?)/showreels/([^/]+)/video/([^/]+)?/?$', 'index.php?category_name=$matches[1]&showreel=c1&video=c2', 'top' );         // directors is a custom post_type and should go to single-directors.php              add_rewrite_rule( 'showreels/(.+?)/video/([^/]+)?/?$', 'index.php?category_name=$matches[1]&video=b', 'top' );         // showreels is a custom post_type and should go to single-showreels.php          }     add_action( 'init', 'wpse13483_init' );      Any help appreciated! * * * **UPDATES** \- this rule is now mostly working and catching the variables. However it is going to archive.php and not directors-single.php?               add_rewrite_rule( 'directors/(.+?)/showreels/([^/]*)/video/([^/]*)/?', 'index.php?post_type=directors&showreel=$matches[2]&video=$matches[3]', 'top' );     // directors is a custom post_type and should go to single-directors.php      i think its to do with the '?post_type=directors' but can't find any reference of what this should be to load single.php **UPDATE 2** Looking at Rewrite analyzeri think its missing the post_type variable? ![rules](http://i.stack.imgur.com/jhFV2.png)


title: Integrating Buddypress, Wootumblog and WPMU Sitewide tags

text: Judging by the lack of information when I perform a search, I may be one of the few people that has tried to get these plugins playing nicely together. When all is sorted and the site is live, I’ll post up a link to hopefully inspire a few other sites to try them out together. Basically what I have is a standard WP multisite/BP configuration, to which I’ve installed the WooTumblog plugin at the network level and then added ‘function woo_tumblog_type’ and ‘function woo_tumblog_short_title’ to the functions.php file in the child theme used by my sub-sites. Both my main theme and child themes are heavily adapted from the BP Default theme. Somewhat frustrated by the lack of front-end publishing tools for Wordpress and keen to use the WooTumblog dashboard (which uses javascript enabled panel changes depending on whether a user wishes to publish a video, image, quote, link or article), I decided to customise the admin area for users to look identical to the site’s front-end, then I removed all other dashboard widget boxes (using unset($wp_meta_boxes…) and all the admin sidebars and menus (using remove_submenu_page()) and also customised the admin bar. The result is a a user admin dashboard that looks as if it is a part of the main site. The configurations are triggered by user level – using I came slightly unstuck when I implemented the WPMU sitewide tags plugin which copies everything on the network into a single site which can them be used to produce cross-site tags, searches and display all the latest network posts. On the front end of my main site (where all the latest posts are displayed) I display a tumblog icon against each post based on its taxonomy (i.e. video, image, quote…) . I have built a 'catch image' function which displays the first image from a post and where there is no image (such as for a quote or video) it displays a default thumbnail. Everything works fine except I cannot get the custom taxonomy to reach the main site (or tag blog) so that I can then customise the presentation of these sub-site posts. I've been in contact with Ron Rennick (who maintains WPMU SWT) and Jeff Pearce (who is the woo themes developer behind wootumblog). They've both shared their advice, but I've not worked with classes, actions and filters so I'm finding it difficult translating their advice into tangible changes in my code. If anyone has a spare moment and would like to give it a go, here's a link to Ron's advice; http://wordpress.org/support/topic/getting-buddypress-and- sitewide-tags-to-play-nicely?replies=10 With Ron's input I created the following plugin..               <?php     /*     Plugin Name: SWT Custom Taxonomy     Description: Addition of new custom taxonomies to the wpmu sitewide tags plugin.     Version: 1.0     Author: CitizenSlide     License: GPL2     */          function my_swt_custom_tax_filter( $taxonomies ) {     $taxonomies[] = 'tumblog';     return $taxonomies;     }     add_filter( 'sitewide_tags_custom_taxonomies', 'my_swt_custom_tax_filter' );     ?>       But as far as I can tell, there is no change in the output written to the SWT tag blog. Anyone with any thoughts? I 'just' want to carry one (custom taxonomy) field from a sub-site post through to the main site using the sitewide tags plugin. How hard can that really be?


title: Updating wp_options with an array on save_post results in duplicated entries

text: I'm not entirely sure this is Wordpress' fault, but I figure I'd ask anyway and see if anyone else has experienced any problems like this before. I'm trying to save an array to a wp_options table row. The data is coming from a custom metabox and is being saved when the save_post hook is triggered. I assumed this should do the trick:               update_option("myOptionName", $myArray);      I started getting 4(?!) of each value I saved. For instance:               $myArray = array("option1");     update_option("myOptionName", $myArray);     get_option("myOptionName");      // array([0]=>"option1", [1]=>"option1", [2]=>"option1", [3]=>"option1");      Needless to say, this behavior is extremely annoying. It works perfectly well with strings, but never arrays. I've tried to get around this by trying json_encode to store it as a string-y entity, but even that isn't working. The problem could very well be the legacy code I've inherited by taking on this project, but I see nothing pointing to save_post. Has anyone ever seen a situation like this before? EDIT: As requested ... the save function:               # SAVE BRICK DATA     function brick_update() {          // Verify if this is an auto save routine.     if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {         return;     }          // Check permissions     if ( !current_user_can( 'publish_posts' ) ) { // Check for capabilities         wp_die( 'Sorry, you do not have the capabilities access to this page. :(' );     }          if (!wp_verify_nonce($_REQUEST['brickupdate'], 'brickupdate')) {         return;     }          $newView = array();     $currentView = get_option('ci_guidesbrick_posts');          if (!is_array($currentView)) {         $currentView = (array)$currentView;     }          for (var i = 0, i < count($currentView), i++) {         $newView[i] = $currentView[i];     }          $newView[] = $_REQUEST['postID'];          update_option('ci_guidesbrick_posts', $newView );             }


title: A mandatory agreement form to access another page?

text: I want to set up a page with a form the visitor needs to fill out and accept terms before going on to another page. Is there a plugin to do this? If no plug in, is there another way? Any help would be appreciated! Greg


title: Plugin for Reading Documents, PDF's etc

text: I am working on a project like scribd.com using WordPress, is there any plugin available which can read documents into a flash or in an Iframe. Examples: scribd.com docstoc.com books.google.com


title: How to add custom function to pluggable.php

text: I am working on a WP plugin and I want to add a custom function to pluggable.php (located in /wp-includes). I am calling that function from admin.php (located in /wp-admin) eg. Consider the function `auth_redirect` which is called from admin.php. `auth_redirect` is the function defined in pluggable.php which checks for logged users, else it redirects them to login page. Similarly, I have my own custom function. So, is there any specific hook or filter which I must use to attach my function to pluggable.php. Currently, I am using `fwrite()` to add my custom function to pluggable.php. But, I guess this isn't the right way. So, can you suggest me the right way of inserting my custom function and calling it from admin.php Any help will be appreciated.


title: Rewrite custom post type url's adding meta box values

text: I've got these custom post types (CPT) and meta boxes:   * Movies (CPT)      * Genre (Meta box)   * Genres (CPT) If one movie is called Die hard then I want the permalink to be: /genres/action/die-hard This is easily fixed by setting the movie-CPT to 'rewrite' => false and use this code instead:               add_action('init', 'rb_add_rewrite_rules');     add_filter('post_type_link', 'rb_create_permalinks', 10, 3);          function rb_add_rewrite_rules() {         global $wp_rewrite;         $wp_rewrite->add_rewrite_tag('%movies%', '([^/]+)', 'movies=');         $wp_rewrite->add_rewrite_tag('%genre%', '([^/]+)', 'genre=');              $wp_rewrite->add_permastruct('movies', '/genres/%genre%/%movies%', false);     }          function rb_create_permalinks($permalink, $post, $leavename) {         $no_data = 'no-data';         $post_id = $post->ID;              if($post->post_type != 'movies' || empty($permalink) || in_array($post->post_status, array('draft', 'pending', 'auto-draft')))         return $permalink;              $event_id = get_post_meta($post_id, 'genre', true);         $var1 = basename(get_permalink($event_id));         $var1 = sanitize_title($var1);              if(!$var1)             $var1 = $no_data;              $permalink = str_replace('%genre%', $var1, $permalink);              return $permalink;     }      Ok, here's the problem. Both the Die Hard permalink and the archive-genres.php (displaying all the genres) is looking good, but the single-genres.php isn't found – instead, going to /genres/action will display the index.php code. I guess the problem is that my rewrites collide, maybe it's not possible to do this: **'movies' CPT permalink**               /custom base name/custom field meta box value)/'movies' CPT post name      **'genres' CPT permalink**               /custom post type name (same value as the custom base name above!!)/'genres' CPT post name      How can I make WordPress use single-genres.php for /genres/action etc?


title: Event Archive by Month

text: I'm creating an events site for a theatre in wordpress - at the moment I have set up a custom post type for Events and am using a custom field 'event_date' (which formats to YYYY-MM-DD) to order the events on their listing page and also move them to the archive if past todays date. So far all working nicely. Next up I need to create an month by month filter for the months in which shows appear however am a bit stumped. I guess I need to: \- check the months which contain shows (not past) and output a list link these months to a template which filters to just show the relevant month.. Any pointers? Thanks in advance


title: How to update/delete array in post meta value?

text: I using post meta like..               $meta = get_post_meta(99,'_mymeta',true);     $value = $meta['somekey'];     echo $value;      But how to update `$meta['somekey']` to some another value ? How to use update_post_meta to update sub meta key ?(Idk, How ppl call)               update_post_meta(99, '_mymeta["somekey"]', 'myAnotherValue');      ?????


title: How to add subfolders in media library for better organisation?

text: Right now I cannot create any subfolder e.g. reviews, news, interviews etc. I have a lot of images in my media library and it's messy. How can I create some folders and reorganize the images there?


title: Showing related posts (custom post type) outside of the loop

text:
I'm trying the following (it's a sidebar widget in the Single New template):
       <?php         $postid = $post->ID;         $categories = get_the_category($post->ID);       ?>
<?php echo $postid; ?>

<?php echo $categories; ?>
       <?php // Create and run custom loop         $args=array(           'post_type' => 'news',           'category__in' => $categories,           'post__not_in' => $postid,           'posts_per_page'=> 3 // Number of related posts that will be shown.         );         $custom_posts = new WP_Query();         $custom_posts->query( $args );         while ($custom_posts->have_posts()) : $custom_posts->the_post();       ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
       <?php endwhile; ?>       <?php wp_reset_postdata(); ?>
See All Positions >>

      But as it turns out, `$postid` comes up blank and `$categories` outputs as `Array`. What am I doing wrong here?


title: Looking for membership style plugin with edit option

text: I have had a search but not found what I'm looking for so far. I am looking for a plugin which will provide a functionality on a site for the following:   * Use wants to sign up to my site, goes through a registration process   * Logs on to a user portal where they can add/edit/remove their own posts   * Offer free and paid memberships I have looked at membership plugins but none seem to satisfy my need for the user to add/edit/remove their own posts and for their portal to NOT look like WordPress but more a "white label" solution if you will. I am not looking to offer premium content, I am looking to provide a place where people can place their own items in a listing style website. Any info would be greatly appreciated. Thanks gdude


title: How to Disconnect My Domain Name?

text: So, I have a problem. I recently bought a domain name, as well as a hosting plan. Then I downloaded WordPress and now whenever I want to edit my website, I have to do it by logging in to the "example.com/wp-admin" page. However, the problem is that I want to be able to make my own website using a FTP (CyberDuck), and not have to use WordPress services. This is my first time doing this, so I'm not sure if my domain name is now connected to WordPress? If so, how do I disconnect it, so I just have the domain name on its own, and then I can use a FTP to edit the website with HTML/CSS/JS on my own? I am very confused and not sure what to do.


title: Is it possible for two WordPress plugins to share the same code base?

text: So I have written my first WordPress plugin for production and in the next few days I will be starting up on another project where I might have to write two plugins for the same WP site because they do two distinct set of tasks. Now I was reviewing some of the code I had written for the first plugin I thought it would be great if the two plugins could share some of that code that I had written for the first plugin from my earlier project. At first I thought maybe I should just write one plugin that does it all but after some pondering I've come to the conclusion that I wanted my plugins to be small and do few tasks rather than having a bloated plugin that does too much. It would be hard to maintain later. So I was wondering if anyone has ever written a code base for that multiple plugins can share and how you accomplished this. Any relevant links would be appreciated.


title: Can I specify that custom.css gets loaded at Appearance > Editor instead of style.css?

text: I want to specify which css file gets loaded when the user clicks on "Appearance > Editor". However, its always loading style.css for some reason. Any way to enforce that a specific file gets loaded there?


title: How to fix these PHP Warnings with the "Feed JSON" plug-in?

text: I'm getting the following PHP warnings when using the WordPress plug-in "Feed JSON". Can someone tell me how to fix them? > Warning: Invalid argument supplied for foreach() in /mypath/wp- > content/plugins/feed-json/feed-json-template.php on line 39 > > Warning: Cannot modify header information - headers already sent by (output > started at /mypath/wp-content/plugins/feed-json/feed-json-template.php:39) > in /mypath/wp-content/plugins/feed-json/feed-json-template.php on line 53 Here is the code used in feed-json-template. Lines 39 and 53 are highlighted with ** around each line.               <?php     /**      * JSON Feed Template for displaying JSON Posts feed.      *      */     $callback = trim(esc_html(get_query_var('callback')));     $charset = get_bloginfo('charset');          if ( have_posts() ) {         $json = array();         while ( have_posts() ) {             the_post();             $id = (int) $post->ID;                  $single = array(                 'id'        => $id ,                 'title'     => get_the_title() ,                 'permalink' => get_permalink(),                 'content'   => get_the_content(),                 'excerpt'   => get_the_excerpt(),                 'date'      => the_date('Y-m-d H:i:s','','',false) ,                 'author'    => get_the_author() ,                 );                  // thumbnail             if (has_post_thumbnail($id)) {                 $single["thumbnail"] = preg_replace("/^.*['\"](https?:\/\/[^'\"]*)['\"].*/i","$1",get_the_post_thumbnail($id));             }                  // category             $categories = array();             foreach((get_the_category()) as $category) {                  $categories[] = $category->cat_name;              }             $single["categories"] = $categories;                  // tag             $tags = array();             **foreach((get_the_tags()) as $tag) {**                  $tags[] = $tag->name;              }             $single["tags"] = $tags;                  $json[] = $single;         }         $json = json_encode($json);              nocache_headers();         if (!empty($callback)) {             header("Content-Type: application/x-javascript; charset=$charset");             echo "$callback($json);";         } else {             **header("Content-Type: application/json; charset=$charset");**             echo "$json";         }          } else {         header("HTTP/1.0 404 Not Found");         wp_die("404 Not Found");     }     ?>


title: Widgets with groups / sub widgets? Widget in a widget?

text: I tried to find anything about adding a widget within a widget area. That widget should be a widget group / sub widget area. **I've found a plugin that does this:**   * http://wordpress.org/extend/plugins/extensible-widgets/   * http://jidd.jimisaacs.com/files/2010/02/wpew-screen-9.png **What I really want is to dynamically create something like this without the help from plugins:**   * http://www.gabfirethemes.com/demos/newspro/ Any bright ideas?


title: Insert/sticky multiple posts in multiple positions

text: I'm attempting to do this but with multiple posts and specific positions. The post positions are hard coded right now, but will be pulled in from post meta. This code is only being ran on the homepage and the posts aren't paginated.               $essay_args = array(         'posts_per_page' => get_option('posts_per_page'),         'post__not_in' => array($post->ID),         'post_type' => array('post')     );     $essays = get_posts( $essay_args );          $fixed_posts = get_posts(array('post_type'=>array('ad','book')));          $positions = array(2,5,10); // to be pulled in from ad/book posts     $x = 0;          foreach($fixed_posts as $fixed_post) : setup_postdata($post);         $e_posts = new WP_Query(array('p'=>$fixed_post->ID,'post_type'=>array('ad','book')));         if (!empty($e_posts->posts)) array_splice($essays,$positions[$x],0,$e_posts->posts);         $x++;      endforeach;           foreach($essays as $essay) : setup_postdata($post);         echo $essay->post_title . '<br>';      endforeach;      Does it make more sense to do multiple WP_Query/get_posts requests for each post by id or does that tax the database too much? Is a there a cleaner way to do this?


title: Custom widget not appearing on front end

text:
I have the following widget location defined in my theme's `functions.php`:               register_sidebar( array(         'name' => __( 'Opening Hours', 'transparent' ),         'id' => 'sidebar-hours',         'description' => __( 'Appears on the front page', 'transparent' ),           'before_widget' => '
',         'after_widget' => '
',         'before_title' => '
',         'after_title' => '
',     ) );      This widget location is appearing in Admin > Appearance > Widgets, and I have a HTML text widget in this location. In my theme's index.php, I have the following code:               <?php if ( is_active_sidebar( 'sidebar-hours' ) ) : ?>
           <?php dynamic_sidebar( 'sidebar-hours' ); ?>
     <?php endif; ?>      However, on the front end of the website, the widget text is not appearing. It should be below the navigation menu. Can you provide troubleshooting advice please?


title: get post images to link to external sources

text: I'm buiding a site that lists the most recent posts on the front page, the site is a recompilation of interesting articles and images so it doesn't make sense to link to the individual post. I currently have the title redirecting externally to the link, but I would also like to link externally via the post image. I've set up a custum field "externalurl" This is what I have so far in the loop.php which does not work:                   <?php         if ( has_post_thumbnail() ){ ?>             <?php $thumbURL = get_post_custom_values('externalurl'); ?>             <a href="<?php echo get_attachment_link($thumbURL); ?>" rel="gallery" title="<?php the_title(); ?>">                         <?php the_post_thumbnail(); ?>                                       <?php } ?>      Does anybody have any idea what I'm doing wrong? Any suggestions welcome. Thanks in advance!


title: Get gallery url (Nextgen)

text: Is there a way to get the gallery url of images. What I want to do is this: image1 image2 image3 are in gallery "Pinto". When a user clicked for example on **image 1** and it pop-ups in lightbox I want there to show from wich gallery is the image and when the user clicked on that link to go to that gallery. I found out how to get the gallery title - `<?php echo $gallery->title ?>` , but couldn't find the right code for the gallery url. Any help would be greatly appreciated. Thanks. p.s. Sorry for my English.


title: Plugin for TinyMCE to create reference to other posts

text: Is there any plugin that would allow me to easily insert reference to another post for TinyMCE? I want to be able to reference another post by permalink and the link text to be the title of the post.   Alternatively, is there any plugin that allow me to do this with short-code? i.e               [reference post-id="2345" link="peramlink"]