The print_embed_comments_button() WordPress PHP function prints the necessary markup for the embed comments button.
Usage
print_embed_comments_button();
Parameters
- None
More information
See WordPress Developer Resources: print_embed_comments_button
Examples
Display Embed Comments Button in the Comments Section
This example shows how to display the embed comments button in the comments section of a post.
function my_theme_comments_template() { // Display comments wp_list_comments(); // Display the embed comments button **print_embed_comments_button()**; } add_action('comments_template', 'my_theme_comments_template');
Add Embed Comments Button to a Custom Comments Template
This example demonstrates how to add the embed comments button to a custom comments template.
function my_custom_comments_template() { // Display comments wp_list_comments(); // Display the embed comments button **print_embed_comments_button()**; } add_action('my_custom_comments_action', 'my_custom_comments_template');
Conditionally Display the Embed Comments Button
This example shows how to conditionally display the embed comments button based on whether the post has comments or not.
function conditional_embed_comments_button() { if (have_comments()) { // Display the embed comments button **print_embed_comments_button()**; } } add_action('wp_footer', 'conditional_embed_comments_button');
Display Embed Comments Button in a Custom Function
This example demonstrates how to display the embed comments button in a custom function that can be used in a theme or plugin.
function my_custom_embed_button_function() { // Display the embed comments button **print_embed_comments_button()**; }
Add Embed Comments Button to a Custom Hook
This example shows how to add the embed comments button to a custom hook that can be used in a theme or plugin.
function add_embed_comments_button_to_custom_hook() { // Display the embed comments button **print_embed_comments_button()**; } add_action('my_custom_hook', 'add_embed_comments_button_to_custom_hook');