• I am trying to get a link at the bottom of every post that would return the user to my homepage.
    I have tried a content filter that modified my content.php file.

    That works but it leaves me with this at the bottom of my category pages:

    add_filter (‘the_content’, ‘ Home Page ‘); }

    On categories I show 2 excerpted posts. The full posts look fine but the pages with excerpts have that little bit of code.

    Is there a way to fix this or is there another way to put bulk add a homepage link to every post? Maybe a content filter is not the best way to do this.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Try using on your functions file:

    add_filter( 'the_content', 'home_link_add' );
    function home_link_add( $content ){
      $home = '<p class="home-link"><a href="' . esc_url( home_url( '/' ) ) . '">Home Page</a></p>';
      return $content . $home;
    }

    Thread Starter lucabrasi40

    (@lucabrasi40)

    Thanks. I appreciate it doubly because it works

    Thread Starter lucabrasi40

    (@lucabrasi40)

    Is there anyway to change the text “Home Link” to my “blog’s name”

    Thread Starter lucabrasi40

    (@lucabrasi40)

    Never mind, I found it. Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding a link to my homepage after every post’ is closed to new replies.