php - Call/embed wordpress post outside loop? -


permalink of post set to:

<a href="/?link=<?php echo get_permalink( $postid ); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> 

by example comes this:

http://website.com/?link=http://website.com./post-example/ 

i want stay on home page, , need code embed content of http://website.com./post-example/, nice thing have post tag post-example.

by tag able call , embed post inside home page? $_get['link'] http://website.com./post-example/

now how call post?
solutions?
, should like:
if ?link=exist in url, call function (embed post title , content), otherwise nothing.

it seems have post's id. ($postid)

if have post's id , want display specific post can this:

<?php $my_special_post = get_post($postid, array_a); ?> 

after can display post's properties. example:

<?php echo $my_special_post['post_title']; ?> <?php echo $my_special_post['post_content']; ?> 

and place them in whatever html tags want.

the url segment "post-example" not tag. it's post's "slug" or post_name property. here can read more $post object , properties:

https://codex.wordpress.org/function_reference/$post

hope helps.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -