WordPress.org

Ready to get started?Download WordPress

Forums

JBST
[resolved] Persist rendering for posts on the front page? (5 posts)

  1. dimers
    Member
    Posted 5 months ago #

    Hi, I have much table data in my posts I and would like the <table> rendering to persist in the posts listed on the front page. How can this be enabled? Is there an theme option to enable this? Currently the <table> rendering in posts on the home page is removed and the text in the <table> is displayed as a single unstructured string. <table> data in a post is rendered as such when a single post is displayed.

  2. bassjobsen
    Member
    Theme Author

    Posted 5 months ago #

    Thanks for your interesting question. to be honest, i have never test this before. I will do coming days to give you a solution.

    By default on the homepage the expert of the post will be shown. See also https://codex.wordpress.org/Excerpt (this filters HTML).

    I think the best solution will be to create a new template front-page.php and show posts with the_content() and use the more tag.

    Globally this template should look like that shown below:

    <?php
    get_header();
    do_action( 'jbst_before_content_'.get_post_format());
    jbst_content_nav_top();
    if ( have_posts() ) :
    	while ( have_posts() ) : the_post();
    	the_content();
    	endwhile;
    endif;
    do_action( 'jbst_after_content_'.get_post_format() );
    get_footer();
    ?>
  3. dimers
    Member
    Posted 5 months ago #

    Hi,
    I tried creating a 'front-page.php' with the code as you noted but this did not work as expected.

    I edited your content.php file in "themes/jbst" and swapped out 'the_excerpt()' for 'the_content()' on lines 49 and 69. This appears to work OK and preserves the HTML tags (the <table> displays).

    I prefer not to alter your theme files, can this be a new theme option to expose 'the_content()' or to 'the_excerpt()' on the main page and search result pages?

  4. bassjobsen
    Member
    Theme Author

    Posted 5 months ago #

    I will add that theme option before uploading the next version to wordpress.org. Thanks! See also: https://github.com/bassjobsen/jbst/issues/118

  5. bassjobsen
    Member
    Theme Author

    Posted 5 months ago #

    This issue is fixed, please see: https://github.com/bassjobsen/jbst/issues/118

Reply

You must log in to post.

About this Theme

About this Topic