WordPress.org

Forums

Adding a blog page to a website (14 posts)

  1. mellyg
    Member
    Posted 1 year ago #

    Hi there

    I am trying to add a blog page to my website, I am using the code below, the right information is showing up but its not appearing correctly. All the dates from the different articles are listed together and all the images ares stacked on top of each other.

    Seems to be a problem with the PHP or html rather then the CSS, can anyone see where I have gone wrong?

    <?php // Display blog posts on any page @ http://m0n.co/l
    		$temp = $wp_query; $wp_query= null;
    		$wp_query = new WP_Query(); $wp_query->query('showposts=10' . '&paged='.$paged);
    		while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
    	<div id="blog-image"><?php the_post_thumbnail( $size, $attr ); ?> </div>
        <div class="date">
    		<p><?php echo get_the_time('M'); ?> <b><?php echo get_the_time('d'); ?></b></p>
    							</div>
    
        <div id="blog-words"><a>" rel="bookmark" title="<?php the_title_attribute(); ?>">
    		<h2></a><a>" title="Read more"><?php the_title(); ?></a></h2>
    
    		<?php the_excerpt(); ?>
            </div>
    
    		<?php endwhile; ?>
    
    		<?php if ($paged > 1) { ?>
    
             <div class="paginationBox group">
    					<?php kriesi_pagination($pages = '', $range = 3); ?>
    				</div>
  2. Andrew
    Nuh uh moderator
    Posted 1 year ago #

    Can you link the page in question?

  3. mellyg
    Member
    Posted 1 year ago #

    I wish I could but I am working locally.

  4. Andrew
    Nuh uh moderator
    Posted 1 year ago #

    Seems to be a problem with the PHP or html rather then the CSS

    Why?

  5. mellyg
    Member
    Posted 1 year ago #

    I thought it was the problem as its stacking the dates on top of each other rather then keeping the blog entry items together, e.g. title, date and excerpt together, Here is a link to a screen shot which will explain it better. https://www.dropbox.com/sh/g905r6gll2ymlpd/VwgNPnyZpU

    Or could the problem be in the reading settings? I have the home page on home.php and the blog page on on page-blog.php. In the reading settings I have - Front page displays, then 'your latest posts' checked.

  6. Andrew
    Nuh uh moderator
    Posted 1 year ago #

    Sorry, I can't help you without a link to your site.

  7. alchymyth
    Forum Moderator
    Posted 1 year ago #

    seems to be a formatting issue - check if the dates are formatted with float or so, while the other divs are not;

    alternatively, try to wrap each post in a div to keep them together, and remove any 'float' from the dates.....

  8. mellyg
    Member
    Posted 1 year ago #

    Hiya, thanks for the help, I tried what you said but it didnt fix the problem, so I have gotten the blog feed code of another website which keeps the blog details together but unfortunatly they blog goes off the page. Here is a link of what I mean https://www.dropbox.com/s/fi6xwc5iqi5qr00/Screen%20Shot%202013-10-13%20at%2011.46.57.png

    And below is the code, any idea where I am going wrong?

    <div class="blog-entry clearfix">
    
    <?php
    						$thePostID = $post->ID;
    						$get_custom_options = get_option($shortname.'_blog_page_id');
    						$cat_id_inclusion = trim($get_custom_options['blog_to_cat_'.$thePostID]);
    						if ($cat_id_inclusion) $cat_inclusion = 'cat='.$cat_id_inclusion.'&';
    						query_posts($cat_inclusion.'posts_per_page='.get_option($shortname."_blog_posts_count").'&post_status=publish&paged='.$paged);
    
    						if ( have_posts() ) while ( have_posts() ) : the_post();
    					?>
    
    					<div class="blog_content_inner blogBackrpt">
    
    						<?php
    							//check if the post has a thumbnail
    							if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) {
    
    								$custom = get_post_custom($post->ID);
    								$crop_blog_featured_image = $custom[$shortname."_crop_featured_image"][0];
    
    								if ($crop_blog_featured_image) {
    									$blog_image_original = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), '', false );
    									$get_custom_image_url_big = $blog_image_original[0];										
    
    									echo '<img src="'.$get_custom_image_url_big.'" alt="'.get_the_title().'">';
    								} else {
    									the_post_thumbnail('blog_listings', array( 'alt' => get_the_title()));
    								}
    
    							} else {
    
    								if (!get_option($shortname."_hide_blog_entire_metabox")) {
    									echo '<p style="padding-top:45px;">&nbsp;</p>';
    								}
    
    							}
    						?>
    
    						<?php if (!get_option($shortname."_hide_blog_entire_metabox")) { ?>
    
    						<?php if ( (!get_option($shortname."_hide_blog_author_metabox"))
    									|| (!get_option($shortname."_hide_blog_date_metabox"))
    									|| (!get_option($shortname."_hide_blog_category_metabox"))
    									|| (!get_option($shortname."_hide_blog_comments_metabox")) ) { ?>
    
    						<div class="meta_box">
    							<ul>
    								<?php if (!get_option($shortname."_hide_blog_author_metabox")) { ?>
    								<li><?php _e('by','minimalisto'); ?> </li>
    								<li><?php the_author_posts_link(); ?>, </li>
    								<?php } ?>
    								<?php if (!get_option($shortname."_hide_blog_date_metabox")) { ?>
    								<li><?php _e('on','minimalisto'); ?> <?php echo get_the_time('F j, Y'); ?> - </li>
    								<?php } ?>
    								<?php if (!get_option($shortname."_hide_blog_category_metabox")) { ?>
    								<li><?php the_category(', ') ?></li>
    								<?php } ?>
    								<?php if (!get_option($shortname."_hide_blog_comments_metabox")) { ?>
    								<li>|</li>
    								<li><?php comments_popup_link(__('No comments','minimalisto'),__('1 comment','minimalisto'), __('% comments','minimalisto')); ?></li>
    								<?php } ?>
    							</ul>
    						</div><!--/meta_box-->
    						<?php
    								}
    							}
    						?>
    
    						<div class="blog_info">
    							<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    
    							<?php
    								if (get_option($shortname."_blog_posts_full_content")) {
    									the_content();
    								} else {
    
    									//get custom for this post to check if full content is enabled for current post
    									$blog_post_single_full_content = '';
    									$custom = get_post_custom($post->ID);
    									$blog_post_single_full_content = $custom[$shortname."_blog_post_single_full_content"][0];
    
    									if ($blog_post_single_full_content) {
    										the_content();
    									} else {
    										the_excerpt();
    							?>
    							<a href="<?php the_permalink(); ?>" class="continue"><?php _e('Continue Reading &mdash;&rsaquo;','minimalisto'); ?></a>
    							<?php
    									} //end to check if is activated full content in this post only for Blog listings
    								} //end to check if is activated full content in Blog listings
    							?>
    
    						</div><!--/blog_info-->
    					</div><!--/blog_content_inner-->
    				<?php endwhile; ?>
    
    			<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
                </div>
  9. alchymyth
    Forum Moderator
    Posted 1 year ago #

    please find a way to have the site public on a server;
    without being able to inspect the live site, there is no way to help with formatting issues.

    if content runs over the end of a page, this is often caused by un-cleared floats; check the web for 'clear float css'

  10. mellyg
    Member
    Posted 1 year ago #

    Heya

    Finally managed to get the site on a live server - the address of the page I am having trouble with is http://www.melgardner.com/qmatters/latest-news-2/

    As you will see - the blog entries are going off the page. Does anyone know what to do?

    Many thanks
    Mel

  11. WPyogi
    Forum Moderator
    Posted 1 year ago #

  12. mellyg
    Member
    Posted 1 year ago #

    Oh, ok, thanks for pointing that out.

    Ill fix them now and see if that works.

  13. mellyg
    Member
    Posted 1 year ago #

    I cant seem to find all of them - How do I locate these errors in my files?

  14. mellyg
    Member
    Posted 1 year ago #

    I have fixed all the errors except for Line 59 Column 90 - Anyone know how I find this in my files?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.