0

I have a puzzle website where i am looking for the option to display full question on the home page rather than excerp. Just a note that questions are custom posts. Is there any way.

Thanks

1

Yes, the homepage can show whatever you want it to.

First, look through your theme's files to figure out what file specifically is being used for the homepage. Sometimes it is home.php; other times front-page.php. (If your theme shows a static Page, it can also be other templates - but it doesn't sound like that's the case here.) Sometimes the file that controls the homepage includes a different file using get_template_part().

Once you determine which file is being used, you can create a Child Theme:

  1. Create a new folder in /wp-content/themes/.

  2. Create a new style.css file inside the folder and include at a minimum this comment:

    /* Theme Name: WPSE Child Template: nameofparenttheme */

You'll have to sub in "nameofparenttheme" with your actual theme. For example, if you are using the Twenty Fifteen theme as the parent, "twentyfifteen" is the template name. This tells WordPress "this is a child theme - if any files are missing here, look in the parent theme for them."

  1. Copy the file in the parent theme that controls your homepage - copy it with the same name, into your child theme folder. Change just the part where it says

the_excerpt()

to

the_content().

Keep in mind that if you are editing a template part, that will also affect other pages - wherever else that template part is called. So, if you only want to show the full post on the homepage and not elsewhere, you may instead want to copy front-page.php or home.php (the main file, not the get_template_part() and just replace the get_template_part() portion with your own code to format the post(s) however you want, including wrapper HTML and the full post content itself.

  • I pretty much agree with you, I have created child theme and also found the template that is being used but the code inside is not that simple I expected. Here is the code if ($excerpt_questions != "on") { $question_excerpt = (isset($question_excerpt) && $question_excerpt != ""?$question_excerpt:40);?> <p><?php discy_excerpt($question_excerpt,$excerpt_type,$read_more_question);?></p> <?php } just trying to understand how to change it. – Avinash Patel Feb 19 at 11:11
  • It sounds like your theme is using custom excerpt functions - if you look in functions.php you should be able to see where things are defined and what each one is doing. It's hard to read in a comment where the formatting and indention aren't enabled. :) – WebElaine Feb 22 at 14:13
-1

Add the following to your functions.php file:

function custom_excerpt_length( $length ) {
return 30;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

Change "30" to a big number so the excerpt length is increased.

  • I also though something like this will work, but unfortunately I can see full post but all content line by line. I want full post to show in proper order including line beak, page break etc. – Avinash Patel Feb 19 at 9:38

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.