• I have included the following code in the footer of the template file

    <?php echo getPageContent(65); ?>

    what it does is that it display the content of the pages on the footer based on the pageid.

    The code for the function getPageContent which has been included in the theme function.php file is as follows
    [Code moderated as per the Forum Rules. Please use the pastebin]

    Now the problem is that it is breaking the layout structure of my theme. So now i want that i should restrict the content on the footer to certain nos of words like in the excerpt and the_content. What modification should i do in the above codes?

    I need the following :
    1) I should able to provide the pageid in the template footer.php file and no’s of words to show and that it and the same should be displayed on the footer.

    2) It should ignore the HTML tags and images.

    Please advice.
    `

Viewing 2 replies - 1 through 2 (of 2 total)
  • srtip_tags($post->the_contect); will strip the tags.

    And something like this to restrict the number of characters (50 in this example) –

    $my_content = srtip_tags(sub_str($post->the_contect, 0, 50));

    strip_tags(); will accept a second paramater that is an array of tags to not strip, if you so desire.

    Thread Starter dipaksaraf

    (@dipaksaraf)

    The codes got stripped due to forum rule, Please find the codes included in the function.php

    https://pastebin.com/HA4BT6Gp

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Trimming the pages content and displaying in footer’ is closed to new replies.