I have a functionality plugin to extend an existing (original) plugin. (Before I was just forking, but after the update of the original plugin it became clear that it is not a good practice.) I saved the code snippets I used when forking, and want to add them to the original plugin.
I found a hook here in the original plugin:
<?php do_action( 'es_wishlist_add_button', get_the_ID() ); ?>
And I'd like to place this code:
<?php if ( $es_settings->share_facebook ) : ?>
<a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=<?php the_permalink(); ?>"><i class="fa fa-facebook" aria-hidden="true"></i></a>
<?php endif; ?>
<?php if ( $es_settings->share_twitter ) : ?>
<a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=<?php the_permalink(); ?>"><i class="fa fa-twitter" aria-hidden="true"></i></a>
<?php endif; ?>
<?php if ( $es_settings->share_google_plus ) : ?>
<a class="a2a_button_google_plus" href="https://www.addtoany.com/add_to/facebook?linkurl=<?php the_permalink(); ?>"><i class="fa fa-google-plus" aria-hidden="true"></i></a>
<?php endif; ?><?php if ( $es_settings->share_linkedin ) : ?>
<a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/facebook?linkedin=<?php the_permalink(); ?>"><i class="fa fa-linkedin" aria-hidden="true"></i></a>
<?php endif; ?>
<?php if ( $es_settings->use_pdf ) : ?>
<a href="<?php echo add_query_arg( "es-pdf", get_the_ID(), get_the_permalink() ); ?>" target="_blank"><i class="fa fa-file-pdf-o" aria-hidden="true"></i></a>
<?php endif; ?>
I use this in the functional plugin's functions.php:
function epf_extra_buttons() {
echo '<?php if ( $es_settings->share_facebook ) : ?>
<a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=<?php the_permalink(); ?>"><i class="fa fa-facebook" aria-hidden="true"></i></a>
<?php endif; ?>
<?php if ( $es_settings->share_twitter ) : ?>
<a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=<?php the_permalink(); ?>"><i class="fa fa-twitter" aria-hidden="true"></i></a>
<?php endif; ?>
<?php if ( $es_settings->share_google_plus ) : ?>
<a class="a2a_button_google_plus" href="https://www.addtoany.com/add_to/facebook?linkurl=<?php the_permalink(); ?>"><i class="fa fa-google-plus" aria-hidden="true"></i></a>
<?php endif; ?><?php if ( $es_settings->share_linkedin ) : ?>
<a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/facebook?linkedin=<?php the_permalink(); ?>"><i class="fa fa-linkedin" aria-hidden="true"></i></a>
<?php endif; ?>
<?php if ( $es_settings->use_pdf ) : ?>
<a href="<?php echo add_query_arg( "es-pdf", get_the_ID(), get_the_permalink() ); ?>" target="_blank"><i class="fa fa-file-pdf-o" aria-hidden="true"></i></a>
<?php endif; ?>';
}
add_action('es_wishlist_add_button','epf_extra_buttons');
However, I do not receive the expected result. What do I do wrong?