BLOG LOOP ISSUES

  • Author
    Posts
  • #3366029

    mikep0255
    Member

    I am having issues with my blog loops. I had someone customize by site but they made a mistake with the blog posts.
    ISSUE:
    I have three different pages that feature blog categories (events, news, The Journal). Although the posts are appearing on their correct pages (e.g. Events blog post 1, appears on Events Page), every blog post is also appearing on the “The Journal” page. Moreover, when you go to the Events or News page and click on a post’s ‘read more’, it opens up on “The Journal” page- not on the Events or News page.
    IDEALLY:
    I want each blog category to appear and open solely on their individual pages. Below you can see the relevant index.php php code (i think) for “index.php” ”single.php”, “tag.php”, “The Journal.php”, “content-tag.php”, “taxononomy-blog_category.php” . I would appreciate if someone can help me out. Thanking you in advance for any guidance, Mike

    INDEX.PHP
    get_header(); ?>


    <!– #primary –>
    </div>

    <?php
    get_footer();

    CATEGORY.PHP

    <h3 style = “padding-top: 0px; padding-bottom: 30px;”>“>Read More</h3>
    </div>
    <?php $i++; ?>
    <?php if ( $i % 2 == 0 ) { ?></div><?php } ?>
    <?php endwhile;
    endif; ?>
    <?php wp_reset_query(); ?>
    </div>
    <? if ($i % 2 != 0) { ?></div><?php } ?>

    </div>
    </div><!– #primary –>

    <?php
    get_footer();

    <?php
    /**
    * Template part for displaying posts
    *
    * @link https://codex.wordpress.org/Template_Hierarchy
    *
    * @package mywebsite
    */

    ?>

    ” class = “blog-post-mywebsite”>

    ‘, ”, false );
    echo $my_date;
    ?>
    ‘, ” );
    else :
    the_title( ‘‘, ‘‘ );
    endif;
    ?>

    • ” alt=”” />

    <?php endif; ?>

    <?php if( get_field(‘video’) ): ?>

    </div>
    <?php endif; ?>

    Address

    Telephone

    array( ‘facebook’, ‘twitter’, ‘google_plus’, ‘pinterest’, ‘linkedin’ ),
    ) );
    } ?>

    </div>
    </div>

    </article><!– #post-## –>
    </div>

    THE-JOURNAL.PHP

    <?php
    /* Template Name: The Journal */
    ?>

    <?php get_header(); ?>

    ‘post’,
    ‘post_status’ => ‘publish’,
    ‘orderby’ => ‘DESC’
    );

    $my_query = null;
    $my_query = new WP_Query($args);
    ?>

    have_posts()) : $my_query->the_post();?>
    current_post == 0 && !is_paged() ) : ?>

    “> ‘img-fluid’ ) ); ?>

    “>Read More

    </div>

    </div>
    </div>

    <?php endif; ?>

    <?php endwhile; ?>

    <?php
    $args=array(
    ‘post_type’ => ‘post’,
    ‘post_status’ => ‘publish’,
    ‘offset’ => ‘1’,
    ‘orderby’ => ‘DESC’
    );

    $my_query2 = null;
    $my_query2 = new WP_Query($args);
    ?>
    <?php $i = 0; ?>
    <?php while ($my_query2->have_posts()) : $my_query2->the_post();?>
    <?php if($i % 2 == 0) { ?>

    “> ‘img-fluid’ ) ); ?>

    “>Read More

    <?php $i++; if($i % 2 == 0) { ?> </div><?php } ?>
    <?php endwhile; ?>
    <?php wp_reset_query(); ?>
    <?php endif; ?>
    </div>
    <? if ($i % 2 != 0) { ?></div><?php } ?>

    </div>
    </div>
    <?php get_footer(); ?>

    CONTENT-TAG.PHP

    <?php
    /**
    * Template part for displaying posts
    *
    * @link https://codex.wordpress.org/Template_Hierarchy
    *
    * @package mywebsite
    */

    ?>

    ‘img-fluid’ ) ); ?>

    CONTENT-CATEGORY.PHP

    <?php
    /**
    * Template part for displaying posts
    *
    * @link https://codex.wordpress.org/Template_Hierarchy
    *
    * @package mywebsite
    */

    ?>

    ‘img-fluid’ ) ); ?>

    Taxonomy-blog_category.php

    <?php
    /**
    * The template for displaying archive pages
    *
    * @link https://codex.wordpress.org/Template_Hierarchy
    *
    * @package mywebsite
    */

    get_header(); ?>

    <style>
    .thumbnail img {
    max-height: 350px;
    }
    </style>

    ‘img-fluid’ ) ); ?>

    “>Read More

    <?php $i++; ?>
    <?php if ( $i % 2 == 0 ) { ?></div><?php } ?>
    <?php endwhile;
    endif; ?>
    <?php wp_reset_query(); ?>
    </div>
    <? if ($i % 2 != 0) { ?></div><?php } ?>

    </div>
    </div><!– #primary –>

    <?php
    get_footer();

    #3366860

    Hi Mike –

    It sounds like you’re site is set up on the open source, WordPress.org software rather than our managed hosting environment at WordPress.com.

    Please provide the site URL so we can confirm that information.

    Help with WordPress.org comes from a different community and it is at https://wordpress.org/support/forums/

You must be logged in to reply to this topic.