Only Display a Featured Image on First Post Page

Use the global $page, which holds the current page number. // Somewhere near the top if ( $GLOBALS[‘page’] === 1 && $image_data = get_post_thumbnail_id() ) { if ( $image_data = wp_get_attachment_image_src( $image_data, ‘full’ ) ) { if ( $image_data[1] >= 500 ) the_post_thumbnail( ‘top-post’ ); } } // Further down. $image_data still exists, no need … Read more

How to remove only pages from Admin Bar?

The menu bar is all controlled by an object instantiated as $wp_admin_bar. I think this is what you want: function remove_page_menu_wpse_104826() { global $wp_admin_bar; // var_dump($wp_admin_bar); // debug; uncomment and look at the bottom of the page for the big mess $wp_admin_bar->remove_menu(‘new-page’); } add_action(‘wp_before_admin_bar_render’, ‘remove_page_menu_wpse_104826’, 1);

loading a javascript on a WP PAGE

You’ll find a file called functions.php in your theme folder. Open it and add the following snippet: function wpse_109027_enqueue_js() { wp_enqueue_script( ‘custom-script’, get_stylesheet_directory_uri() . “https://wordpress.stackexchange.com/js/script.js”, array( ‘jquery’ ) ); } add_action( ‘wp_enqueue_scripts’, ‘wpse_109027_enqueue_js’ ); wp_enqueue_script is used to add javascript files. The array(‘jquery’) part means that WordPress should load jQuery before loading your javascript file. … Read more

Remove comment section from new page

If you want to be rid of comments on your site, one option is to remove the code from your theme files. You would need to search single.php, home.php, page.php, etc. within wp-content/themes/*your-active-theme* and find: <? php comments_template(); ?> Remove that and the comments section should disappear. NOTE: this change will be undone if you … Read more

Featured Image If Else Condition

Change your code to: <div id=’xpro_shell_text’ > <?php if ( has_post_thumbnail( $post->ID ) ) : $imageInfo = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘single-post-thumbnail’ ); $imageUrl = $imageInfo[0]; else: $imageUrl = get_template_directory() . ‘PATH TO YOUR DEFAULT IMAGE’; endif; ?> <div id=”xpro_shell_content_header” class=”content_about_us_header white” style=”background:url(‘<?php echo $imageUrl; ?>’) no-repeat;”> <div id=’xpro_shell_content_header_blurb’> <h1 class=”greenHeader cufon_reg”> <?php the_title(); ?> … Read more

Change a Page’s Header Image

The body tag has quite a few classes eg “home page page-id-### page-template page-template-template-name” you could make use of to customize the header with css. Just specify a different target: .home .header-wrapper { background-image: url(img/some-other-image.png); }