Black and White Thumbnail in WordPress Gallery

I think the best way to do this would be to add a filter to when the content is pulled into the post/page: <?php add_filter( ‘the_content’, ‘add_bw_thumbnails’ ) ?> Or to when an image is inserted into the editor: add_filter( ‘post_thumbnail_html’, ‘add_bw_thumbnails’, 10 ); add_filter( ‘image_send_to_editor’, ‘add_bw_thumbnails’, 10 ); You then just have to write … Read more

Customize category URL

I figured this out by reading this article. It was very simple, all I had to do was: Change the $talks_cat_args[rewrite][slug] from ‘talks’ to ‘talks/category’ (which I had tried before) but missed… Make sure register_taxonomy is before register_post_type. Read the article, but it’s basically because of “how WP_Rewrite works as the process of deciphering permalinks … Read more

Display pages from specific page template

Use get_post_field(‘post_content’, $product_page->ID ) to get the content outside loop. <?php $product_pages_args = array( ‘meta_key’ => ‘_wp_page_template’, ‘meta_value’ => ‘page_library_html.php’ ); $product_pages = get_pages( $product_pages_args ); ?> <?php foreach ( $product_pages as $product_page ) { echo ‘<div id=”posts” class=”flex_100″>’; echo ‘<div id=”library_title”><a href=”‘ . get_permalink( $product_page->ID ) . ‘”>’ . $product_page->post_title . ‘</a></div>’; echo ‘<div … Read more

Show author name not the author ID

<?php $product_pages_args = array( ‘meta_key’ => ‘_wp_page_template’, ‘meta_value’ => ‘page_library_html_content.php’, ‘hierarchical’ => ‘0’ ); $product_pages = get_pages( $product_pages_args ); ?> <?php foreach ( $product_pages as $product_page ) { $author_id = get_post_field(‘post_author’, $product_page->ID ); $author_details = get_user_by( ‘id’, $author_id ); $author_name = $author_details->first_name . ‘ ‘ . $author_details->last_name; echo ‘<div id=”posts” class=”flex_100″>’; echo ‘<div id=”library_title”><a href=”‘ … Read more

do_action in header, add action later?

You must register callbacks before they are called (add_action() and add_filter() are registration functions, they remember what to do when). Try the following in your functions.php or in your plugin: add_action( ‘topofthetop’, ‘load_FB_JS_SDK’ ); function load_FB_JS_SDK() { if ( is_singular() && have_comments() ) someclass::FB_JS_SDK(); }

Different image and background color depending on page type

I’ve used WordPress Conditional Tags to add a unique class or id to the containing div of the different page types. This could work well to change the background image/color for different types. Also, WordPress automatically adds a body class to the <body> tag for each page, so that could possibly be hooked into for … Read more