Excerpts Applying In Sydney Theme Service Page

Hi Team,

Thanks for your previous support and time.

I want to apply “EXCERPTS” on my SERVICES page present in MENU BAR TOP similar to my OUR SERVICES Section on my home page so that it could look really neat on my SERVICES page.

For your quick reference below is my website link.

www.signaturestoautographs.com

Hello there,

Please try adding the below function into your child theme’s functions.php file.


function sydney_child_services_archive_excerpt($content) {

  if ( is_post_type_archive('services') ) {
    $content_excerpt = substr(wp_filter_nohtml_kses($content), 0, 300) . '[...]';
    return $content_excerpt;

  }

  return $content;

}
add_filter( 'the_content', 'sydney_child_services_archive_excerpt' );

Alternatively, to apply extra PHP code to your site without a child theme, you can the functionality plugin like Code Snippets.

Regards,
Kharis

HI Kharis,

Thanks for you reply…

My Sydney theme is not child theme of sydney, and where i need to paste this code in theme function…

if I am using this plugin then how to use this…

please help me

Hello there,

I am sorry for confusion. I meant you should use a child theme. The purpose of putting it into the child theme’s is to retain extra code addition, as main theme’s files are overwritten when it gets updated. Ideally you should create a new child theme or use our pre-made one. However, you might not want to use it.

Alternatively, you can also apply that extra PHP code with Code Snippets. Once this plugin is active, click on the Code Snippets menu in near bottom left. Add a new snippet, put the code into the Code box. Ensure either “Run snippet everywhere” or “Only run on site front-end” scope is active. Then save changes and activate.

Regards,
Kharis

Hi Kharis,

Once again you guys are the best.
Thanks a ton for your support and time.

You’re welcome!

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis

How can you have functions.php in a child theme? It just breaks the site…

Hello there,

To disable the child theme breaking your site, access your FTP account, and go to root > wp-content > themes directory. Then remove the child theme directory.

Download our Sydney Child theme. In the functions.php file, add the code to the most bottom line.

Regards,
Kharis

What is the purpose of “Excerpts” tab at the bottom of the Services page if we have to add the code specified in the 1st thread? I’m little confused. Please advise

Hello there,

Visit this codex page that explains it better.

Regards,
Kharis

1 Like