Previous / Next links for Custom Post Types
I was able to get the previous/next links to work using the following code for custom taxonomy. The link to the full thread is below. <div class="previous-post-link"> <?php previous_post_link(‘%link’, ‘<< Previous Post’, $in_same_term = true, $excluded_terms = ”, $taxonomy = ‘the-custom-taxonomy-associated-with-your-custom-post-type’); ?> </div> <div class="next-post-link"> <?php next_post_link(‘%link’, ‘Next Post >>’, $in_same_term = true, $excluded_terms = […]
Integrating Google Adwords tracking with Contact Form 7
In order to integrate the javascript for Google Adwords tracking with Contact Form 7 – I’ve pieced together some advice from the thread in this link: http://wordpress.org/support/topic/plugin-contact-form-7-contact-form7-google-adwords-conversion-code. This is for multiple forms. You only need to add one function if you have one form. In your Contact 7 “Additional Settings” at the bottom of the […]
Giving WordPress Its Own Directory
Many people want WordPress to power their site’s root (e.g. http://example.com) but they don’t want all of the WordPress files cluttering up their root directory. WordPress allows you to install it into a subdirectory, but have your blog exist in the site root. http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
Override default media size and add additional sizes to media gallery
To update default wordpress image sizes add this code to functions.php: add_theme_support(‘post-thumbnails’); update_option(‘thumbnail_size_w’, 150); update_option(‘thumbnail_size_h’, 150); update_option(‘large_size_w’, 500); http://wordpress.org/support/topic/how-set-default-image-size To insert a custom image size inside a post or page from the media gallery insert the following filter into the functions.php file: add_filter( ‘image_size_names_choose’, ‘custom_image_sizes_choose’ ); function custom_image_sizes_choose( $sizes ) { $custom_sizes = array( […]
How to display the page title/content in the Posts page?
Source: http://wordpress.stackexchange.com/questions/7685/how-to-display-the-page-title-content-in-the-posts-page In order to display the actual page title/content of the “posts page” use the following code: Page Title Use get_the_title(): echo apply_filters( ‘the_title’, get_the_title( get_option( ‘page_for_posts’ ) ) ); Page Content Use get_post_field(): echo apply_filters( ‘the_content’, get_post_field( ‘post_content’, get_option( ‘page_for_posts’ ) ) ); In both cases, wrap the output in an apply_filters() call, […]
Shortcode in WordPress template
To echo out shortcode within a wordpress template file. Wrap within php tags. echo do_shortcode(“[insert shortcode here]”); http://enfuzed.com/shortcode-in-a-wordpress-template/
Variable image aspect ratio crop in WordPress
To crop an image with a variable width/height, use ‘auto’ instead of pixels. Here is the code to add to functions.php if ( function_exists( ‘add_image_size’ ) ) add_theme_support( ‘post-thumbnails’ ); if ( function_exists( ‘add_image_size’ ) ) { add_image_size( ‘home-thumb’, 100, 100, true ); add_image_size( ‘featured’, 268, ‘auto’, true ); }
How to include prev/next navigation only when excerpts extend beyond one page
If you don’t have enough blog posts to warrant previous/next page navigation, here is some simple code to include in index.php. This will prevent a broken link to a prev/next page that doesn’t yet exist. <?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ($total_pages > 1){ include (TEMPLATEPATH . ‘/inc/nav.php’ ); } ?>
Contact Form 7 Integration with Email Before Download plugin
The plugins Email Before Download and WordPress Download Monitor can be used in conjunction with Contact Form 7 to send a file upon form submission. http://wordpress.org/extend/plugins/email-before-download/ In order to have a pdf automatically sent after a form submission, you will need to upload the pdf via the “Downloads” link on the left. You need to […]