• Resolved mocha

    (@mocha)


    Where does the actual code for the function call the_content() reside when using the default theme (kubrick)? I have looked in /themes/default/functions.php and functions.php in the root directory.

    I ask because this function call is inserting div tags (snap_preview, entry) into index.php when called and I would like to control what div tags are used from the “normal” files.

    I hope someone is able to help, thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • It depends if it’s a post or page. It’s usually in both single.php and page.php

    Thread Starter mocha

    (@mocha)

    Yes, the call is used in both of those files but I’m looking for the actual code behind the function, not where the call is used.

    When viewing the page source for the main website the following code appears:

    <div class="entry">
    <div class="snap_preview">

    This additional code does not appear in index.php and seems to be the result of the the_content() function. I would like to edit this function to remove the above code.

    Vaughan

    (@vaughan-van-dyk)

    Hi,

    The code for the_content() is in the \wp-includes\post-template.php file. However, all it does is act as an interface for another function named get_the_content(), which is also located in that file. However, neither function that I can see includes those div tags you mention.

    You shouldn’t have to alter such core files to edit div tags etc., these are usually all generated from one of the theme files. Another way of checking this would be to load a different theme and see whether you get the same tags.

    I loaded the Default theme to check and couldn’t find any div tag labeled “snap_preview”, but the “entry” div tag is caused by the first line in the following block of code in \wp-content\themes\default\index.php:

    <div class="entry">
    <?php the_content('Read the rest of this entry &raquo;'); ?>
    </div>

    All the best.
    Vaughan

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    “snap_preview” and other things of that nature are inserted by plugins. Plugins have the ability to modify things like “the_content” and other template calls, on the fly. So really, there’s no one place to look for where the results are coming from, because they likely come from several places.

    Turn off the Snap plugin if you want it removed.

    Thread Starter mocha

    (@mocha)

    I meant to post this a few weeks ago and just forgot but I found out that when I write a post using the “Visual” editor, there is code automatically inserted into the post which includes “snap_preview”. The additional code appears at the bottom of the Visual editor (“p >> div.snap_preview” or something similar) when writing the post. It is possible to delete the addition of this code by deleting the “p >> div.snap_preview” line at the bottom of the editor box and can be avoided entirely by writing the post using the “HTML” editor. Even by turning off snap_preview and not using a plugin called Snap, this code was added regardless. Thanks for the replies!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘the_content() function call’ is closed to new replies.