Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #746380

    Hey,

    i try to use shortcode to call data from a custom post with custom fields.
    I can call the data on my page but the problem is that the genarated data is always on the start of the page.
    Can you point me out what is wrong?

    best regards,
    leRenaar

    #748330

    Hey leRenaar,

    I checked it and the problem is your shortcode [alto-posts], it should display (similar to echo) but only return the value, for example you have written it like this:

    function alto_posts_shortcode( $args ) {
      //some codes here
      ?>
        <div class="myclass">text here</div>
      <?php
    }

    it should be like this:

    function alto_posts_shortcode( $args ) {
      //some codes here
      $output = "<div class="myclass">text here</div>";
      return $output;
    }

    Try to rewrite your code to something like this and it should fix it :)

    Best regards,
    Nikko

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.