更改永久链接后,自定义页面不起作用

时间:2019-05-12 17:12:59

标签: wordpress wordpress-theming

我有带有Slug博客的页面名称博客。我已将永久链接从普通名称更改为职位名称,此页面现在无法正常工作,但是更改永久链接后的所有其他页面都可以正常工作。在更改永久链接之前,页面工作正常,如果我将其恢复为普通的永久链接,则页面将再次开始工作。我的代码是

        <?php
        /*
            Template Name: Blog
        */
        ?>

        <?php get_header(); ?>


        <?php

        ?>

        <div class="wrap">


            <?php

            $getCurrentPage = get_query_var('paged', 1);


            $aboutPosts = new WP_Query(array(
                'posts_per_page' => '12',
                'post_type' => array(
                    'custom_2nd',
                    'custom',
                    'post',
                    'custom_3rd'
                ),
                'paged' => $getCurrentPage
            ));



            ?>
            <section class="">
                <?php
                if ( $aboutPosts->have_posts() ) :

                    ?>



                    <div class="columns is-multiline  is-variable is-4 is-centered">
                        <?php
                        /* Start the Loop */
                        while ($aboutPosts->have_posts() ) :
                            $aboutPosts->the_post();

                            /*
                             * Include the Post-Format-specific template for the content.
                             * If you want to override this in a child theme, then include a file
                             * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                             */

                            ?>

                            <div class="column is-4">

                                <div class="card-image">
                                    <?php if (has_post_thumbnail()) : ?>
                                        <a href="<?php the_permalink(); ?>">
                                            <figure class="image is-4by3">
                                                <?php the_post_thumbnail( 'twentyseventeen-featured-image' ); ?>
                                            </figure>
                                        </a>
                                    <?php endif;?>
                                </div>

                                <p class="subtitle is-6 card-content has-text-centered  c-card-header-color"><a href="<?php the_permalink(); ?>"> <?php the_title(); ?></a></p>

                                <div style="margin-top: -40px" class="has-text-centered c-card-footer-color">
                                    <?php
                                    echo '  <i class="fas fa-calendar-alt"></i>';
                                    echo '<span style="margin-right: -5px; margin-bottom: 4px" class="icon  has-text-centered  ">

        </span>' . twentyseventeen_posted_on();

                                    ?>
                                </div>

                                <p class="has-text-centered " ><?php echo wp_trim_words( get_the_excerpt(), 21, '...' );?></p>
                                <div class="has-text-centered">



                                    <a style="margin-top: 20px" target="_blank" href="<?php the_permalink(); ?> "  value="Read More" class=" button  is-info my-hover c-right-arrow ">Read More</a>
                                </div>
                                <hr class=" c-hr-bg-color " >
                            </div>

                        <?php
                        endwhile;
                        wp_reset_postdata();
                        ?>
                    </div>

                    <style>
                        .svg-color  svg {
                            color : #1496ed;

                        }
                    </style>
                <?php
                else :

                    get_template_part( 'template-parts/post/content', 'none' );

                endif;
                ?>

                <div class="level" >
                    <div style="margin-top: -40px; width: 200px" class=" level-item has-text-centered svg-color ">


                        <?php echo paginate_links(array(
                            'prev_text'          => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text my_test ">' . __( 'Previous page', 'twentyseventeen' ) . '</span>',
                            'next_text'          => '<span class="screen-reader-text ">' . __( 'Next page', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ),
                            'before_page_number' => '<span class="meta-nav screen-reader-text ">' . __( 'Page', 'twentyseventeen' ) . ' </span>',
                            'total' => $aboutPosts->max_num_pages
                        ))?>

                    </div>
                </div>
            </section>

        <?php get_footer(); ?>

0 个答案:

没有答案