How to appending to the_content using add_filter with custom post type?

I have a custom post type running fine, but some of the text in the page is the same for every post, so I want to add it in using a function. I have this set up: function new_default_content($content) { global $post; if ($post->post_type == ‘custom-post-type’) { $content=”Test text here”; } return $content; } add_filter(‘the_content’, … Read more

Change appearance of shortcode text inside editor

Is it possible to change appearance of shortcodes in editor or in whatever way make it more distinguishable from surrounding text? For example if the content of a post is like this… Reference site about Lorem Ipsum, giving information on its origins, as well as a random Lipsum generator.Reference site about Lorem Ipsum, giving information … Read more

How can i display the content in plaintext

i want to display my excerpt in plaintext. How can i do this? This is my Snippet where i display the content: <?php the_content(__( ‘Weiterlesen &rsaquo;’,’okay’)); ?> How i change the snippet to display the content in plain? greets, niklas 1 Use wp_strip_all_tags() to remove the content of script and style elements too: echo wp_strip_all_tags( … Read more

Split Content and Gallery

Is there a way to split up the post content and the gallery short code. I want to display the gallery outside my normal content no matter how or where it is placed. I can use this to get the shortcode itself: if(has_shortcode(get_the_content(), ‘gallery’)){ $pattern = get_shortcode_regex(); preg_match(“/$pattern/s”, get_the_content(), $matches); echo do_shortcode($matches[0]); } But this … Read more

apply_filters(‘the_content’, $content) vs do_shortcode($content)

Lets say I have a theme option or custom postmeta text area. Now I want to execute multiple shortcodes, general texts, images etc. What will be best practice and why? Option 1: $content = //my text area data; echo apply_filters(‘the_content’, $content); Option 2: $content = //my text area data; echo do_shortcode($content); Kindly explain me which … Read more