Posting Code

| August 19, 2013 | 0 Comments

When it comes to posting code samples on a website there are many reasons not to use blockquote tags.  The first being that it could accidentally be processed as source code.  Beyond that it’s just not easy to read.

The interesting aspect of this post is the difference between code wrapped in <code> tags vs code wrapped in <pre> and <code> tags.

Testing BlockQuote – Don’t do this

function my_post_queries( $query ) {
// not an admin page and is the main query
if (!is_admin() && $query->is_main_query()){
if(is_home()){
$query->set(‘post__not_in’, get_option( ‘sticky_posts’ ) );
}
}
}
add_action( ‘pre_get_posts’, ‘my_post_queries’ );

Testing <code> tags

function my_post_queries( $query ) {
// not an admin page and is the main query
if (!is_admin() && $query->is_main_query()){
if(is_home()){
$query->set('post__not_in', get_option( 'sticky_posts' ) );
}
}
}
add_action( 'pre_get_posts', 'my_post_queries' );

Testing <pre><code> tags

function my_post_queries( $query ) {
// not an admin page and is the main query
if (!is_admin() && $query->is_main_query()){
if(is_home()){
$query->set('post__not_in', get_option( 'sticky_posts' ) );**********
}
}
}
add_action( 'pre_get_posts', 'my_post_queries' );
Filed Under: Default

Comments are closed.