customizing my posts

Hello guys,
I’m new to wordpress and I got a two questions about customizing my posts (incl. excerpts)

  1. How I can i make the featured image go below the post title? right now im doing it manually by not using a featured image and putting the image I want at the beginning of the post with the visual editor.

  2. How can I customize the excerpts? example: make shortcode and text format work in the excerpt. Usually I copy the content of my post manually from the text editor to the excerpt field, so the shortcode and text format works. Any way to make it work by default?

I just wish that I dont have to manually copy everything to the excerpt field, just use the “read more” tag where I would like…It’s really frustrating for me.

Thank you very much!

Hi @mili2110,

I hope you are well today and thank you for your question.

You can achieve this automatically by creating child theme of Sparkling theme and developing custom code in it.

The following filter and function will help you to achieve your second requirement.

https://codex.wordpress.org/Plugin_API/Filter_Reference/get_the_excerpt

Best Regards,
Movin

Hi Movin,
I forgot to mention that I already had the following code in my functions.php:

add_filter( ‘the_excerpt’, ‘shortcode_unautop’);
add_filter( ‘the_excerpt’, ‘do_shortcode’);

I changed it to:
add_filter( ‘get_the_excerpt’, ‘shortcode_unautop’);
add_filter( ‘get_the_excerpt’, ‘do_shortcode’);

It didn’t change anything.

The shortcode and text format still works, but only when I paste the post in the excerpt field. I want the auto-generated excerpt to have the right text format and shortcodes :confused:

No that code won’t work you have to use code like following but it will display whole post and not just excerpt.

function custom_excerpt( $excerpt ) {
    global $post;
  return do_shortcode($post->post_content);
}
add_filter( 'get_the_excerpt', 'custom_excerpt', 99 );

You can try achieving that by using the following plugins.

Thank you so much Movin! It is working!
Now I’ll try to create a child theme! :slight_smile:

You are most welcome here :slight_smile:

Hi, I finally managed to create a child theme! So how can I make the featured image below the headline in recent posts and single post view (example: attached image). I forgot to mention, that I got a plugin for the right aspect ratio of my featured images that Movin created for me (thx again!). Would that be a problem?
the plugin code is:

function modify_slider_image_size(){
add_image_size( ‘sparkling-featured’, 9999, 9999, true );
}
add_action( ‘init’, ‘modify_slider_image_size’, 10 );

I already integrated the code in my functions.php of my child theme and uninstalled the plugin. I guess its better this way!?

Thank you!

Hi, I finally managed to create a child theme! So how can I make the featured image below the headline in recent posts and single post view (example: attached image).

There is much code to tell you so could you please share me your developed child theme so that i can make changes in to achieve this and share it to you again?

I forgot to mention, that I got a plugin for the right aspect ratio of my featured images that Movin created for me (thx again!). Would that be a problem?

NO

I already integrated the code in my functions.php of my child theme and uninstalled the plugin. I guess its better this way!?

Yes

Hi Movin,
I zipped my child-theme. Thanks in advance!

I have made some changes in your shared child theme to display the featured image below the headline in recent posts and single post view so please use the attached modified theme to achieve this on your site.

Hi Movin,
I think you forgot the attachment :smiley:

Sorry to forget it. Please find it attached to this reply.

Thank you Movin! It’s working! :slight_smile:

One more question: Can I customize the post title text? Example: Change color of some words, make it bold, italic etc. like in the post editor.
Thank you so much!

You are always welcome here :slight_smile:

To help us keep support thread separates could you please create new thread for your other questions here https://colorlibsupport.com/c/sparkling/ instead of asking them in your single thread as it makes the thread messy and hard to read.

If you want to you can also add reference of this thread in your newly created thread.

We would be more than happy to help you on your new thread.