• Hi I was wondering if is possible to query post content but separate 3 parts on the same page, so that after a certain ammount of words or character cuts the text and add an image then under the image continue the rest of the text

    function
    limit by 11th word then cut and display template image
    [this is some text the rest should continue after the image]
    [image]
    [this is the rest of the text]
    display content start after the 12nd word
    thne add a read more

Viewing 1 replies (of 1 total)
  • you can add a filter for the_excerpt and in your function define what you want it to display

    something like:

    function showMyStuff($content) {
      if (!in_the_loop()) return $content;
      $words = explode(" ",strip_tags($content));
      $mycontent = "";
      for ($i=0;$i<11;$i++) $mycontent .= $words[$i]." ";
      $mycontent .= <your image>;
      return $mycontent;
    }
    add_filter('the_excerpt','showMyStuff');

    that’s very basic, but you get the jest of it

Viewing 1 replies (of 1 total)
  • The topic ‘is it possible to separate post text’ is closed to new replies.