Support » Fixing WordPress » Inserting an image to the homepage

  • Hello. Is there a way (or plugin) to insert an image onto my homepage. If I add an image to a post, I have to click the post to see the image.

    I want to add an image to the homepage to fill the gap between the bottom of my posts, the sidebar and footer widgets. If I try to add an image using the ‘add post’ function on the dashboard, the image doesn’t appear on the homepage.

    Can anybody suggest a solution to the above problem?

    Many thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • esmi

    (@esmi)

    Forum Moderator

    Your theme may be using <?php the_excerpt();?> instead of <?php the_content();?> in its template files. Try editing your theme’s index.php template file and replacing <?php the_excerpt();?> with <?php the_content();?>

    Thanks for the advice esmi… However, I cannot see

    <?php the_excerpt();?>

    anywhere in the code I have pasted the below. Might it be written in some other way?

    <?php
    	// load the theme options
    	$options = get_option( 'mx_theme_settings' );
    ?>
    <?php get_header(' '); ?>
    
    <div id="post-content">
    
    <?php if (have_posts()) : ?>
    <?php get_template_part( 'post' , 'entry') ?>
    <?php endif; ?>   
    
    <?php if (function_exists("pagination")) { pagination($additional_loop->max_num_pages); } ?>
    </div>
    <!-- END post-content -->
    
    <?php get_sidebar(); ?>
    <div class="clear"></div>
    <?php get_footer(' '); ?>
    esmi

    (@esmi)

    Forum Moderator

    Try looking in post-entry.php.

    Thanks esm, but when I change the following code from

    `<div class=”post-entry-content”>
    <h2><a href=”<?php the_permalink(‘ ‘) ?>” title=”<?php the_title(); ?>”><?php the_title(); ?></a></h2>
    <?php the_news_excerpt(‘500000′,”,”,’plain’,’no’); ?>
    </div><!– END post-entry-content –>`

    to

    <?php the_news_content(); ?>

    I get the following error message

    Fatal error: Call to undefined function the_news_content() in /home/bennoh/public_html/wp-content/themes/minimal-xpert/post-entry.php on line 13

    Any advice?

    This is the code from my functions.php

    <?php
    // theme admin
    include('functions/theme-admin.php');
    include('functions/better-excerpts.php');
    include('functions/better-comments.php');
    include('functions/slides-meta.php');
    
    // get scripts
    add_action('wp_enqueue_scripts','my_theme_scripts_function');
    
    function my_theme_scripts_function() {
    
    	wp_deregister_script('jquery');
    	wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"), false, '1.4.2');
    	wp_enqueue_script('jquery');
    
    	wp_enqueue_script('sliding effect', get_stylesheet_directory_uri() . '/js/sliding_effect.js');
    	wp_enqueue_script('superfish', get_stylesheet_directory_uri() . '/js/superfish.js');
    	wp_enqueue_script('supersubs', get_stylesheet_directory_uri() . '/js/supersubs.js');
    
    	if(is_front_page()) :
    	wp_enqueue_script('nivoSlider', get_stylesheet_directory_uri() . '/js/jquery.nivo.slider.pack.js');
    	endif;
    }
    
    //Add Pagination Support
    include('functions/pagination.php');
    
    // Limit Post Word Count
    function new_excerpt_length($length) {
    	return 50;
    }
    add_filter('excerpt_length', 'new_excerpt_length');
    
    //Replace Excerpt Link
    function new_excerpt_more($more) {
           global $post;
    	return '...';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    
    //Activate post-image functionality (WP 2.9+)
    if ( function_exists( 'add_theme_support' ) )
    add_theme_support( 'post-thumbnails' );
    
    // featured image sizes
    if ( function_exists( 'add_image_size' ) ) {
    add_image_size( 'full-size',  9999, 9999, false );
    add_image_size( 'post-image',  150, 150, true );
    add_image_size( 'related-posts',  50, 50, true );
    add_image_size( 'slider',  960, 360, true );
    }
    
    // Enable Custom Background
    add_custom_background();
    
    // register navigation menus
    register_nav_menus(
    	array(
    	'main nav'=>__('Main Nav'),
    	)
    );
    /// add home link to menu
    function home_page_menu_args( $args ) {
    $args['show_home'] = true;
    return $args;
    }
    add_filter( 'wp_page_menu_args', 'home_page_menu_args' );
    
    // menu fallback
    function default_menu() {
    	require_once (TEMPLATEPATH . '/includes/default-menu.php');
    }
    
    add_action( 'init', 'create_post_types' );
    function create_post_types() {
    // Define Post Type For Slider
      register_post_type( 'slides',
        array(
          'labels' => array(
    		'name' => _x( 'Slides', 'post type general name' ), // Tip: _x('') is used for localization
    		'singular_name' => _x( 'Slide', 'post type singular name' ),
    		'add_new' => _x( 'Add New', 'Slide' ),
    		'add_new_item' => __( 'Add New Slide' ),
    		'edit_item' => __( 'Edit Slide' ),
    		'new_item' => __( 'New Slide' ),
    		'view_item' => __( 'View Slide' ),
    		'search_items' => __( 'Search Slides' ),
    		'not_found' =>  __( 'No Slides found' ),
    		'not_found_in_trash' => __( 'No Slides found in Trash' ),
    		'parent_item_colon' => ''
          ),
          'public' => true,
    	  'exclude_from_search' => true,
    	  'supports' => array('title','thumbnail'),
    	  'menu_icon' => get_stylesheet_directory_uri() . '/images/admin/slides.png',
        )
      );
    }
    
    //Register Sidebars
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Sidebar',
    'description' => 'Widgets in this area will be shown in the sidebar.',
    'before_widget' => '<div class="sidebar-box clearfix">',
    'after_widget' => '</div>',
    'before_title' => '<h4>',
    'after_title' => '</h4>',
    ));
    register_sidebar(array(
    'name' => 'First Footer Area',
    'description' => 'Widgets in this area will be shown in the footer - left side.',
    'before_widget' => '<div class="footer-box">',
    'after_widget' => '</div>',
    'before_title' => '<h4>',
    'after_title' => '</h4>',
    ));
    register_sidebar(array(
    'name' => 'Second Footer Area',
    'description' => 'Widgets in this area will be shown in the footer - middle left.',
    'before_widget' => '<div class="footer-box">',
    'after_widget' => '</div>',
    'before_title' => '<h4>',
    'after_title' => '</h4>',
    ));
    register_sidebar(array(
    'name' => 'Third Footer Area',
    'description' => 'Widgets in this area will be shown in the footer - middle right.',
    'before_widget' => '<div class="footer-box">',
    'after_widget' => '</div>',
    'before_title' => '<h4>',
    'after_title' => '</h4>',
    ));
    register_sidebar(array(
    'name' => 'Fourth Footer Area',
    'description' => 'Widgets in this area will be shown in the footer - right side.',
    'before_widget' => '<div class="footer-box">',
    'after_widget' => '</div>',
    'before_title' => '<h4>',
    'after_title' => '</h4>',
    ));
    
    // functions run on activation --> important flush to clear rewrites
    if ( is_admin() && isset($_GET['activated'] ) && $pagenow == 'themes.php' ) {
    	$wp_rewrite->flush_rules();
    }
    ?>

    And this is my code from post-entry.php. I have changed both references in post-entry.php so that ‘excerpt’ now says ‘content’. Is this correct?

    <?php while (have_posts()) : the_post(); ?>      
    
        <div class="post-entry clearfix">
            <?php if ( has_post_thumbnail() ) {  ?>
    
            <div class="post-entry-featured-image">
    			<a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>" class="opacity"><?php the_post_thumbnail('post-image'); ?></a>
            </div>
            <!-- END post-entry-featured-image -->
    
        <div class="post-entry-content">
            	<h2><a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    					<?php the_news_excerpt('500000','','','plain','no'); ?>
            </div><!-- END post-entry-content -->
    
       <?php } else{ ?>
       <h2><a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    			<?php the_news_excerpt('500000','','','plain','no'); ?>.
       <?php } ?>
     	</div>
    	<!-- END post-entry -->
    
    <?php endwhile; ?>

    Why am I getting the error message above.

    Thanks for any help!

    morning, my PB is that the slider is been showing on the left side instead of the middle. can anyone help please? *
    http://www.gmitransit.com*

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Inserting an image to the homepage’ is closed to new replies.