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
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
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:
Create a new folder in /wp-content/themes/
.
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."
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.
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.