Forum Replies Created

Viewing 15 replies - 31 through 45 (of 83 total)
  • Yes, that is why I did not recommend you to create a category. If you need to remove the ‘categoy’ from URL you have to modify the .htacess file or have to use some plugins. I think better to use the trick I mentioned in my last message. Try it. If that works there won’t come ‘category’ slug in the url.

    Do this..

    copy the content of your header.php file and create a new file called header-blog.php and paste it and save it.

    then replace the current <body>tag in header-blog.php (it would be something like <body <?php body_class?>> but whatever) with <body class="archive date" >. Then call get_header(‘blog’); instead of get_header(); in your custom template.

    Try this,

    <?php
    /*
     * Template Name: Blog Page
     * Description: Custom Blog Page by muah, Kyle Chadha.
     */
    
    get_header(); ?>
    
    <div class="title-container">
      <h1 class="page-title">
        <?php the_title(); ?>
      </h1>
    </div>
    <!-- .title-container -->
    <div id="container">
      <?php
    		global $post;
    		$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    		$args	= array(
    							'posts_per_page' => 10,
    							'paged'		 =>$paged,
    							'post_type' => 'post',
    							'order' => 'DESC',
    							'orderby' => 'post_date'
    							);
    
    		query_posts( $args );
    		?>
      <?php if( have_posts() ) : ?>
      <div id="content" role="main">
        <?php while( have_posts() ) : the_post(); ?>
        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
          <header class="entry-header">
            <?php if( has_post_thumbnail() ) : ?>
            <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark">
            <?php the_post_thumbnail( 'homepage-thumb' ); ?>
            </a>
            <?php endif; ?>
            <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark">
              <?php the_title(); ?>
              </a></h2>
            <aside class="entry-meta<?php if( has_post_thumbnail() ) : ?> folded<?php endif; ?>">
              <?php _e( 'By', 'minimatica' ); ?>
              <?php the_author_posts_link(); ?>
              <?php _e( 'on', 'minimatica' ); ?>
              <time datetime="<?php the_time( 'Y-m-d' ); ?>">
                <?php the_time( get_option( 'date_format' ) ); ?>
              </time>
            </aside>
            <!-- .entry-meta -->
          </header>
          <!-- .entry-header -->
          <section class="entry-summary">
            <?php the_excerpt(); ?>
          </section>
          <!-- .entry-summary -->
          <footer class="entry-footer"> <a class="more-link" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php echo __( 'Continue reading', 'minimatica' ) . ' &rarr;'; ?></a> </footer>
          <!-- entry-footer -->
        </article>
        <!-- .post -->
        <?php endwhile; ?>
        <?php if ( $wp_query->max_num_pages > 1 ) : ?>
        <div id="posts-nav" class="navigation">
          <div class="nav-previous">
            <?php next_posts_link( '&larr; ' . __( 'Older Posts', 'minimatica' ) ); ?>
          </div>
          <div class="nav-next">
            <?php previous_posts_link( __( 'Newer Posts', 'minimatica' ) . ' &rarr;' ); ?>
          </div>
          <div class="clear"></div>
        </div>
        <!-- #nav-above -->
        <?php endif; ?>
      </div>
      <!-- #content -->
      <?php else : ?>
      <div id="content">
        <div id="post-0" <?php post_class(); ?>>
          <div class="entry-content">
            <p>
              <?php _e( 'The content you were looking for could not be found.', 'minimatica' ); ?>
            </p>
            <?php get_search_form(); ?>
          </div>
          <!-- .entry-content -->
        </div>
        <!-- .post -->
      </div>
      <!-- #content -->
      <?php endif; ?>
      <?php get_sidebar(); ?>
      <div class="clear"></div>
    </div>
    <!-- #container -->
    <?php get_footer(); ?>

    Can you share the codes in loop.php ?

    try this code in your template.

    <?php
    /*
     * Template Name: Blog Page
     * Description: Custom Blog Page by muah, Kyle Chadha.
     */
    
    get_header(); ?>
    
     	<div class="title-container">
    		<h1 class="page-title"><?php the_title(); ?></h1>
    	</div><!-- .title-container -->
    	<div id="container">
    		<?php
    		global $post;
    		$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    		$args	= array(
    							'posts_per_page' => 10,
    							'paged'		 =>$paged,
    							'post_type' => 'post',
    							'order' => 'DESC',
    							'orderby' => 'post_date'
    							);
    
    		query_posts( $args );
    		?>
    		<?php get_template_part( 'loop', 'index' ); ?>
    		<?php get_sidebar(); ?>
    		<div class="clear"></div>
    	</div><!-- #container -->
    
    <?php get_footer(); ?>

    Ohh, yes it was my mistake. Anyway glad to here that you could solve it. ??

    Can you try to paste code from category.php to your custom template. Please don’t remove the Template name, description etc of your custom template. Just paste the code only.

    Forum: Hacks
    In reply to: Div around Comment text

    wp_list_comments() funciton is located in wp-includes/comment-template.php
    see this

    It seems like the ‘Blog’ template of your theme is created so as to show the blog categories first, instead listing the blog posts. When you click on any category you will get all posts of it. If you are familiar with WP template files and PHP, you can modify the existing ‘Blog’ template or try to get support from your theme support team.

    If you are familiar with WP template files and WP functions, you can create a new page template with code in it to list all blog posts and assign it to a newly created page, say ‘Blogs’. So you can keep your front page as the current gallery page and can link the menu Blog to above created page. See this

    In your code, you did not write anything to specify the categories. You can set the category id as a parameter for get_posts() function, see here

    So you have to repeat the code twice if you need to show posts from those categories separately. ie

    for 1st category posts:-

    $args = array( ‘numberposts’ => 5, ‘order’=> ‘DESC’, ‘cateogry’=>XX ‘orderby’ => ‘date’ );
    ——-here comes the rest of the code above—-

    For 2nd category:-
    repeat the code by changing the category ID specified (here I gave it as XX) in $args.

    In effect the change comes only in the $args.

    Try PHP functions like strip_tags() or str_replace() to remove <p> tags.

    Glad to here that your problem solved!!!
    Cheers!!!

    Forum: Hacks
    In reply to: paginate_links problem

    Try wp-paginate plugin instead of default WP page links. Also put WP loop in between query_posts and pagination, because it can set some post variables. I am mot sure whether it will solve the issue but just give it a try.

    To get the child categories of a given parent category slug, use a combination of get_category_by_slug() and get_categories().Get parent category id from the first function and pass it to second function as its ‘child_of’ parameter.

Viewing 15 replies - 31 through 45 (of 83 total)