title: Plugin Options not saving options and doesn't work

text:
So I've been making a plugin for wordpress that adds a custom post type for products, which was fairly simple and i made that work. Afterwards I wanted to make a settings page sub menu to the custom post type in the admin menu and then create some options. So the first problem i encountered was that a warning showed up that said               Warning:  Illegal string offset 'option1' in C:/blablablal on line 96      And from what I understand that means that the option doesn't know that it's supposed to save the options in an array but tries to put it in a string instead. So I found a way to make the warning go away by adding brackets to the variable.               $kns_options[] = get_option('kns_products_options');      (I don't know if this is a solution or not, but I couldn't find anything about it on loads of google searches) So after the warning went away, I started to try and add options via the form I've created, but the options just don't want to save. I've tried to var_dump the variable, but it comes out empty.. Is there a typo somewhere, because i sure as hell can't find it! I'll post the code below, please tell me if i should repost it in pastebin or something!               <?php     add_action( 'init', 'kns_register_products_post_type' );          function kns_register_products_post_type() {         // Registrerar en custom post type som heter produkter         register_post_type('produkter',         array(             'labels' =>                  array(                     'name' => 'Produkter',                     'singular_name' => 'Produkt',                     'add_new' => 'Lägg till ny',                     'add_new_item' => 'Lägg till ny Produkt',                     'edit_item' => 'Ändra Produkt',                     'new_item' => 'Ny Produkt',                     'view_item' => 'Visa Produkt',                     'search_items' => 'Sök Produkter',                     'not_found' => 'Inga produkter hittades',                     'not_found_in_trash' => 'Inga produkter hittades i papperskorgen',                     'parent_item_colon' => 'Produkt Förälder:',                     'menu_name' => 'Produkter'                 ),             'public' => true,             'supports' => array('title', 'editor', 'thumbnail'),             'taxonomies' => array('category'),             'menu_position' => 20,             )         );          }          add_action( 'admin_menu', 'kns_products_create_settings_submenu' );          function kns_products_create_settings_submenu() {         // Skapar sub menu för Produkter-fliken         add_submenu_page('edit.php?post_type=produkter', 'Inställningar', 'Inställningar', 'manage_options', 'product_settings', 'kns_products_settings_page' );         // Kallar på register_setting funktionen         add_action( 'admin_init', 'kns_products_register_settings');     }          function kns_products_register_settings() {         register_setting( 'kns_products_settings_group', 'kns_products_options', 'kns_sanitize_options');     }          function kns_sanitize_options( $input ) {         $input['option1'] = sanitize_text_field( $input['option1'] );         $input['option2'] = sanitize_text_field( $input['option2'] );     }          function kns_products_settings_page() {     ?>

Produktinställningar
          <form method="post" action="options.php">         <?php          settings_fields( 'kns_products_settings_group' );         $kns_options[] = get_option('kns_products_options');          var_dump($kns_options);         ?>

Utseende

                 Blajja	                                      <input type="text" id="option1" name="kns_options[option1]" value="<?php echo esc_attr( $kns_options['option1'] ); ?>" />

                 Annan Blajja	                                      <input type="text" id="option2" name="kns_options[option2]" value="<?php echo esc_attr( $kns_options['option2'] ); ?>" />

             <input type="submit" class="button-primary" value="Spara inställningar" />
          </form>
     <?php     }     ?>      I really need help, I've been at this for hours now.. EDIT: var_dump results are               array(1) { [0]=> string(0) "" }


title: Custom Post type showing up in loop, regular posts are not showing up

text: Every one knows the basic WordPress loop, every one knows that if you want just posts in a loop you put `query_posts("post_type=post");` **BEFORE** the loop. which I have done. The problem is I have a custom post type, called mini feeds, which shows up in my loop, the problem is, its the only thing that shows up. I have 60 posts, under post type posts and **NONE** of them show up, just this one (because there is currently only one) mini feed. The custom post type looks like this:               public function aisis_mini_feed() {         $labels = array(             'name'                => _x( 'Mini-Feeds', 'Post Type General Name', 'text_domain' ),             'singular_name'       => _x( 'Mini-Feed', 'Post Type Singular Name', 'text_domain' ),             'menu_name'           => __( 'Mini-Feed', 'text_domain' ),             'parent_item_colon'   => __( 'Parent Mini-Feed:', 'text_domain' ),             'all_items'           => __( 'All Mini-Feeds', 'text_domain' ),             'view_item'           => __( 'View Mini-Feed', 'text_domain' ),             'add_new_item'        => __( 'Add New Mini-Feed', 'text_domain' ),             'add_new'             => __( 'New Mini-Feed', 'text_domain' ),             'edit_item'           => __( 'Edit Mini-Feed', 'text_domain' ),             'update_item'         => __( 'Update Mini-Feed', 'text_domain' ),             'search_items'        => __( 'Search Mini-Feeds', 'text_domain' ),             'not_found'           => __( 'No mini-feeds found', 'text_domain' ),             'not_found_in_trash'  => __( 'No mini-feeds found in Trash', 'text_domain' ),         );              $rewrite = array(             'slug'                => 'mini-feed',             'with_front'          => true,             'pages'               => false,             'feeds'               => true,         );              $args = array(             'label'               => __( 'mini-feed', 'text_domain' ),             'description'         => __( 'Mini-Feed custom post type', 'text_domain' ),             'labels'              => $labels,             'supports'            => array( 'title', 'editor', 'author', 'thumbnail', 'revisions', ),             'hierarchical'        => false,             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,             'show_in_admin_bar'   => true,             'menu_icon'           => 'http://icons.iconarchive.com/icons/fatcow/farm-fresh/32/folders-icon.png',             'can_export'          => true,             'has_archive'         => true,             'exclude_from_search' => true,             'publicly_queryable'  => true,             'query_var'           => 'mini-feed',             'capability_type'     => 'post',         );              register_post_type( 'mini-feed', $args );     }      **My question?**   * Why is this mini feed showing up in my loop?   * Where did the rest of my posts go? **My loop**               query_posts("post_type=post");     if(have_posts()){         while(have_posts()){             the_post();             the_title();             the_content();         }     }


title: "Insert Into Post" For Custom Button

text: I'm in the process of trying to build a improved media library for our contributors. I have set up a custom taxonomy category for media, and set up a tab in the Add Media popup box for browsing through the various media categories. I'm stumbling on the final piece of the jigsaw to insert the HTML code for the image using a button (in the same way the default media library does). Below is a screenshot to give you a clearer idea of what I've built this far. I had found what I thought was a solution using `tinyMCE.activeEditor.setContent` as an `onclick` function, but it didn't do anything. ![snapshot](http://i.imgur.com/czWMP.jpg)


title: My WordPress Admin looks messed up when I edit posts or pages

text: And I don't know how it happened. Here's a screenshot - anyone have any ideas for me? Thanks!! ![screenshot](http://i.stack.imgur.com/wYCRU.png) My active plugins: Add From Server Akismet BackupBuddy   Collapse-O-Matic Contact Form 7 Duplicate Post Easy FancyBox Featured Video Plus Google Analytics   Google sitemap plugin   Gravity Forms   Gravity Forms CSS Ready Class Gravity Forms Find My Forms Gravity Forms Salesforce API Add-On HTML Page Sitemap   Meta Box   Multiple Post Thumbnails   NextGEN Gallery   nrelate Related Content   Post Types Order   Really simple Facebook Twitter share Search Everything   Shortcodes Ultimate   Slider PRO   Testimonials Widget   Ultimate TinyMCE   W3 Total Cache   WordPress SEO   WP UI - Tabs, accordions


title: Is it possible to change image size used for preview thumnail in Add Media popup

text: I has cleaned up my media items by removing all the medium and large size from upload dir. So the medium size now could not be found. Currently the Media library popup (when click Add media) uses medium for default and because of my medium size is lost, it uses full size instead, and it causes a slow load time. How can I change the display size of preview image in Media Library from medium to thumbnail. Related: How to change the image size in new Media Uploader (ie use medium vs thumbnail)


title: Conditional function for excluding first image from content, not working

text: I have the following function:               function remove_images( $content ) {         if( ( is_category() || is_archive() || is_home() ) && has_term( 'MyCat', 'category', $postID ) ) {             $postOutput = preg_replace("/\< *[img][^\>]*[.]*\>/i","",$content,1);         return $postOutput;         }     }     add_filter( 'the_content', 'remove_images', 100 );      What it is meant to do is remove the first image in the_content() on thew index page (all listing pages) only for those posts in the MyCat category. What it is doing, instead, is removing the first image from the_content() on all posts for the index page, and removing the_content() altogether on **all** of the **single pages**. Any help would be appreciated. Thank you.


title: Load-Testing a Wordpress Site

text: Can anyone recommend a load-testing solution for WordPress? I'm expecting about 500,000 page hits a month and wanted to do some stress testing on the WP framework & server stack. I would prefer something opensourced, but am open to other solutions.


title: Using add_rewrite_tag to create urls for page sections

text: I am dividing my page templates into linkable regions. I'd like to be able to use clean urls to do so. My page urls look like so `www.example.com/page-name/?section=example` I'd like to rewrite the url to `www.example.com/page-name/example` I've scoured for an answer but I'm not quite getting there.               add_action('init','thick_section_rewrite');          function thick_section_rewrite(){              add_rewrite_tag([what goes here?], '([^&/]+)');         add_rewrite_rule( [what goes here?], '?section=$matches[1]', 'top' );          }      What do I put in that first param of `add_rewrite_rule` and `add_rewrite_tag`?


title: Get terms from posts submitted within a certain time

text: I am running a query which pulls out the most popular taxonomy terms (named "cause") from a custom post type (named "reasons") and I am ordering them by most popular. However, I need to limit the terms retrieved to the ones assigned to posts submitted within the last 12 hours. The code I currently have is as follows:               $terms = get_terms('cause', 'orderby=count&order=desc&hide_empty=0&number=6');          foreach ($terms as $term) {            ...          }


title: I Want to Get A Plugin Version Number Dynamically

text: Howdy, I recently cribbed W3TC to implement an "in-update" changelist display (very cool), in my plugin, but there's an awkward bit of code I'd prefer to avoid. If you look at the top of this file, you'll see the following code: `define ( 'BMLT_CURRENT_VERSION', '2.1.16' ); // This needs to be kept in synch with the version above.` Ick. :P That needs to be kept up to date, so the function can delta between your plugin, and the current stable version. I have perused the Codex, and can't find it, but there has **GOT** to be an API function for getting the version of a plugin. Any clues?


title: long delay before loading website because of wp_footer()

text: This might sound weird but this is what really happening to my website. while investing the long delay even before my site starts to load, after searching the source of the problem for a long time i found out that if i remove the wp_footer() from the footer template, the site loads normally. And this delay occurs even if i deactivate all plugins and try loading the site keeping wp_footer() in the template. you can see here in my website: http://www.vps.cadetcollegeblog.com i would be highly grateful if someone points me the reason for this weird behavior and help resolve it. thanks in advance.


title: Prevent Admin gui output from page added using add_submenu_page

text: I have created a download link for my plugin using add_submenu_page. When the link is clicked it gathers some files into a zip, then outputs the contents to the browser like so:               header('Content-Type: application/zip');     header('Content-Length: ' . filesize($file));     header('Content-Disposition: attachment; filename="file.zip"');     readfile($file);     unlink($file);      The issue is that wordpress by default wraps everything in it's admin theme. Is there a flag or something I can set to tell wordpress that for this particular page I don't want it to out the admin interface? Edit: Here is the code I used to generate the submenu page:                 add_action('admin_menu', array($this, 'add_download_page'));            function add_download_page() {         add_submenu_page(              'options.php?post_type=spn_newsletter'           , 'Download Newsletter'            , 'Download Newsletter'           , 'manage_options'           , 'spn_download'           , array($this, 'do_download')         );       }


title: wp_nav_menu with default pages menu

text: i'm using wp_nav_menu to generate a navigation menu for my theme. It works fine by selecting my created menus. But, what if i want to generate a list from my already created pages and subpages in wordpress ? I tried using wp_page_menu, which does what i want, but i cannot pass a css class parameter to the inside ul, in order to stylize my menu. Does anyone know how i can do that ?


title: How do I call an external php non WordPress class into functions.php?

text: All my WordPress files are in:               /httpdocs/news/      and the classes I want to call are in:               /private/classes/      Would I use the include_once() function or is there a WordPress function? And how would I do it? Cheers


title: wp_nav_menu(), how to change <li> class?

text:
I'm building a menu for my website. The static is looking like this:

Item 1

Item 2

Item 3

Item 4

Item 5

Item 6

Item 7

Item 8

      I've been able to understand how to customized the `<ul>` tag, to get rid of the automatic `<div>` tag. But now, I want to customized the `<li>` tag to be able to assign different `class` name to control specific behavior through CSS. When I use the `wp_nav_menu()` the output is as follow:

Fashion

Documentary

Events

Portraits

      I want to get rid of the `id` in the `<li>` tags and change the `class` to reflect the name of the page I want to link to. Basically I want to output the the same thing as the 1st snippet of code in this post. The reason why I doing this, is that I use custom images that is controled by my CSS insted of plain text. Is this possible? What strategy I should use to overcome this problem?


title: Unable to display favicon using get_favicon()?

text:
I'm using fetch_feed (based on Simplepie) to display an array of RSS feeds (favicon & headlines only). Documentation on the simplepie website says to use get_favicon in the stylesheet. And I'm using the fetch_feed codex example. I'm getting the spacing where the favicon should be but not the favicon. The feed links appear fine. CSS:               .rss a {     padding:0 0 0 20px;     background:transparent url(<?php echo esc_url ( $item->get_favicon() ); ?>) no-repeat 0 1px;     }      PHP:
<?php _e('Recent news from Some-Other Blog:'); ?>
              <?php // Get RSS Feed(s)                  // include_once(ABSPATH . WPINC . '/feed.php');                  // Get a SimplePie feed object from the specified feed source.                  $rss = fetch_feed(array('http://wordpress.org/news/feed/','http://beernews.org/feed/'));                      if (!is_wp_error( $rss ) ) : // Checks that the object is created correctly                             // Figure out how many total items there are, but limit it to 5.                             $maxitems = $rss->get_item_quantity(20);                               // Build an array of all the items, starting with element 0 (first element).                              $rss_items = $rss->get_items(0, $maxitems);                       endif;              ?>
              <?php if ($maxitems == 0) echo '
No items.
';              else                  // Loop through each feed item and display each item as a hyperlink.                  foreach ( $rss_items as $item ) : ?>
                             <a class='rss' href='<?php echo esc_url( $item->get_permalink() ); ?>' title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'>                                                <?php echo esc_html( $item->get_title() ); ?>                                                                    <?php echo '
'; ?>
                  <?php endforeach; ?>


title: Populate Custom Fields in a Custom Post Type?

text: I want to set up a basic 'post rating' system for my site - I don't want to use a plugin - so I want to add the custom field 'rating' to each new custom post and populate this field with the number 1. Is this possible? Or am I going about this the wrong way? Did a lot of searching a found not much, `add_post_meta()` ? I'm not sure where that would go.


title: Let visitors show/hide a type of content

text: I have three different levels on articles, Level1, level2 and level3. In the main section of my homepage, I show all three types of articles, but I want the user to have the option to hide/remove Level3-articles. The Levels are saved in the database as a meta_value. Each post got its level as a class; `<article class="news-entry Level3">` So, to the question: How can I let visitors toogle to show/hide the Level3-articles? Preferabbly without reloading the page. Perhaps a simple `display:none`, but I do not know how to make this. Thanks!


title: How to edit pages after installing WP

text: I'm really new to Wordpress. I just installed it following the instructions here      http://codex.wordpress.org/Installing_WordPress_Locally_on_Your_Mac_With_MAMP      and I'm wondering what to do next. I already have an account and a website set up, and how do I edit that website now on my computer?      any input would be really appreciated.


title: Meta_query with or without value

text: I am using WP_Query to sorting the post by user input. The input contains meta value which is display in select type field. Normally when there is value inserted into the form, the wp_query working fine. But how about when the user want to sorting all the posts regardless what the meta is value is? Here is what I mean:               //this is my input form      <select name"rating">     <option value="">Show all</option> //if user select this, show all post, regardless the rating     <option value="1">1</option>     <option value="2">2</option>     <option value="3">3</option>      </select>           //here is for WP_Query     $args = array(     'post_type'=>array('listing','renting'),     'posts_per_page'=> 6,     'order' => 'DESC',     'meta_query' => array(     'relation' => 'AND',      array(             'key' => 'rating',             'value' => $_GET['rating']//here is what I don't understand, what if no value in this field?is it take the value as "0"?         ),     ......     ),        As you can see, in the select form, there is a option that will show all the posts regardless the rating. How do I suppose to do so? thanks


title: Append Auto Suggest list to specific html tag?

text: Right now I have a script that auto suggests some post titles, using wordpress' suggest.js               <script type="text/javascript">         var se_ajax_url = '<?php echo admin_url('admin-ajax.php'); ?>';          jQuery(document).ready(function() {     jQuery('#love-input').suggest(se_ajax_url + '?action=se_lookup', {         onSelect: function() {             thevalue = this.value;             thevalue = thevalue.split(' (');             jQuery('#love-input').val(thevalue[0]);         }     });     });      However, it appends the list to the bottom of my body tag, and I can't figure out how to put it in the specific div that I want. Help!


title: Trying to extract alt text to a new site

text: Im using "the DownML - Download Media Library" plugin to transfer all (551 images) my images to a new site and all is good, except I cannot find a solution for the "Alt Text" for the corresponding images? anyone can help? Im not good at html or php. :( Thanks in advance. Cheers,


title: WordPress Jquery Fade in, Fade out effect

text: I'm following a tutorial. I've included the hover.js with the following code:               $(function() {         // OPACITY OF BUTTON SET TO 50%         $(".imgopacity").css("opacity","0.5");              // ON MOUSE OVER         $(".imgopacity").hover(function () {             // SET OPACITY TO 100%             $(this).stop().animate({                 opacity: 1.0             }, "slow");         },              // ON MOUSE OUT         function () {             // SET OPACITY BACK TO 50%             $(this).stop().animate({                 opacity: 0.5             }, "slow");         });     });


title: Get the 5 lastest Featured Posts from a category

text: Here is the website http://ariadneswonderland.gr/ that all this concerns. On the homepage I'm using a Drop shadow box plugin under the gallery to show a series of images of featured posts, as of right now, as i'm still building the website all you see is the White box under the gallery and a emoticon inside it.. **What i'd like is to be able to do is have some code that pulls the 5 lastest posts from a category (in this case frontpage id 7) and Displays the Featured Post Image next to each other.** Code: ============= # = X X X X X = Where X is a Featured post image automatically retrieved instead of having to retrieve and add links every time i want to change a feature. = is the automatically generated [dropshadowbox]. Any ideas/code/snipets/plugins that you might feel would work would be greatly appreciated. So far however all i've come up with is this but I can't figure out how to implement the php into the post, phpexec and similar plugins don't seem to work for this, tho simple things like `echo test;` work fine. And making it a function doesn't work as it doesn't seem to return anything :S Obviously I need alot more coding experience but as of right now I'd like to just be done with this website.               PHP Code:     // fetching latest posts from specific category      $categoryId = 7;      $args = array('category' =>  categoryId  , 'post_status' => 'publish', 'numberposts' => 5);      $posts = get_posts( $args );      foreach($posts as $post){      $feat_image_url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );      $post_url = get_permalink($post->ID);      }


title: remove and disable image link in functions.php

text: Is there a way to disable image or thumbnail link URL, as well as remove existing image/thumbnail links in functions.php? NOT the setting under media as posted in this link, please.


title: How can I prevent Wordpress to wrap <br> into a <p> paragragraph

text: When I create a new page and put `<br class="clear">` into the HTML view it gets rendered as               <p>       <br class="clear">     </p>      This causes problems with the theme `http://www.gallyapp.com/tf_themes/?theme=Lotus` where the `<br>` is not wrapped. How can remove the wrapping?


title: Multisite signup spam troubles

text: I have a installation of Multisite that has a history of serious signup spam problems. When we ran WPMU 2.9.2 we tried this .htaccess method, this math plugin, and CAPTCHAs. After little success with those options we added some common email domains to Limited Email Registrations. We noticed that even after adding this measure we were still getting signups from domains we had banned. This made me think that there was a hole somewhere in the signup script (explaining our limited success with other measures). **Are there any known issues with Limited Email Registrations or any other holes in the signup process with older/current versions of WP Multisite?** We _have_ since updated to 3.3.1 and continue to experience significant spam signups. With the .htaccess method, math plugin, bad behavior, and of course e-mail activation, we still get 20-50 spam signups a day. I have a hard time believing that their isn't a hole _somewhere_.


title: Guidelines for adding static pages

text: I'm attempting to convert an existing site to Wordpress, mainly for the following reasons: a) I want to add new News & Blog pages and b) so other people can make occasional simple changes to the static (or almost static!) pages. I'm confused as to the best way to add the static pages to the site, should I be using custom templates, or just Wordpress Edit & html or something better? Broadly speaking, for most of the pages, I want the text on the left with pictures, maps etc on the right. Should I use sidebars or html floats? Also, I'm used to using Visual Studio for editing html, in comparison the Worpress editor seems pretty rudimentary + I have already lost some code switching between Visual & html. But obviously I want the pages saved on the database and I also want to insert plugin calls, etc I'd be grateful if anyone could give me some guidance on adding static pages. Thanks


title: Change attachment filename

text: Is there a function that allows me to change the filename of an attachment, based on the Attachment ID I have? Thanks! Dennis


title: Set transient with get posts error

text: I have a big WordPress installation more than 200K posts, with auto publish posts features. My post content is contained "some HTML tags, some text, some `<img>` tags". I need to remove all `<img>` tags from post content from the specific posts. So I have this function to do this job:               function remove_images_form_past_posts() {         if ( get_transient('images_removed_from_past') )             return;         $args = array(                      'post_type' => 'post',                      'year' => 2013,                      'monthnum' => 1,                      'day' =>28,                          'post_status' =>'publish',                     'category' => 30,                     'post_author' => 3,                     'nopaging' => 1                 );         $posts = get_posts( $args );                 if ( $posts ) {                 foreach ( $posts as $post ); setup_postdata( $post ); {                     $newcontent = preg_replace('/<img[^>]+\>/i', '', $post->post_content);                     $newpost = array(                                    'ID' => $post->ID,                                     'post_content' => $newcontent                                );                     wp_update_post($newpost);                     wp_reset_postdata();                 }                 set_transient('images_removed_from_past', 60 * 60 * 24);             }         }     add_action('admin_init','remove_images_form_past_posts');      The code above is perfect & do the job but have one problem: this code is unfortunately update 1 post only although the `$args` is matching 9 posts. I have tested the `get_posts` alone & it is working perfectly & executing 9 posts. I have stopped the `WP_super_cache` plugin & also no way. I have tried to change "set_transient $value from 1 to 9 with no way. Any ideas!


title: Select a specific post to display in a news box

text: I'm building a website based on posts (kind of blog platform). I would, however, like to be able to choose which post, from any category, to display in the homepage in a news box system. All the plugins/ themes I've been trying automatically display them from the most recent or only one category or tag. The problem is, I'd like to be able to choose a particular post, from any category. Is there a way to achieve this? If anybody can give me a suggestion, it will be wonderful!


title: BuddyPress admin bar links are broken

text: I have activated BuddyPress on a blog but the link `My Account` on the admin bar is broken. I have configured BuddyPress to auto create pages but still the problem persists. I have been searching Google for two days now. Please help. Thanks


title: get_terms does not return any results for my custom taxonomy?

text: If I go to wp-admin/edit-tags.php?taxonomy=location then I correctly see a list of terms. If I loop through:               get_terms("category");      Then I correctly see several terms for the taxonomy of category. Have I created my custom taxonomy incorrectly for the same function not to output any results for my taxonomy?               get_terms("location");          register_taxonomy('location', 'post',      array(             'labels' => array( 'name' => _x( 'Locations',         'taxonomy general name' ),          'singular_name' => _x( 'Location', 'taxonomy singular name' ),          'search_items' => __( 'Search Locations' ),          'all_items' => __( 'All Locations' ),          'parent_item' => __( 'Parent Location' ),          'parent_item_colon' => __( 'Parent Location:' ),          'edit_item' => __( 'Edit Location' ),          'update_item' => __( 'Update Location' ),          'add_new_item' => __( 'Add New Location' ),          'new_item_name' => __( 'New Location Name' ),          'menu_name' => __( 'Locations' ),        ),            'rewrite' => array( 'slug' => 'locations',          'with_front' => false,          'hierarchical' => true          ),      )     );


title: Add title & subtitle to shortcodes

text:
Is there a way I can add a custom title & subtitle to this shortcode function?               function spoiler( $atts, $content = null ) {     return '

'                  . $content .              '

';     }          add_shortcode('spoiler', 'spoiler');      Obviously the title & subtitle would go there the comment is in the h3 tag.


title: get_posts() method and paging is not working

text: Trying to use paging in one of my Wordpress site but seems it is not working.for paging i am using SEO Pager Plugin. here is my code               $params = get_query_var('args');          $ppp = get_option('posts_per_page');         if (!is_paged()) {                         $custom_offset = 0;                 } else {                     $custom_offset = $ppp*($paged-1);                    }     $args = array( 'meta_key' => 'post_author', 'meta_value' => $params ,'numberposts' => $ppp,'offset' => $custom_offset);             $authorposts=get_posts($args); echo count($authorposts);?>      now i am displaying post results inside the loop and i have placed               <?php SEO_pager(); ?>      outside the loop as per the instructions.I have total 239 posts with a given author but its showing only 5 post and no paging is being shown when i set number `numberposts` to -1 its showing all the posts but when using the default settings (5) it is showing only 5 posts with no paging options can any one point where i am doing wrong **Update** I used the following code and paging options came but when i am clicking on any page it showing no result, no sure how can i fix that               $params = get_query_var('args');                  $ppp = get_option('posts_per_page');                 $args = array(                                 'meta_key' => 'post_author',                    'meta_value' => $params ,                    'numberposts' => $ppp,                               'post_type' => 'post',                              'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),                        );                        $authorposts=query_posts($args);      any suggestion what i am doing wrong?


title: If post does not exist, do something

text: Is this possible? If so, how? I am linking to a non-existing post/page where I get a `404 error`. I want to have it to get the url of the `non-existing post` and make it a link on my 404 page, but I don't want it to throw an error (so no 404 page, just a simple page). When I click this, I want it to go to the page where I can add posts (from the front end with a plugin called `User Submitted Posts`). Is this possible? BTW: showing related posts by getting the link would be nice too. But I don't think that's possible.


title: Thumbnail Look For WP

text: I would refer you to this site: http://jimmyscarff.org/2013/11/12/the-funness-of-victor-harbor/ I am trying to get medium size photos for the pics, but they are all thumbnails and not WYSIWYG as I see them on my posts page. It looks really sucky, so how do I change the size of the pics so they are in medium size like the size of the Featured image, as the first photo is, and NOT THUMBNAIL SIZED. I am stumped to know as to what I have done wrong, and I want it looking good for my blog.


title: Single.php for Custom Post Type > Taxonomy > Term

text: I have a custom post type - Films. It has a taxonomy of Film_cat, which in turn has two terms/categories - Term1 & Term2. For each single post within Term1, I would like to display a specific single.php template. Each single post within Term2 should also have it's own single.php template. I am currently utilising taxonomy-film_cat-term1.php for the taxonomy archives templates, however can't find any info on how to create different single.php templates based on the taxonomy term. Effectively, I need a single.php template for a Custom Post Type > Taxonomy > Taxonomy Term.


title: If Month=Particular month display content

text:
I want to use conditional tag to display content according to month. Such as if it is April, it should show something else something else. Right now I am using :               <?php if(is_month() == '2' ) : ?>
hello
          <?php else: ?>
Wow
          <?php endif ?>      The above doesn't work. Any solution?


title: using array in wordpress database query

text: I have a strange situation, i'm working on wordpress website and creating a export plugin. On one page i have products name with checkbox and once i select few and submit it pass the value to next page. here is the code to get the value of checkboxes. FIRST SCENARIO:                   if(isset($_POST['products_id'])) {          $product= $_POST['products_id'];          $allProducts= implode(",",$product);          }            $sql = "SELECT DISTINCT {$fields} FROM {$this->db->posts} WHERE post_status in ('publish','future','private','draft', 'pending') {$post_type_filter} {$post_id_filter} {$post_status_filter} AND ID IN ($allProducts)  ORDER BY post_modified DESC";             var_dump($sql);               return $sql;      HERE RESULT COMES AS: string(235) "SELECT DISTINCT ID,post_modified FROM wp_posts WHERE post_status in ('publish','future','private','draft', 'pending') AND post_type = 'products' AND post_status = 'publish' AND ID IN ( **1402,895,2801,2999,425** ) ORDER BY post_modified DESC" SECOND SCENARIO: Here i'm not getting value from $_POST but directly giving to variable.                $allProducts= "1402,895,2801,2999,425";           $sql = "SELECT DISTINCT {$fields} FROM {$this->db->posts} WHERE post_status in ('publish','future','private','draft', 'pending') {$post_type_filter} {$post_id_filter} {$post_status_filter} AND ID IN ($allProducts)  ORDER BY post_modified DESC";             var_dump($sql);               return $sql;      RESULT COMES AS: string(235) "SELECT DISTINCT ID,post_modified FROM wp_posts WHERE post_status in ('publish','future','private','draft', 'pending') AND post_type = 'products' AND post_status = 'publish' AND ID IN ( **1402,895,2801,2999,425** ) ORDER BY post_modified DESC" in both case result is same as you see above. but when i run this it only work in 2nd scenario. Could any one suggest what is wrong in first scenario where i'm using POST method.???


title: How can I paginate image attachments in a post?

text: I have a post with attached images and I was able to display the images but I'm can't seem to find a way to paginate the results. I am using get_children but now I'm wondering if my method of displaying the images is the right way to do it or not. What other methods can I use? Thanks!


title: Home/front page won't display content after a form is submitted

text: I have setup a WordPress site using just pages (no posts) http://dev3.sugarvine.com/ I've created all the pages in the backend and made the 'About' page the front page. All the pages use index.php to display the page and content. I have a newsletter submit from in the sidebar that when it gets submitted it uses an anchor link to ensure that the user always sees the response form message. All of this works fine on all pages except the About / home /front page. Here's the problem: If i submit the form on the homepage it returns me back but does not show the homepages content. Yet on all the other pages the returning pages content will still be displayed. Can anyone suggest a fix to my problem. Thanks


title: Add Post Format Support to Twentyeleven Child Theme

text: On a Twentyeleven child theme's functions.php file I attempted to add video post format support using:               add_theme_support('post-formats', array( 'aside', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video', 'audio'));      ...adding the 'video' format to the array. But it would not work until I deleted the function in the parent theme. Obviously, when the theme is updated and functions.php is overwritten, I will lose the change. Whats the best way to avoid this and add support to my child theme? Thanks.


title: Search by keywords with boolean operators

text: Is there a way to tell WordPress to only search the keywords and nothing else? For example, if I searched "yellow, red, white" it would only display posts with one or a combination of those keywords in it. Is this possible in WP?


title: Get a user's most recent post title

text: If I have a user's ID, what's the best way for me to get the title of that user's most recent post?


title: Auto delete WordPress images/thumbnails (all sizes) and featured after X days/hours, or similar?

text: I am looking for solution to auto delete images of old posts in WordPress site. I want to hold images of current 50 posts, others should be deleted automatically. It can be function to delete on time interval, or function to hold only images of last 50 posts. Does anyone know function or some plugin which can do this or similar things, to automatically delete older images? I believe that setting a cron job will be needed. Someone posted this function in stackoverflow but I don't see any mention of time.               function delete_post_media( $post_id ) {              $attachments = get_posts( array(             'post_type'      => 'attachment',             'posts_per_page' => -1,             'post_status'    => 'any',             'post_parent'    => $post_id         ) );              foreach ( $attachments as $attachment ) {             if ( false === wp_delete_attachment( $attachment->ID ) ) {                 // Log failure to delete attachment.             }         }     }


title: Using jquery migrate for plugins incompatible with jquery 1.10.2

text: I'm trying to use a jquery plugin that is not compatable with jquery 1.10.2 in Wordpress 3.6 and was able to fix it by using jquery migrate which apparently also ships with 3.6. I thought I could perhaps include it as a dependency like so:               add_action('wp_enqueue_scripts', 'tf_load_custom_scripts');          function tf_load_custom_scripts() {              wp_register_script('curtain', get_stylesheet_directory_uri().'/curtain.min.js', array('jquery', 'jquery-migrate'), 2.0 );          wp_register_script('curtain-instance', get_stylesheet_directory_uri().'/curtain-instance.min.js', array('curtain','jquery','jquery-migrate'), true );               if( is_front_page() ) {             wp_enqueue_script('curtain');             wp_enqueue_script('curtain-instance');         }                   wp_enqueue_script('custom_script', get_stylesheet_directory_uri().'/script.min.js', array('jquery'), 1.0, true );          }      but it still isn't working so I would love some help.


title: How to get list of paths (not urls) for an image

text:
I can get a list of urls for an image like this:               $sizes = array_merge(array('full'),get_intermediate_image_sizes());     foreach ($sizes as $imageSize) {         $image_attributes = wp_get_attachment_image_src( $post->ID , $imageSize );         echo   $imageSize . ':
' .$image_attributes[0].'
';     }      which gives me               full:     http://domain.com/wp-content/_uploads/2014/01/my_image.png     thumbnail:     http://domain.com/wp-content/_uploads/2014/01/my_image-150x150.png     medium:     http://domain.com/wp-content/_uploads/2014/01/my_image-300x116.png       What I want is               full:     /path/to/public_html/wp-content/_uploads/2014/01/my_image.png      thumbnail:     /path/to/public_html/wp-content/_uploads/2014/01/my_image-150x150.png      medium:     /path/to/public_html/wp-content/_uploads/2014/01/my_image-300x116.png


title: Sort users in get_users() in custom order

text: <?php     $blogusers = get_users('include=5,6,2,7,12,8');     foreach ($blogusers as $user) {     ...              }     ?>      Right now these users will sort by first name. How do I sort this the order the numbers are in "include=..."? i.e. user 5 first, user 6 second, user 2 third etc.


title: Automatically Wrap Inserted Images in Div?

text:
When I insert images into a post, it always wraps the lot of them in this:
image 1 image 2 image 3
      Is it possible to change that to something like this?:
image 1 image 2 image 3
      I found this code but it wraps every individual image in the div instead of the entire chunk of them:                   if(is_admin()){            add_filter('image_send_to_editor', 'wrap_my_div', 10, 8);            function wrap_my_div($html, $id, $caption, $title, $align, $url, $size, $alt){         return '
'.$html.'
';       }     }      Thank you!


title: How to remove a file included in parent theme with locate_template() via child theme?

text: In my theme I use `locate_template()` to load the various parts of my functions library. I'm looking for a way to not include one of those files when using a child theme. I tried adding `locate_template('same_file_name.php', false);` to my child theme's functions.php but it is still included. CLARIFICATION EDIT: I don't want to prevent this file from being used by child themes. In general I want this file to be included when I am using a child theme. I am looking for something to add to a child theme when I don't want to use it.


title: Import a regular WordPress blog into a MU installation

text: I am looking for a safe way to import independent blogs into a WordPress MU installation. The basic idea is to merge multiple blogs running on subdomains into a single wordpress installation with MU feature. I can use the WordPress export/import feature but it would not work in my case with some of the blogs having a lot of content. I have played with this option. Not worth it. Export would time out even on localhost. I also need the postid to remain same so that links do not break. I have spent a lot of time looking at the options I have. Import using PHPMYADMIN seems to be the only way out. But I am not sure what would be a safe way to import using this route! Any ideas!


title: Shortcoding with Divs

text:
I am trying to turn a custom query into a shortcode but I am having some difficulty. Firstly, I am not sure how to return a custom thumbnail size via `$return_string`...in fact I am not sure how to return most of my styling. here is what I have so far. I'd like to put this:               <?php $query = new WP_Query                 (array('showposts' => 3, 'orderby' => 'date', 'order' => 'DESC'));                 while ($query->have_posts()) : $query->the_post();?>

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

                             <?php the_post_thumbnail('recent_news_size'); ?>

                             <?php echo excerpt(22); ?>

             <?php endwhile; ?>             <?php wp_reset_postdata(); ?>      Into my shortcode here:               function recent_posts_function($atts){        extract(shortcode_atts(array(           'posts' => 1,        ), $atts));             query_posts(array('orderby' => 'date', 'order' => 'DESC' , 'showposts' => $posts));        if (have_posts()) :           while (have_posts()) : the_post();              $return_string .= '//put stuff here';           endwhile;        endif;             wp_reset_query();        return $return_string;     }          function register_shortcodes(){        add_shortcode('recent-posts', 'recent_posts_function');     }          add_action( 'init', 'register_shortcodes');      Do any of you gurus know of a quick and easy way to turn it all into a shortcode?


title: print_media_templates not applied in media manager plugin

text:
I'm trying to build a media library where users can choose pictures that are being retrieved from custom folders, which they can specify the basefolder of. I am getting the correct images back, but the template specified isn't applied to the thumbnails. It does find the caption (see sidebar when img is selected) ![images from 2013_accs folder](http://i.stack.imgur.com/Bm68c.jpg) Instead of applying the wanted template, it says

      ![enter image description here](http://i.stack.imgur.com/CyjQO.jpg) I actually don't even need a custom template, I'd be happy to have the image show up as in the standard library, but I can't seem to get the correct result. In media-folder-management.js file I have this               var MfmView = Backbone.View.extend({         tagName: "li",         className: "mfmimage attachment",         template: wp.media.template('mfmimage'),         render: function(){             this.$el.html(this.template(this.model.toJSON()));             return this;         }     });      And in media-folder-management.php there is               public function print_media_templates() {         if(!$_POST['id']){             $this->printInit();         }              ?>                            <?php          }      Goal is to keep WP functionality (featured image, create gallery, insert into page/post), but with more structured folderstructure (as customer allready has complete image-library structure). Next steps would be:   * when file is dragged into the window, must be uploaded to folder which is open   * create/delete folders (with privileges according to user roles)   * drag img to other folder (optional) I hope someone can help me solve this, I'm not very familiar with Backbone.js yet. Thank you in advance!


title: Let users register and show them a members only area (without plugin)

text: I would like for users to be able to register using a form on the front end of the site to create them an account, after they've confirmed they will have access to a page only they can see, with their details and eventually things they've favourited. I'm basically looking for a flexible way to allow member registration and management. No payment system is needed, although in the future this might be a possibility. Can this be done without a plugin? I can't find any resources. Thanks


title: How to send post notification when a Author and Contributor post?

text: I am using the code below on a multi user blog for sending a email notification to users when new post is published . But the problem is it is sending notification only when a Administrator and Editor is posting. I want to send notification when a Administrator, Editor, Author and Contributor post any thing. So what should I change of the code below for work for this, Please help urgently:               function new_mail_from($old) {      return 'postmaster@bizcatalyst360.com';     }     function new_mail_from_name($old) {      return 'Postmaster - BIZCATALYST360°';     }          /** Notification Upon post Pubished */     function authorNotification( $new_status, $old_status, $post ) {         if ( $new_status == 'publish' && $old_status != 'publish' ) {             $author = get_userdata($post->post_author);             $message = "                 Hi ".$author->display_name.",                 New post, ".$post->post_title." has just been published at ".get_permalink(      $post->ID ).". ";             wp_mail($author->user_email, "$post->post_title", $message);         }     }     add_action('transition_post_status', 'authorNotification', 10, 3 );


title: Enable plugin installs without FTP with user from same group as Nginx/PHP-fpm

text: I just setup a VPS and I installed everything I needed and it runs well. Problem is that I want it to be able to update automatically and allow me to install plugins without ftp. This is my setup:   1. I created a new user and group named: "wordpress"   2. Nginx and PHP-FPM both uses "wordpress" as the user and group.   3. I added my own ssh account to the group "wordpress". Lets say my username is "user".   4. I changed the ownership of the files to the user "user" and the group "wordpress" including the right permissions (775 for folders and 664 for files, I will try 755/644 later).   5. Changed folder group (`chgrp -R`) to "wordpress". I also performed "chmod g+s" on the folder so new files belong to the "wordpress" group. With all of the above I still can't install new plugin (and probably themes or update), but if I change the files owner to "wordpress" all is fine. Is it not possible to have the "user" own the files so incase I upload my files with sftp I don't have to `chown`. **TL;DR**   Is it possible to have WordPress files owned by a user thats in the same group as the group that runs nginx/php-fpm and still be able to install plugins? edit:   More info:   nginx.conf at the top contains `user wordpress wordpress` and `pool.d/www.conf` contains 2 lines with `user = ilyesnl` `group = ilyesnl`. I also confirmed both processes being run by user `wordpress`.


title: Different image sizes for home and post pages

text: I'm wondering if it is possible to use different image sizes (medium, large) for the content on the homepage and single post pages. I have a narrow column on the homepage than on the single post pages and different image sizes would be nice. Thanks.


title: How to SQL query posts IDs by categories AND authors?

text: I am making a custom WP_Query and I need to come up with a SQL query that gets the posts IDs from X categories and Y authors. Then merge those IDs and put them in an array. I only need to figure out the SQL query. Everything else, I got it. I have looked everywhere for this but no one has been able to help me. Please help me out!!


title: Sharing two subdomains with a single WordPress without MultiSite

text: I want to have a single Wordpress installation for use of two domains e.g.   * http://blog.example.com for blog   * http://www.example.com for company pages I don't want to use multi-site setup, because   * I want search function to be able to search the whole site   * I don't want multiple copy of user profiles in different tables, I just want single sign in with single user account in DB   * Some plugins are not multi-site ready and I want to use them. So, is it possible to share two subdomains with a single WordPress without MultiSite setup?


title: Updating User Profile on Registration

text: I am having trouble getting WP to update a custom profile field when a user registers. Adding the fields works fine. Nothing is inserted into the depositAddress profile field when a user registers.               // add profile fields          function coinFields($profileFields) {          // Add new fields     $profileFields['depositAddress']     = 'Deposit Address';     $profileFields['accountBalance']     = 'Account Balance';     $profileFields['totalWinnings']      = 'Total Winnings';     $profileFields['totalLosses']        = 'Total Losses';          return $profileFields;     }          add_filter('user_contactmethods', 'coinFields');          // update deposit address          function coinDeposit() {     $current_user   = wp_get_current_user();     $ID = $current_user->ID;          // coin     $coin       =   new jsonRPCClient('http://user:pass@127.0.0.1:14022/');     $account    =   $coin->getaccountaddress($ID);          update_user_meta( $ID, 'depositAddress', $account);          }          add_action('user_register', 'coinDeposit');


title: multiple loops with pagination on the same page

text: I'm searching the web for this answer for three weeks now. Tried many things but nothing seems to work as how it should work. There must be a kind of trick what probably won't make sense to anybody what should get it working. Of course I'm talking about iterating through multiple types of your wordpress content with the option to navigate through the that of content. The possibilities for getting a list of your content are endless and I probably tried them all, except without using wordpress functions (PHP funcs only). About each and every variation I could think of: while loop with get_posts & wp_query, foreach loop with get_posts & wp_query, external php script with the loop what works with ajax, mini loops a great plugin but didn't fill my wishes... So what went wrong for which variation? I had lots of problems with the output itself. But the most common problem was the pagination. With the get_posts and wp_query while and foreach loop I was able to retrieve the right content with pagination. Only I couldn't get the pagination itself working like it should. When clicking a pagination link it doesn't retrieves a new list of content (the next page). This is the basic iteration loop I use now, for my social category:               <?php     //SET THE CURRENT PAGE HERE     $socials = array(         'paged' => $socialPaged,         'posts_per_page' => 5,         'category_name' => 'social'     );     $social = new WP_Query($socials);     if($social) {         while($social->have_posts()) {             $social->the_post();             //DO THINGS, LOTS OF THINGS         }         //HERE COMES THE PAGINATION NAVIGATION         wp_reset_postdata($social);     } else {         echo "Sorry, there are no posts to display";     }     ?>      This is what worked the best so far for defining the current page:               $socialPaged = isset($_GET['social']) ? (int) $_GET['social'] : 1;      This is what worked the best so far for my pagination navigation:               $socialPagArg = array(         'base' => get_pagenum_link(1).'%_%',         'format'  => '?social=%#%',         'current' => $socialPaged,         'total'   => $social->max_num_pages     );     echo paginate_links($socialPagArg);      Doing it this way made it possible to navigate successful in **one** loop. The URL will change to `/?social=#` if I paginate once and the content changes, but if I add an other loop and start paginating in it as well. Than the URL will show an other issue.               /?loop1=2?social=2 //paged once on loop1 and than once on social     /?loop1=2%3Fsocial%3D2?social=2 //paged once on loop1 and than twice on social      Also the content doesn't change any more. But I prefer to have pretty URL's, the next function did return URL's like this `/page/#` but this function wont change my content list.               next_posts_link('Older',$social->max_num_pages);      How it should work in the url:               /page/cat1/2 //paged once in loop cat1     /page/cat1/2/cat2/2 //started paging in cat2 as well     /page/cat1/3/cat2/2 //paged once more in loop cat1     /page/cat1/3/cat2/3 //paged once more in loop cat2      But this is also one big mess, is the use of sessions not better?


title: How can I add a custom field to an existing custom post type?

text: I have been asked to add some custom fields to an existing custom post type which was created using the Custom Post Type UI plugin. There is nothing in functions.php so how do I go about adding custom fields which will be permanently associated with the post type? Can I add the custom fields programmatically in functions.php? WP version is 3.2.1


title: Remove "Are You Sure" dialogue when leaving editor

text: Anyone know of a nice way to disable that pop-up dialogue when exiting the post-editor? It says "This page is asking you to confirm that you want to leave - data you have entered may not be saved." Nice feature, but annoying in certain blogs where I have to edit a ton of posts


title: How to make Tag Aliases

text: How would I build something like this with wordpress. Where multiple tags texts all go to the same page.   ![enter image description here](http://i.stack.imgur.com/MxVWS.png) If you click on the tag "scifi" it takes you to tag "science fiction". I am not looking for a way to merge them. I want the tag text to vary, but the end page to be the same. Any Ideas? A physical redirect shouldn't be needed. The tag text of X needs to be linked to Y when wordpress builds the link. **Example:** If I type "scifi" as a tag, and the link gets build as `<a href="/tag/science fiction">scifi</a>` and therefore the tag is an alias for "science fiction". Where would I hook in to do this?


title: wp_remote_post in uninstall.php

text: I was trying to automatically deactivate the license in my plugins on uninstall, and it is not working. The only thing that it does, is a remote post request, and given the fact that when not during uninstall it works, I guessed that uninstall.php cannot make remote requests. Is is true? How can it be overcome? **uninstall.php**               PPCP_general_functions::license_deactivate();      **PPCP_general_functions_class.php**               static function license_deactivate() {         $request = self::license_request( array(              'website' => site_url(),              'language' => get_bloginfo( 'language' ),              'license_deactivate' => true         ) );              if( is_wp_error( $request ) ) {             return $request;         }     }          static function license_request( $parameters ) {         $request = wp_remote_post( $ppcp_global_settings['activation_url'], array( 'body' => $parameters ) );         if( is_wp_error( $request ) ) {             return new WP_Error( 'ppcp_license_request_connection_error', __( 'Error: could not set up connection to remote server for license check', 'post-pay-counter-pro').': '.$request->get_error_message() );         } else if( $request['response']['code'] != 200 ) {             return new WP_Error( 'ppcp_license_request_reponse_error', __( 'Error: could not get information from remote server for license check', 'post-pay-counter-pro').': '.$request['response']['code'].' - '.$request['response']['message'] );         } else if( $request['headers']['ppc_activation_status'] == 'false' ) {             return new WP_Error( 'ppcp_license_request_activation_error', $request['headers']['ppc_activation_error'] );         }              return $request;     }      Thanks!


title: Advanced custom fields if else statement

text:
I'm using the plugin Advanced Custom Fields. The following example code is given on the acf website for if statements.               <?php          if(get_field('field_name'))     {         echo '
' . get_field('field_name') . '
';     }          ?>      I have tried adding an else statement like so:               <?php     if(get_field('main_title'))     {         echo '
' . get_field('main_title') . '
';     }     else      {         echo '
' . the_title() . '
' ;     }     ?>      The snippet works perfectly if I enter data into the `main_title` field in WP Admin, but if it's blank, the default page title is outside the `<h1>` tags. Thank you for your patience. I'm a bit of a PHP noob!


title: Localize script not working

text: I am testing ajax in wordpress, and it basically works but I do not want the url to be hardcoded, so I tried using `wp_localize_script` to get an object to use, but I get an error saying: "ReferenceError: WPURLS is not defined" when alerting the siteurl in `ajax_script.js`. functions.php               function my_scripts_method() {         wp_enqueue_script(             'ajax_script',             get_stylesheet_directory_uri() . '/js/ajax_script.js',             array( 'jquery' )         );     }     add_action( 'wp_enqueue_scripts', 'my_scripts_method' );          wp_localize_script('ajax_script', 'WPURLS', array( 'siteurl' => get_option('siteurl') ));      ajax_script.js               $(function () {              $('#vru-btn').click(function() {             // alert('code');             $.post( 'wp-content/themes/wpcleantheme/ajax/test.php', function(data) {                 $('#vru-div').html(data);                 });         });;              alert(WPURLS.siteurl);     });


title: How do I add Login fields and registration link to the header?

text: I want to have a login username and password field in the header, and a registration link beside it. I want the registration link to go away once the user is logged in and the login fields to be replace with a logout link. I have found these two snippets but they don't help me achieve what I want.


title: Add a featured image in my theme?

text: I'd like to add a Featured image to a default article or a Custom Type Post in my theme but I don't get the area of the highlight image, why? In the default theme the option is present but not in my theme, what have I missed?


title: Changing the color scheme based on the url visited

text: I am battling with the following:                   $themeId = "";         $pathname = get_site_url();              if($pathname == 'domain2.com'){             $themeId =  "gold";}         else{              $themeId = "blue";}              wp_register_style('theme-skin',THEMEURI . '/css/'.get_option($themeId).'-style.css', 3 , false, 'all');      So basically, I have a domain, **domain1.com**. It uses a blue theme for wordpress and hence the blue stylesheet which is: blue-style.css. Now, I have another domain name, domain2.com, that uses the exact same wordpress installation. So I want to get the current url in the address bar, and based on that, change the color scheme, **blue** for **domain1.com** and **gold** for **domain2.com**. But my code above does **not** work, it keeps using blue, no matter what url is visited - What am I doing wrong here? Thanks **UPDATE** : The original Default code **theme.css**                       if(get_option(THEMESLUG."_17_style")){                           wp_register_style('theme-skin',THEMEURI . '/css/'.get_option( THEMESLUG."_17_style").'-style.css', 3 , false, 'all'); //dark skin                            }      Where the colors are specified: **styling-options.php**               array(             "name"      => __("Theme Style",'rt_theme_admin'),             "desc"      => __("Please choose a style for your theme.",'rt_theme_admin'),             "id"        => THEMESLUG."_17_style",             "options"   =>  array(                             "blue"     => "Blue Style",                             "purple"   => "Purple Style",                              "orange"   => "Orange Style",                                                    "brown"   => "Brown Style",                                                                              "rose"   => "Rose Style",                                    "green"   => "Green Style",                                  "grey"   => "Grey Style",                                    "gold"   => "Gold Style",                                                            ),             "default"   => "blue",              "type"      => "select"),       * * * **SOLVED** Hi All. I did the following, and it now works:               if ( 'domain2.com' === $_SERVER['HTTP_HOST'] ) {          wp_register_style('theme-skin',THEMEURI . '/css/gold-style.css', 3 , false, 'all');          } else {          wp_register_style('theme-skin',THEMEURI . '/css/blue-style.css', 3 , false, 'all');           }


title: How to get a custom field value of a custom post?

text: What is the easiest way to get a custom field value from my custom post? I installed PODS plugin, created a new field and now I would like to get its value using PHP. Any advice greatly appreciated.


title: localization for Permalink

text: Originally, wordpress creates permalink like **/2013/07/** , **/archives/123**   here I want to localize with my native numeric numbers .   is it possible to do like that ?


title: NextGen stylesheets looking for localhost

text: I've been running a local version of a site on which NextGen gallery plugin is installed. It's working great. I uploaded to remote hosting and updated all "localhost" paths with the remote path in MySQL as part of my normal process. Unfortunately, the NextGen gallery plugin is still looking for localhost scripts:               <script type='text/javascript' src='http://localhost/~pathname/site-name/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/fancybox/nextgen_fancybox_init.js?ver=3.6'></script>      I've uninstalled the plugin, deleted the plugin files and then reinstalled but to no avail; it just keeps looking for local files. Any ideas? Many thanks in advance.


title: add_image_size adds size, but doesn't upload if source resolution is same as resize resolution

text: I'm trying to add a new image size of 300x300.. This works, but if the uploaded file is for example 300x300, it doesn't upload the resized image.. You'd say that isn't a problem because the original is the resolution I need, but I get the image later on with:               wp_get_attachment_image_src( $meta['background'][0], array(300,300) );      And if this image is not there, wordpress fetches another size, which of course is not what I want.. What should I do?


title: Prevent network activation of plugin

text: I have a plugin that currently doesn't support network activation. The best fix for this of course is to fix it :) which I plan to do. However I wonder if there is a temporary solution I can use to prevent network activation in the meantime, perhaps a workflow similar to:   1. Detect if the activation is network-wide (how??)   2. Display message that it's currently not supported, and I stink, I'm sorry   3. Interrupt the activation or deactivate Or, other suggestions accepted. Thanks. For clarification: Multisite activation is fine, just not network-wide activation.


title: Linking to page with all posts

text: I'm new to the Wordpress world. I've read the template hierarchy document and read online, but, I wanted to get feedback from here on what the best way to do this would be. What I'm trying to do is create a page that simply lists all of the posts that my site has. I am creating my own theme and as a result the home page (front- page.php) is highly tweaked. I do list recent posts, but, only their titles. On my home page I would like to add a link to "See all blog posts". I'm comfortable with the PHP code; I know how to display posts. I'm just not sure what the best way to get a page that lists them all aside from the homepage is. I'm sure this is very easy to accomplish, I'm just still working through the Wordpress structure so your advice is appreciated!


title: Get a variable field of all comments of current post

text: How to get **a variable comment field** of **all comments** of **current post**? I want to display all (for current post) comment user website url in to current post. Thanks for help.


title: Selectively Disabling PHP via .htaccess in Root Directory

text: I'm reading up on securing WordPress and one of the commonly suggested techniques is to use an .htaccess file to disallow PHP execution in `wp- content` and `wp-includes`. I then read about another hack that involved a backdoor file placed in the root directory. That got me thinking about how to extend the technique. Would it make sense to do something like this: In root directory .htaccess:               <Files *.php>         Order Deny,Allow         Deny from all     </Files>          <Files index.php>         Order Allow,Deny         Allow from all     </Files>      In wp-admin .htaccess:               <Files *.php>         Order Deny,Allow         Allow from all     </Files>      I'm pretty sure this will break XML-RPC support as well as post by email, but I don't plan on using either of those technologies anyway. I'm wondering if there are other consequences that I'm not seeing (I don't know 100% what all of the PHP files in the root directory are for). Is this even worth it?


title: Put captions underneath menu items

text: Im working on a design and i would like there to be small captions underneath my navigation links like in this image: Image How would i go about doing this in wordpress? Thanks


title: image_size_names_choose filter doesn't show

text: I have created a new image size using the add_image_size(), and I want to have it listed in the media library image size when I insert it. So I have the following code:               add_image_size( "grade-image", 320, 300, true );          function sgr_display_image_size_names_muploader( $sizes ) {              $new_sizes = array(             "0" => "grade-image",         );          /*         $added_sizes = get_intermediate_image_sizes();              // $added_sizes is an indexed array, therefore need to convert it         // to associative array, using $value for $key and $value         foreach( $added_sizes as $key => $value) {             $new_sizes[$value] = $value;         }     */           // This preserves the labels in $sizes, and merges the two arrays         $new_sizes = array_merge( $new_sizes, $sizes );              return $new_sizes;     }     add_filter('image_size_names_choose', 'sgr_display_image_size_names_muploader', 11, 1);      however, it does not show the grade-image size. I tried the commented block to show a list of all image sizes, and it does show some of the other image sizes, but not the grade-image one. I'm really puzzled.


title: Wordpress Flyout Menus

text: I have a bit of a complicated menu structure that I am trying to figure out the best way to do this. **I have a top nav** that has 4 SECTIONS. Each Section has upto 2 levels deep. Also, **I have a SUB Nav** that is based on what section you are in and displays as a drill down showing what page you are own. For example, say I click on a second level TOP NAV - I would then go to that SUBPAGE showing the SUB nav having that section open and selected. I hope I explained that correctly... Thanks. My Question is: What is the best way to do this. I've researched some plugins but I can't seem to find the right one. I don't have to use a plugin.


title: How to host and manage for clients

text: I want to manage Wordpress installations for some customers of mine. They need an a+ service but I am still struggling with setting up my hosting. What I want:   * Backups, if I make an mistake I want to have an backup to restore it.   * Easy scalable, if I decide to get more customers, I want to be able to upgrade the hosting   * Secure, one customer should not be able to acces anothers database.    * Fast, speed is important these days. What I am capable of: \- Installing and updating Wordpress \- Installing and updating Plugins \- Testing \- Wordpress Settings (setting up paths, permissions all that stuff) I've been looking at VPS (VPS.NET is getting some good reviews). Or should I buy an dedicated server? I prefer something like VPS, starting cheap but easy upgradable if I get more customers. Anyone has some advice? or how you guys do it?


title: Add parameters vimeo videos using wordpress embeds

text:
I am using a custom field to embed any supported video on Wordpress so for example the user enters a video address on the custom field box :               http://vimeo.com/72104173      and I implemented the following code on my theme :               <?php     $videourl = my_meta('video'); // get custom field value     if($videourl!=''){ // if custom field exist  ?>     <?php      $htmlcode = wp_oembed_get("{$videourl}"); //use oembed       echo "
{$htmlcode}
"; //output the video ?>     ...      the result/output is below :                     the problem is that I want to add extra parameters to the vimeo so I can hide the Title and Byline of the video by adding the following to the src :               ?title=0&byline=0&portrait=0      so the final result will be :                     I tried to user `str_replace` but the problem is that the parameters are added to the end of each video src and the surce is going to be different each time, really appreciate any help, thanks


title: have secret admin level user or build backdoor

text: I have created several wordpress sites for different clients and I want to have easy access to each site. I could always ftp into the files or edit the database, but i want it to be easier. I want it to be secret so a client doesn't accidently delete my user. Does anyone have any ideas how i could have a secret admin level user or a plugin that is a backdoor. Please believe me i'm not asking anyone to build this for me. I'm just asking for some ideas. like a brainstorming session. I have worked with lots of cms's but wordpress is still new. I thought there might be some veterans here that could point me in the right direction. OH I FORGOT THE MOST IMPORTANT PART. I need this to be a plugin!!! and obviously it needs to stay active even if the client upgrades the core. Any help/ideas would be great. Thanks. OK i see I'm getting a lot of heat from everybody thinking I am trying to accomplish an unethical task. I apologize and hope that no one deletes this. I guess I will try ask my question a different way. Lets be honest what can do i accomplish with this "secret user plugin" that i cannot accomplish with ftp and database access. I am the webmaster for each client. I setup the hosting. Half of them do not even have ftp log-in information. Nothing devious is happening I'm only trying to make my life easier.


title: Disallow authors to edit/delete their own or other published posts

text: I would like to have people write on my blog and i am ok with editing their own posts while on draft. However, once their posts are published, I wouldn't like them to be able to edit/delete any published posts, not even the owned that they have written. Is there a way to do that ?


title: update_user_meta on registration but only for default role type

text: So I am running the following to update user meta on regsitration:               function set_user_rcp_default_subscriber($user_id) {         update_user_meta( $user_id, 'wp_user_level', '0' );         update_user_meta( $user_id, 'rcp_subscription_level', '1' );         update_user_meta( $user_id, 'rcp_status', 'active' );         update_user_meta( $user_id, 'rcp_expiration', '2014-06-30' );     }          add_action("user_register", "set_user_rcp_default_subscriber", 10, 1);      However, I only want this to apply to users that are registered as the default type (subscriber in my case). Users that are registered with a different role type I dont want to update with these meta values. Any help very much appreciated. Many thanks.


title: Notice: Use of undefined constant SECURE_AUTH_COOKIE and LOGGED_IN_COOKIE in pluggable.php

text: Ok, so to preface this question, I think this error is caused by the plugin I am developing. I actually am trying to create a v2 of the plugin, and every time I try to overwrite the plugin files in prod with the new plugin, it causes this error. Surprisingly, it works fine in my dev environment. I just don't know what to look out for because it brings up pluggable.php file which is the core WP file. It also causes two errors regarding undefined index from my plugin, so I wonder if that could be that. (the index is undefined until you visit the plugin page and save the info)               Notice: Use of undefined constant SECURE_AUTH_COOKIE - assumed 'SECURE_AUTH_COOKIE' in .../wp-includes/pluggable.php on line 614          Notice: Use of undefined constant LOGGED_IN_COOKIE - assumed 'LOGGED_IN_COOKIE' in .../wp-includes/pluggable.php on line 101          Notice: Undefined index: startDate in .../wp-content/plugins/mypluginname/mypluginname.php on line 485          Notice: Undefined index: endDate in .../wp-content/plugins/mypluginname/mypluginname.php on line 486      Any ideas what I could look out for to try to correct this problem?


title: Right to left problems after uploading the site

text: I have been working on a WordPress site on my local host. Every things was working fine for my right to left language (Arabic). but after I have uploaded the site to the web-hosting server I noticed ONLY right to left problems. The layout works fine when I switch to Arabic but some issues happen like:   1. The list numbers goes to the left of the text instead of going to the right.   2. Some boxes do not order from right to left.   3. The contact forms floats to the left instead of the right. Is the problem cause comes from the hosting server (Linux server). And what is the solution for such problem. Live examples: The numbers problem and Contact form problem


title: How to enable user registration for specific country and disable registration from all other countries?

text: is their any method to enable user registration for specific country like only people from USA can register and all other users coming from other countries redirect to to a specific page showing them message that only people from USA can register to this site ?


title: Updated WordPress, now Navigation is Messed Up

text: I recently updated the WP of a friend's site that I'm working on. Now his navigation bar is messed up and I'm new to WP so I'm not sure where to go to fix it. Here's the site: http://www.millermusiclessons.com/ Here's what the nav should look like: http://www.millermusicllc.com/ Thanks


title: How to Catch Last Widget box From Same Widget Area?

text: is there any Way to Catch Last widget box or div from same widget area?? i mean i have 4 widgets in footer widget area but due to design issue my 3rd widget box style+width is different.so i want to add extra class to 3rd box container using php.is there any way to do that? please reply. Thanks in advance. :)


title: Can I use a form in a dashboard widget?

text: I'm building a plugin and would like to add a dashboard widget with a custom form. In this form, users should be able to edit a list of strings (add, edit and remove items). Is there a WordPress API to do something like that? I already know how to add a dashboard widget, but I don't know how to make a form in a dashboard widget / how to process the data. The only thing I can think of is to redirect the user to my options page - there must be a neater way. Is there any?


title: Force pdf download not working when include blog-header.php

text: I have this code which works in a file called downloads/download.php:               <?php     header('Content-type: application/octet-stream');     header('Content-Disposition: attachment; filename="file.pdf"');     readfile('file.pdf');     ?>      It correctly prompts to download file.pdf. I need to track downloads so I want to make use of various WP functions. To bring the page inside WP I added blog-header.php like so:               <?php     define('WP_USE_THEMES', false);     require('../wp-blog-header.php');     header('Content-type: application/octet-stream');     header('Content-Disposition: attachment; filename="file.pdf"');     readfile('file.pdf');     ?>      This returns a 404. Does anyone know why bringing the page inside WP would cause this?


title: Gravity forms multiple posts generated by one form

text:
**THE GOAL** _Example 1: Job Applicant + Mailing List_ Wondering if this could be possible, I have a simple form of 30 fields of Curricullum Vitae of some Job Applicant (custom post type: job_applicant) and I would like to use let's say 5 fields from this form to automaticaly create a new user for custom post type ("mailing_list") _Example 2: Event + Club listings_ Another example is to generate the form using custom post type "EVENT" with club location fields and then after submission in the background create a new custom post type "club_listings" info. Is it hard to create in the background e new custom post type CLUB entry with some 3-5 fields one per line? **Purpose**   1. Time saving    2. Better categorizing  **Conclusion** Can somebody help me by providing any example here ? All I want is to use one form to generate 2 different custom post type posts. I am able to create the one bigger form, I would like to know if there's some simple hack to generate also another one different little CPT form with 3-5 specific fields. I am trying to understand this issue with the help of documentation on GF pages: http://www.gravityhelp.com/documentation/page/Gform_after_submission Very amateur example below:               01  <?php     02  add_action("gform_after_submission", "set_post_content", 10, 2);     03  function set_post_content($entry, $form){     04        05      //creating NEW custom post type entry     06      $post =      07        08      //creating custom post type content     09      $post->post_content = "Club Info: "
 " . $entry[1] . "
     10   "
 " . $entry[2] . "
     11   "
 " . $entry[3] . "
     12   "
 " . $entry[4] . "
     13   "
 " . $entry[5] . "
     14        15      //updating post     16      wp_update_post($post);     17  }     18  ?>


title: Adding tables to the WordPress Editor

text: I tried this fix: http://www.paulund.co.uk/display-full-tinymce-editor-in- wordpress But I see no change in my editor. So how do I enable tables in the wordpress editor. MY function is:               function tinyMCETables($args)     {      $args['theme_advanced_blockformats'] = 'p,address,pre,code,h1,h2,h3,h4,h5,h6';      $args['wordpress_adv_hidden'] = false;      return $args;     }     add_filter('tiny_mce_before_init', 'tinyMCETables' );      And yes, I know about the tincMCE Advanced plugin but I want to build the feature into my theme. Is there another way to enable tables?


title: How to remove a class

text: Is it possible to remove classes from a plugin and add theme into to theme? I need to modify Woocommerce `WP_Checkout` class but I want to move it to my theme folder so if woocommerce will be updated my changes will not be effected. Is theme some way to make an remove and add action/hook? Or maybe unhook page and add my custom page with the class? Thanks in advance Patrick


title: What are some good resources for teaching end-users how to use WordPress?

text: As a web designer and developer, I'd love to simply point out my clients to some YouTube videos or articles that explain from the ground up what WordPress is without blowing their mind. Some of my clients are fairly well versed in internet, email and Word, but that's about their remit. Does anyone know of some good tutorials, resources, articles or videos that are good to show my clients?


title: Adding a theme option to the admin that lets me turn on/off a javascript file

text: I want to add a theme option to the Wordpress admin so that I don't need to commit code every time I need to "activate" (or deactivate by commenting out) an Optimizely javascript snippet I only want run occasionally. I googled this question, but most of the posts I saw were related to to running CSS or JS on the admin page, and weren't related to adding a theme option. I'm not sure how to get started. Do I have to register a setting (http://codex.wordpress.org/Settings_API#Adding_Setting_Fields)? If so, in which file do I add add_settings_field function? Functions.php?


title: Transients vs CRON +Custom Fields: Caching Data Per Post

text: Wanted some opinions on a solution I'm trying to come up with: I have a fan/enthusiast plugin I'm working on for fans of TV shows. One of the custom post types attached to the plugin is a release type which stores data on dvd releases of a show. Some of the meta data that I weant stored is info from Amazon using their Product Advertising API. I wanted to cache some of the pricing data available there, such as the current price of the dvd. I was thinking of using transients but from what I can tell their nothing more than a layer on WP options; their too global. I'd have to create numerous transients with a naming scheme that would point to a certain post. The other option would be to use custom fields but use the CRON API to update it, I'd either have one Cron job update all the custom fields hourly or create one cron job per post that did so. My question is which solution would be more practical performance and convenience wise?


title: Slow speed and high CPU usage for my code. How to improve it?

text: this is my code. It gets the variables from the url. It is very slow and sometimes don't even complete. How can I improve it? Note: Most of the times some of the variables will not have any value. I thought that if I check this and remove it's array from the query it will improve it somehow.               $value1 = $_GET['extra1'];     $value2 = $_GET['extra2'];     $value3 = $_GET['extra3'];     $value4 = $_GET['extra4'];     $value5 = $_GET['extra5'];     $value6 = $_GET['extra6'];     $value7 = $_GET['extra7'];     $value8 = $_GET['extra8'];     $value9 = $_GET['extra9'];     $value10 = $_GET['extra10'];          $args = array(         'meta_query' => array(             array(                 'key' => extra1,                 'value' => $value1,                 'compare' => '='             ),             array(                 'key' => extra2,                 'value' => $value2,                 'compare' => '='             ),             array(                 'key' => extra3,                 'value' => $value3,                 'compare' => '='             ),             array(                 'key' => extra4,                 'value' => $value4,                 'compare' => '='             ),             array(                 'key' => extra5,                 'value' => $value5,                 'compare' => '='             ),             array(                 'key' => extra6,                 'value' => $value6,                 'compare' => '='             ),             array(                 'key' => extra7,                 'value' => $value7,                 'compare' => '='             ),             array(                 'key' => extra8,                 'value' => $value8,                 'compare' => '='             ),             array(                 'key' => extra9,                 'value' => $value9,                 'compare' => '='             ),             array(                 'key' => extra10,                 'value' => $value10,                 'compare' => '='             )         )      );     $query = new WP_Query( $args );          if ( $query->have_posts() ) :          while ( $query->have_posts() ) : $query->the_post();             the_title();         endwhile;     endif;


title: Cookie free site

text: I have followed directions to make my wordpress cookie free. I've made my subdomain, pointed to my php folder and now I'm stuck. What am I suppose to do with this:               bloginfo ('template _directory')      There is no real help or a tutorial to show this anywhere. Like, where am I suppose to even put this code, and what am I suppose to replace the wording with. Along with any additional strings to make my site cookie free. Unless there is some kind of plugin that I can use for WP to skip all this. I am not web savvy at all, and know nothing about coding. Some kind of help here would be great.


title: Rolling your own WordPress Themes

text: I am looking to build my own WordPress theme to house my artwork. Can someone point me to the best tutorials for doing so and also give me some pointers on the best approach to building an image gallary? For example Should I build a custom gallery? Is there a suitable plugin that will simplify things? For background I have a reasonably high level of experience in PHP, HTML5 and CSS3 so have no issues with rolling my own, however I have never built a WordPress theme before.


title: Grouping categories by genre

text: My wordpress video blog have several categories. Lets say the category can belong to several genres e.g actions,horror,mystery and another category belong to actions,horror,romance How do I group categories into genres? Cause in the most basic structure, we group posts into category. Now i want group categories into genres Then be able to display the category in the genre by a url such as http://www.domain.com/genre/actions and it will list all categories in it. Here's an example site that has this feature http://www.anime44.com/anime- genre/Fantasy


title: Share user table from WP with Drupal

text: I'm developing a sister website to a well-established private site that is already built in Wordpress. I can't use Wordpress to create what I need and I am therefore using Drupal. The owners of the Wordpress site do not want their users to have to go through a separate login process to get into the Drupal site and would like their users to be able to click a link to the Drupal site and automatically be logged into the Drupal site, based on their Wordpress credentials. I know this must be possible, but where should I start, what do I need to know/learn in order to do this?


title: using images in next/previous_post_link

text:
In my blog's pagination section, I've used `<?php previous_post_link(); ?>` and `<?php next_post_link(); ?>` to generate the newer and older posts links. Within that action, though, I've included an empty span that I insert an image in with CSS. While no errors have been generated by the code, the images don't show up. I'm wondering why this is, and if there is an easier/better what to achieve the desired effect?

<?php previous_post_link(' older posts'); ?>

<?php next_post_link(' newer posts'); ?>

          #blog .pagination {         background: url('img/dots_large.png') no-repeat;         height: 169px;         width: 635px;         float: right;         margin-right: 14px;         padding-bottom: 20px;         text-align:center;     }          #blog .pagination ul {          display:inline;         margin: 0 auto;     }          #blog .pagination ul li {         display: inline;         margin: 0 auto;         width: 290px;     }          #blog .pagination .left-arrow {         padding-right: 20px;     }          #blog .pagination .right-arrow {         padding-left: 20px;     }               #blog .pagination span.left-arrow {         background: url('arrow_left.png') no-repeat;     }          #blog .pagination span.right-arrow {         background: url('arrow_right.png') no-repeat;     }      live site


title: Custom blog settings

text: What is the best way to add new custom blog settings to the Wordpress general settings (or some other settings page for that matter), such that these settings are available to the theme to use? For example I would like simple settings like the Twitter URL and Facebook Page URL to be configurable, rather than hardcoded in the theme. It would be nice if I could then access them via the `bloginfo()` function, but any other function will do just the same.


title: Show 'add comment' link for status updates in Twenty Thirteen

text: I have WP 3.6 running on my server. After playing around with it, I noticed that it's not very intuitive to add comments to a status update; ![enter image description here](http://i.stack.imgur.com/So5Iz.png) Guess how? After some thought, I have decided I would like for it to look more like this: ![enter image description here](http://i.stack.imgur.com/2gJmk.png) Or some variation thereof The `click to show/leave comments` text is simply appended on the end of the existing `Status on...` link. I've dug around in the PHP files, but can't seem to figure out how to make this simple change. Is there a file somewhere that dictates what strings to display? Any ideas?


title: Minimal wordpress load for only `get_option` to work (because ajax...)

text: In a plugin I use ajax to `get_option()` which takes much longer than it has to because entire wp gets loaded. How do I set things up so that it (my ajax) loads only what is needed? (`get_option()`)


title: Only Display a Featured Image on First Post Page

text: In WordPress a single post can be divided into multiple pages using page- links. Currently, I use featured images on my post pages and call them by size, as shown below. If an image is larger than 500 pixels it is displayed as the top- post thumbnail and if it is smaller than that it displays as the standard thumbnail.               <?php $image_data = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ),  'full' );     if ( $image_data[1] >= 500 ) { the_post_thumbnail('top-post');     } ?>          <?php $image_data = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ),  'full' );     if ( $image_data[1] < 500 ) { the_post_thumbnail();     } ?>      The problem is when I include this in my single-post.php it shows up on every page of a post, even when that post is divided by page-links. How do I make these images only show on the first page?


title: Page Navigation for list of post

text:
After getting help from ghost toast... I am almost seeing the light of day with this issue. Using this code I have been able to have a query of post show. However I am unable to figure out how to code it to work with the navigation. Thanks Ghost!               <?php while (have_posts()) : the_post(); ?>              <div class="post" id="post-<?php the_ID(); ?>">
                 <?php the_time('j') ?>                 <?php the_time('M') ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

                 <?php the_excerpt(); ?>

Posted by <?php the_author() ?>.<?php edit_post_link('Edit', ' |          ', ''); ?>

               <?php endwhile; endif; ?>                <?php     global $wp_query;          $query = new WP_Query( 'cat=1' );           $big = 999999999; // need an unlikely integer           echo paginate_links( array(     'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),     'format' => '?paged=%#%',     'current' => max( 1, get_query_var('paged') ),     'total' => $wp_query->max_num_pages     ) );     ?>


title: How do I programmatically add items to a custom post type?

text: I have a custom post type to which I'd like to programmatically import data. I have followed these instructions and these, and I can easily do it for WP typical pages and posts. However, my custom post type has fields for longitude and latitude, for example. How do I figure how how those names (array keys) should be referred to in the post array?               $defaults = array(                 'comment_status' => 'closed',                 'ping_status' => 'closed',                 'post_author' => $author_id,                 'post_name' => $slug,                 'post_title' => $title,                 'post_status' => 'publish',                 'post_type' => 'ait-dir-item',            longitude => $my_long,   // <- what's the key here?            latitude  => $my_lat     // <- what's the key here?                 );      Note I did not create the custom post type. There are about 40 extra fields I have to add data to.