-
wordpressuser1
Hi, I am trying to manually at Jetpack’s “share” buttons to a specific area on my website. I am following their tutorial here: https://jetpack.com/support/sharing/
They said to add this to the area I want to display it:
if ( function_exists( ‘sharing_display’ ) ) {
sharing_display( ”, true );
}if ( class_exists( ‘Jetpack_Likes’ ) ) {
$custom_likes = new Jetpack_Likes;
echo $custom_likes->post_likes( ” );
}
add_action( ‘loop_start’, ‘jptweak_remove_share’ );Right now, I want it displayed below my H1 title – however, I would like to create an element so I can have flexibility in where to display it. Do you know how I can show this PHP code on the front-end, in the place I want it? Adding it as a “Code” block just shows the text on the front end. Would converting this block of code into a shortcode work, or does generatepress include a good way to display PHP?
Thanks so much!
-
Fernando
Hi there,
You can add it through a Hook Element.
Just place it inside
<?php
and?>
and enable “Execute PHP”.You can create a Portable Hook so you can define a specific hook location. Creating a Portable Hook: https://generate.support/topic/create-a-shortcode-for-an-element/#post-38707
- You must be logged in to reply to this topic.