Archived topic
What is the Permalink PHP code on Generate Press theme?
7 replies · Started by Sibi Paul on January 20, 2021
Hi...
I would like to add Facebook comments to my site.
<div class="fb-comments" data-href="<?php the_permalink();?>" data-width="100%" data-numposts="5"></div>
I want to replace <?php the_permalink();?> with Correct generate Press code.
Thanks.
Hi there,
Themes have no say over the permalinks - WordPress handles it.
If that element needs the current URL of the page to be displayed in that data attribute, then you're already doing it right :)
When I replace this <?php the_permalink();?> with current URL...
Then, FB Comments are Visible...
But...
When I use that code for Dynamic URL Pickup, it won't work.
for your Info...
My site home directory having TagDiv's Newspaper Theme
But, I created an Additional Directory for generate press.
(site details added below)
Are there any instructions for what you're trying to do? Do they suggest using the_permalink()?
Hello everyone, I have that same problem.
<? php the_permalink ();?> does not work for facebook comments to show on all posts.
For now the only thing that works for me is to add an HTML to each post with the url of the post
<div class = "fb-comments" data-href = "https: // misite / post1 /" data-width = "100%" data-numposts = "10"> </div>
If anyone knows how to avoid this I would be grateful for your help.
Regards.
Hi gulhio,
Can you try this?
<?php $current_url = home_url($_SERVER['REQUEST_URI']);
echo $current_url; ?>
or this
<?php echo get_permalink();?>
If it doesn't work, Can you open a new topic for this? So you can use the private information text field to link us to the site in question so we could check.
it worked perfectly
Nice one. glad you got it sorted. :D