anonymized-13749270
(@anonymized-13749270)
thing is, i wanna show this code only in the “page 1” of my posts.
How is pagination slug working for your posts?
1. site.com/hello-world/page/1/
$url = $_SERVER["REQUEST_URI"]/* or get_the_permalink() for single posts*/;
if(strpos($url,"page/") != '' && strpos($url,"page/1" ) != '')
echo "Let's do it!";
2. site.com/hello-world?page=1
if(!isset($_GET["page"]) || isset($_GET["page"]) && $_GET["page"] == "1")
echo "Let's do it!";
thanks, but its: 1. site.com/hello-world/1/
anonymized-13749270
(@anonymized-13749270)
Oh. then maybe this would work:
global $post;
$url = $_SERVER["REQUEST_URI"]/* or get_the_permalink() for single posts*/;
if($url == home_url( '/' ).$post->post_name || strpos($url,$post->post_name."/1" ) != '')
echo "Let's do it!"; // do something here, condition: request uri is site.com/hello-world/ or site.com/hello-world/1/ only, so site.com/hello-world/2/ and other pages are eliminated
Let me know how it goes.