• Hi, I know it’s stupid question but I read all topics about this problem and I couldn’t solve my problem

    so in index.php file all pages show same posts… but in archive.php or category.php everything is ok…..

    index.php

    <?php get_header(); ?>
    	<div class="ui grid top container">
            <div class="sixteen wide column">
                <h1 class="ui master header lengthy"><span class="border">Latest</span>
                </h1>
                <div class="latest-anime">
                    <div class="ui big-cover five horizontal list">
                        <?php query_posts( 'posts_per_page=10' ); ?>
                        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                        <div class="item">
                            <?php the_post_thumbnail(); ?>
                            <div class="overlay">
                                <div class="actions">
                                    <a class="action" href="<?php the_permalink();?>" alt="<?php the_title(); ?>" ><i class="fa fa-info-circle" aria-hidden="true">
                                    </i></a>
                                </div>
                            </div>
                            <div class="sub title">
                                Epic <span class="number"><?php the_field('epnum'); ?></span> <span class=
                                "time"><i class="fa fa-clock-o ooa"></i>????
                                <?php the_field('eptime'); ?></span>
                            </div>
                            <a class="title" href=
                            "<?php the_permalink();?>">
                            <div class="limit">
                                <?php the_title();?>
                            </div></a>
                        </div>
                        <?php endwhile; else : ?>
                        <?php endif; ?>
                    </div>
                    <div class="ui pagination menu">
                        <?php current_bpaged(); ?>
                        <?php current_paged(); ?>
                    </div>
                </div>
            </div>
            <div class=
            "sixteen wide mobile sixteen wide tablet eight wide computer column">
                <h1 class="ui master header"><span class="border">????? ????? ??? ????? ?????</span></h1>
                <div class="ui half-hidden-covers list">
                    <?php
                    $my_query = new WP_Query('showposts=10&cat=33');
                    while ($my_query->have_posts()):
                    $my_query->the_post();
                    $do_not_duplicate = $post->ID;?>
                    <a class="item" data-content="<?php the_title(); ?>" data-toggle="popup" href="<?php the_permalink();?>">
                        <div class="half">
                            <?php the_post_thumbnail(); ?>
                        </div>
                    </a>
                    <?php endwhile; ?>
                </div>
            </div>
            <div class=
            "sixteen wide mobile sixteen wide tablet eight wide computer column">
                <h1 class="ui master header"><span class="border">????? ??? ?????</span></h1>
                <div class="ui half-hidden-covers list">
                    <?php query_posts('meta_key=post_views_count&orderby=meta_value_num&order=ASC', 'posts_per_page=10'); ?>
                    <?php while(have_posts()) : the_post(); ?>
                    <a class="item" data-content="<?php the_title(); ?>" data-toggle="popup" href="<?php the_permalink();?>">
                        <div class="half">
                            <?php the_post_thumbnail(); ?>
                        </div>
                    </a>
                    <?php endwhile; ?>
                    <?php wp_reset_query(); ?>
                </div></div>
            <div class="sixteen wide column">
                <h1 class="ui master header lengthy"><span class=
                "border">PAGES</span>
                </h1>
                <div id="disqus_thread" class="ui master pagination menu getthat">
                    <?php if (function_exists("pagination"))
                        {
                            pagination($additional_loop->max_num_pages);
                        }
                    ?>
                </div>
            </div>
        </div>
    <?php get_footer(); ?>

    and the function.php

    <?php
    
    /* Post Thumbnails */
    add_theme_support('post-thumbnails');
    if ( function_exists('add_theme_support') ) {
    add_theme_support('post-thumbnails');
    }
    
    function siblings($link) {
        global $post;
        $siblings = get_pages('child_of='.$post->post_parent.'&parent='.$post->post_parent);
        foreach ($siblings as $key=>$sibling){
            if ($post->ID == $sibling->ID){
                $ID = $key;
            }
        }
        $closest = array('before'=>get_permalink($siblings[$ID-1]->ID),'after'=>get_permalink($siblings[$ID+1]->ID));
    
        if ($link == 'before' || $link == 'after') { echo $closest[$link]; } else { return $closest; }
    }
    
    /* index.php Page Nav Link */
    
    function current_paged( $var = '' ) {
        if( empty( $var ) ) {
            global $wp_query;
            if( !isset( $wp_query->max_num_pages ) )
                return;
            $pages = $wp_query->max_num_pages;
        }
        else {
            global $$var;
                if( !is_a( $$var, 'WP_Query' ) )
                    return;
            if( !isset( $$var->max_num_pages ) || !isset( $$var ) )
                return;
            $pages = absint( $$var->max_num_pages );
        }
        if( $pages < 1 )
            return;
        $page = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
       echo '<a class="item" href="/ianime/page/'.++$page.'"><i aria-hidden="true" class="fa fa-chevron-right"></i></a>';
    }
    function current_bpaged( $var = '' ) {
        if( empty( $var ) ) {
            global $wp_query;
            if( !isset( $wp_query->max_num_pages ) )
                return;
            $pagess = $wp_query->max_num_pages;
        }
        else {
            global $$var;
                if( !is_a( $$var, 'WP_Query' ) )
                    return;
            if( !isset( $$var->max_num_pages ) || !isset( $$var ) )
                return;
            $pagess = absint( $$var->max_num_pages );
        }
        if( $pagess < 1 )
            return;
        $pageb = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 0;
        if($pageb <= 1){
            echo '<a class="disabled item" href="/ianime/page/"><i aria-hidden="true" class="fa fa-chevron-left"></i></a>';
        }
        else if( $pageb > 1 ){
            echo '<a class="item" href="/ianime/page/'.--$pageb.'"><i aria-hidden="true" class="fa fa-chevron-left"></i></a>';
        }
    }
    /* Remove Page on Search Resautls */
    function remove_pages_from_search() {
        global $wp_post_types;
        $wp_post_types['page']->exclude_from_search = true;
    }
    add_action('init', 'remove_pages_from_search');
    /* PageINATION
    function pagination($pages = '', $range = 4)
    {
    $showitems = ($range * 2)+1;
    
    global $paged;
    if(empty($paged)) $paged = 1;
    
    if($pages == '')
    {
    global $wp_query;
    $pages = $wp_query->max_num_pages;
    if(!$pages)
    {
    $pages = 1;
    }
    }
    
    if(1 != $pages)
    {
    if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>? First</a>";
    if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>? Previous</a>";
    
    for ($i=1; $i <= $pages; $i++)
    {
    if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
    {
    echo ($paged == $i)? "<span class=\"item active\">".$i."</span>":"<a href='".get_pagenum_link($i)."' class=\"item\">".$i."</a>";
    }
    }
    
    if ($paged < $pages && $showitems < $pages) echo "<a href=\"".get_pagenum_link($paged + 1)."\">Next ?</a>";
    if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last ?</a>";
    }
    }*/
    /* Most Viewed Posts */
    function observePostViews($postID) {
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
    $count = 0;
    delete_post_meta($postID, $count_key);
    add_post_meta($postID, $count_key, '0');
    }else{
    $count++;
    update_post_meta($postID, $count_key, $count);
    }
    }
    function fetchPostViews($postID){
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
    delete_post_meta($postID, $count_key);
    add_post_meta($postID, $count_key, '0');
    return "0 View";
    }
    return $count.' Views';
    }
    /* Meta Seo */
    function create_meta_desc() {
        global $post;
    if (!is_single()) { return; }
        $meta = strip_tags($post->post_content);
        $meta = strip_shortcodes($meta);
        $meta = str_replace(array("\n", "\r", "\t"), ' ', $meta);
        $meta = substr($meta, 0);
        echo "<meta name='description' content='$meta' />";
    }
    add_action('wp_head', 'create_meta_desc');
    
    /* User Menu Changes */
    function my_wp_nav_menu_args( $args = '' ) {
    
    if( is_user_logged_in() ) {
        echo '<a class="item with-inverted-blue" href="https://ianime.one/%d9%be%db%8c%d8%b4%d9%86%d9%87%d8%a7%d8%af-%d8%b4%d8%af%d9%87/"><i aria-hidden="true" class="fa fa-diamond oooas"></i> ????? ??? ????? ???? <i aria-hidden="true" class="fa fa-diamond oooas"></i></a>';
    } else {
        echo '<a class="item with-inverted-blue" href="https://ianime.one/ruru/"><i aria-hidden="true" class="fa fa-sign-in ooo"></i> ????</a>';
    }
        return $args;
    }
    add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Same Posts no matter which page’ is closed to new replies.