• Hi

    I want to add a piece of shortcode to the end of every page on my site. Currently I have around 1200 pages and I am thinking it will take some time to do this one page at a time. Is it possible to do this through the database using PHPMyAdmin please? It is in WP_Posts, WP_Content. I am going to try something like this:

    $query = "
    INSERT INTO <code>databasename</code> <code>databasetable</code> (

    post_content’); “;
    mysql_query($query);
    echo ”
    The piece of shortcode
    “;`

    I am concerned that it will delete post content rather than add to the end.

    Thanks

    Rich

    • This topic was modified 2 years, 5 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 3 replies - 1 through 3 (of 3 total)
  • Edit footer.php file inside the theme folder you are using and use the below code
    <?php echo do_shortcode(“[name_of_your_shortcode]”); ?>

    in the place of name_of_your_shortcode you need to put your shortcode name

    • This reply was modified 2 years, 5 months ago by Dinesh Pilani.
    Thread Starter Richard Brown

    (@cregy)

    Thanks for the help.

    I was hoping to place it at the foot of the contents of a page. If I place it in the footer do I then leave this code in place or can I run it once and it will add the necessary details permanently?

    Thanks

    Rich

    Thread Starter Richard Brown

    (@cregy)

    I am using the Genesis theme framework.

    I am thinking that I could add the shortcode to the functions.php file and place it in genesis_after_post_content.

    Would that work please?

    Thanks

    Rich

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding code to the end of every page’ is closed to new replies.