开发者

Include post in page (wordpress)

开发者 https://www.devze.com 2023-01-13 22:55 出处:网络
I like to know if there is a way to include post INLINE in the editor in wordpress Here is an example as i like it to work :

I like to know if there is a way to include post INLINE in the editor in wordpress

Here is an example as i like it to work :

bla bla bla... pic pic pic.. bla bla bla {get_me_the_post_number(245)} more bla bla bla more picture...

So that can make my life easier that tweaking the template or getting the widget to w开发者_运维问答ork.. in fact i looking for a way to include php or execute query in WYSIWYG editor


Here is what i have found and test

1) ggis-InlinePost gives authors an easy way to insert a post within a page or another post. Simply add [ggisinlinepost id=”%id”] to your post. There are a few attributes to control the display of the inlined post’s title, content, metadata, and separators.

it's a old plugin, update recently.... wirk great... some option... bizzare wording to used

2) InlinePost is a Wordpress plugin that lets you create pages that contain static content. the problem is it's a 2007 plugin.. quite old... but it work great.. almost no options !

I supposed i will use the firs one, more option... and update recently !

having the possibility to inline php is on what i have read a security risk !


You can use a new query in the post/page editor with php enabled (or directly in a page template with no need for php execution) so show a single post by ID, i.e. the post with ID 101:

<?php $my_query = new WP_Query('p=101'); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
<?php the_title(); ?><?php the_content(); ?></a>
<?php endwhile; ?>

This query can be used multiple times inside the standard WP loop without conflict, either in the page/post editor on in a page template, or without the standard WP loop in a page template.

Use Exec-PHP « WordPress Plugins or others for php execution in the page/post editor.

0

精彩评论

暂无评论...
验证码 换一张
取 消