Following Mark Kaplun advice, I fixed my problem. Just wish there was a way to like a comment.
<?php
$paragraphAfter = 1; // shows image after paragraph 1
$paragraphsShow = 1; // shows first two paragraphs
$content = apply_filters('the_content', get_the_content());
$content = explode('</p>', $content);
$max = (count($content) < $paragraphsShow) ? count($content) : $paragraphsShow;
for ($i = 0; $i < $max; $i++) {
echo **strip_tags($content[$i])** . '</p>';
if ($i == ($paragraphAfter-1)) {
} } ?>
Related Posts:
- Are content.php and content-single.php the same?
- How do I remove RSS feeds from themes?
- Responsive class to all the images in the content
- How to hide and content from auto-generated excerpts?
- the_content() in single-{post-type}.php problem
- Displaying recent post excerpts on static front page
- How to enable thumbnails in RSS dashboard widget
- Force Balance Tags not working
- How to place HTML tags in content from the_content()?
- Custom Blocks as part of a theme
- The Content is not Wraping in tag
- Edit value of the_content() before showing
- Why tags are displayed bellow the content and not inside
- Post and page content not displaying in search results
- How do I modify the ‘more’ link in a feed
- Single.php the_excerpt loads same as the_content not loading read more line
- pre_get_comments or the_content filter
- WordPress Load Only Page Text
- Unwanted empty line at the beginning of document
- Stop WordPress from showing images on non post pages
- Link to RSS feed not clickable?
- Getting post URL within custom content template
- Suppress the_content filter in a nested loop
- RSS feed url showing page not found. How to solve it?
- Confused on loading page content
- Return the_content() with custom div class for a subset of posts
- Software for WordPress Theme and Plugin Development? [closed]
- How to override pluggable function in theme?
- Should we use get_template_part() in functions files instead of include_once?
- Reset positions of metaboxes in admin
- Remove the word ‘Categories’ from wp_list_categories
- Using Bootstrap in themes
- Add a dropdown to theme customizer
- design and development workflow
- How to control initial wp_head() output?
- enqueue script for specific shortcode
- Any walker causes blank menu?
- How to change post thumbnail title and alt attributes to post title?
- Why might $input (Settings API) be coming through empty?
- add generated stylesheet from parent theme after child-themes style.css
- Creating Page Based on Category
- How to check if post has any tag?
- using wp_enqueue_script to attach jquery-ui
- Merging PHP download script into `functions.php`
- Can not Remove Archives and Meta from Sidebar
- Get last modified date for menu link
- How to add multiple custom widget areas
- A theme that follows all the best practices to learn from?
- WordPress how to override function adjacent_posts_rel_link_wp_head() in link-template.php the correct way
- Can wordpress run in root of existing php site with no theme on index.php but all other WP posts/pages?
- Change file name from wp_generate_attachment_metadata
- Change setting name in Customizer and keep the data
- CSS won’t style output of wp_nav_menu() correctly
- Creating multiple hooks for theme
- after_setup_theme, Global Variable and Theme Customizer
- How to make WP admin recognize a newly created child theme?
- Can’t show custom post thumbnail sizes as background images
- WP_Customize_Color_Control omitting # symbol
- Theme translation not applying
- How to add filter the post thumbnail before save in database?
- Custom theme development additional pages
- How to set the currently active page in the menu including parents
- changing blog title to an image using filter function in child theme
- What is the safe way to print tracking code / pixel code before tag or tag
- WordPress taxonomy and archive custom class
- Acivate all themes multisite wide automatically
- What is the meaning of WordPress’s recommended css classes and where are they applied?
- Would to use AJAX to get an option from the database and use it in a jquery setup or is there an alternative to consider?
- Website pagespeed problem
- Theme support title tag – how to replace the default WP separator (with a filter)?
- Why are some of my menu items not displaying on my menu?
- Managing WordPress Theme
- ajax response -1 in wordpress theme
- next_posts_link and previous_posts_link problem
- How to change footer credit text in Twenty Twenty One theme with a hook?
- Gutenberg theme development: how to add “headers” option under styles > colors > elements?
- How to override template files in parent theme?
- How to call a widget in a loop at a specific iteration value?
- Remove div element generated automatically from theme [closed]
- How to use the _S framework
- How to link to the page displayed by home.php?
- AJAX call fails when sending JSON but works with URL style string
- How to make excerpt image be full size instead of thumbnail?
- How to get a random single category name in get_posts()?
- WordPress theme files Organization
- Put CSS Content inside tag for WordPress
- How to display latest posts with authors image
- Menu names not getting translated
- How can I convert a list of title-posts into a sequence of comma separated text? [closed]
- Is it possible to issue a theme update that requires a new plugin?
- Get property of non-object on theme activation
- wp_editor some functionality not working on custom theme
- Update modified Shopify third-party theme [closed]
- Malformed RSS feed
- How to remove menu from WP-Admin menu
- apply_filters to featured image
- How do I move menu to the bottom in Custom Community theme?
- How do I get information about a page, such as featured image, except, and title?
- How do I make it super customisable?
- Theme.json: creating different sections of the color palette