I don't know php, I just edit it for my needs, please excuse my possible mis-use of terms. I think the fact I am searching for the wrong terms has made this difficult to find a solution for, which is why I am asking.
Basically I need to define a postid, then use it multiple ways.
$number = 455;
So above you can see the number of a postid.
Then within my templates I am using it as follows.
echo get_the_permalink( '$number' );
How do I make that work?
echo get_the_permalink( '455' );
^ works fine, but it means me typing that id a lot.
I don't know php, I just edit it for my needs, please excuse my possible mis-use of terms. I think the fact I am searching for the wrong terms has made this difficult to find a solution for, which is why I am asking.
Basically I need to define a postid, then use it multiple ways.
$number = 455;
So above you can see the number of a postid.
Then within my templates I am using it as follows.
echo get_the_permalink( '$number' );
How do I make that work?
echo get_the_permalink( '455' );
^ works fine, but it means me typing that id a lot.
Share Improve this question asked Aug 13, 2019 at 17:36 TimTim 31 bronze badge1 Answer
Reset to default 0When you use the variable, don't use the quotes. So it would be like:
echo get_the_permalink( $number );
You can also use:
echo get_permalink( $number );
or:
the_permalink( $number )
get_the_permalink() is an alias for get_permalink().
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745245753a4618403.html
评论列表(0条)