0

I'm now deciding where should I put social media sharers. Currently, I'm now putting sharers code in entry-footer.php. But is it more semantic to put sharers in entry-footer.php, in the bottom of every post, or comments.php, being together with comment box in Wordpress?

Also, since the entry-footer.php is the default structure only for single post, is it reasonable to ask page.php to load entry-footer.php, too? Or should I just rewrite a block of sharer codes inside page.php? How about loading comments.php with sharer codes inside?

  • Why not just create a separate template part for the code, or a function, and then call it where it is needed??? – Pieter Goosen Oct 13 '15 at 8:27
  • @PieterGoosen I'm not pretty familiar with js code or php, but this is a good idea. So can I recall a sharer.php inside entry-footer.php? – chenghuayang Oct 17 '15 at 2:26
  • 1
    Yes you can. Just remember, js need to be enqueued via the wp_enqueue_scripts hook – Pieter Goosen Oct 17 '15 at 3:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.