How to handle thumbnails

Since WordPress 2.9, you can add thumbnail support to your theme by adding this to the theme’s functions.php file: if ( function_exists( ‘add_theme_support’ ) ) { add_theme_support( ‘post-thumbnails’ ); } When this is done, you’ll be able to add a feature image to your post on Posts, Pages or Custom Post Types. You’ll see the … Read more

Returning Variables back into a template

There’s filters for that. Example: add_filter( ‘template_filter’, ‘wpse_102706_filter_callback’, 10, 2 ); function wpse_102706_filter_callback( $defaults, $case ) { $args = wp_parse_args( array( ‘some_key’ => ‘some_modified_value’ ), $defaults ); return $args } Then in your template just add in the defaults: apply_filters( ‘template_filter’, array( ‘some_key’ => ‘default_val’ ), ‘single’ ); More info in Codex about the Plugins … Read more

Settings API enable default settings on theme install?

You can pass defaults to get_option. The second parameter is a fallback. $default (mixed) (optional) The default value to return if no value is returned (ie. the option is not in the database). Default: false So, for example, instead of: $options = get_option(‘plugin_options’); You’d want: $options = get_option(‘plugin_options’,array(‘display_sidebar’ => true)); Or you can insert your … Read more

how to pull wordpress post comments to a external page

add to your loop and replace it with the the_permalink() function something like this: <?php // Include WordPress define(‘WP_USE_THEMES’, false); require(‘./blog/wp-load.php’); ?> <div> <p style=”font-size:18px;color:white;font-wieght:700;”>Recently Asked Questions</p> <?php query_posts(‘showposts=3’); ?> <?php while (have_posts()): the_post(); ?> <div id=”faq”> <a href=”https://wordpress.stackexchange.com/questions/7919/<?php the_permalink() ?>”><?php the_title() ?></a><br /> <?php the_time(‘F jS, Y’) ?> <?php the_excerpt(); ?> <?php comments_popup_link(); ?> … Read more