0

For my client site,when i try to create new page and publish the design view was breaking but the blog post view showing properly, the site uses custom WordPress theme developed by the previous developer.

Wp site: http://blog.biblesforamerica.org

Page: http://blog.biblesforamerica.org/online-bible-studies-bibles-america/

How to achieve this?

Here is the code for single.page.php

<div id="primary" class="content-area">
    <main id="main" class="site-main" role="main">

        <?php
        while ( have_posts() ) : the_post();

            get_template_part( 'template-parts/content', 'page' );

            // If comments are open or we have at least one comment, load up the comment template.
            if ( comments_open() || get_comments_number() ) :
                comments_template();
            endif;

        endwhile; // End of the loop.
        ?>

    </main><!-- #main -->
</div><!-- #primary -->

<?php
get_sidebar();
get_footer();

Here is the code for content.php

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

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <header class="entry-header">
        <?php
        if ( is_single() ) :
            the_title( '<h1 class="entry-title">', '</h1>' );
        else :
            the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '"  rel="bookmark" >', '</a></h2>' );
        endif;

        if ( 'post' === get_post_type() ) :  ?>
        <h4 class="meta text-muted">
            <?php bfablog_posted_on(); ?>
        </h4><!-- .entry-meta -->
        <?php
        endif; ?>
        <!-- AddThis Button BEGIN -->
    <div class="addthis_inline_share_toolbox_mzc3" style="margin-bottom:20px;" data-title="<?php the_title() ?>" data-url="<?php the_permalink(); ?>" </div>
        <!-- AddThis Button END -->

    </header><!-- .entry-header -->

    <div class="entry-content">


        <?php
                     the_content( sprintf (
                /* translators: %s: Name of current post. */
                wp_kses(__( 'Read more', 'bfablog' ), array( 'span' => array( 'class' => 
array() ) ) ),

                the_title( '<span class="screen-reader-text">"', '"</span>', false )
            ) );


               wp_link_pages( array(
                            'before' => '<div class= "page-links">'. esc_html__('Pages:', 'bfablog'
),

                           'after'  => '</div>',
            ) );
        ?>

    </div><!-- .entry-content -->

    <footer class="entry-footer">
        <?php bfablog_entry_footer(); ?>
    </footer><!-- .entry-footer -->
</article><!-- #post-## -->
<hr>

<script type="text/javascript">
  var addthis_config = {
    ui_language: "{{ site.lang }}"
  };
  var addthis_share =
  {
     // ... members go here
  }
</script>

<!-- Go to www.addthis.com/dashboard to customize your tools -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-586c401922d76d24"></script>

Here is the code for content-page.php

<?php
/**
 * Template part for displaying page content in page.php
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package BfA_Blog
 */

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <header class="entry-header">
        <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>

    </header><!-- .entry-header -->

    <div class="entry-content"><hr>
        <?php
            the_content();


            wp_link_pages(array(
                'before' => '<div class="page-links">' . esc_html__('Pages:','bfablog'),
                'after'  => '</div>',
            ) );
        ?>
    </div><!-- .entry-content -->


    <?php if ( get_edit_post_link() ) : ?>
        <footer class="entry-footer">
            <?php
                edit_post_link(
                    sprintf(
                        /* translators: %s: Name of current post */
                        esc_html__( 'Edit %s', 'bfablog' ),
                        the_title( '<span class="screen-reader-text">"', '"</span>', false )
                    ),
                    '<span class="edit-link">',
                    '</span>'
                );
            ?>
        </footer><!-- .entry-footer -->
    <?php endif; ?>
</article><!-- #post-## -->

For blog post list page he created as content.php and for the single post he created content-page.php

How to achieve this?

0

You should have a separe custom template for custom page layout. The first one which is not broken is a post type while the other one is a page type which has different layouts. Create a custom page template with a layout like the single.php and use it in the page you are creating.

To create a custom page template, please refer to this wordpress doc : https://developer.wordpress.org/themes/template-files-section/page-template-files/

  • thanks bro act i am new to word press development, dont know how to do can you help me on this bro? – Tamil Beyond Sep 20 '17 at 5:56
  • Sorry but doing it is like creating a theme. I have to see the theme itself. Im not sure how complicated the current setup is now. – The Filipino Freelancer Sep 20 '17 at 6:08
  • what are the theme files you need i will send it to you bro? – Tamil Beyond Sep 20 '17 at 6:14
  • send me the whole theme if you can. I'll check it out later as I am currently working on a new website – The Filipino Freelancer Sep 20 '17 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.