Thx for helping out … so how do i put the code:
<div id=”thumbnail”>
<?php the_post_thumbnail(); ?>
</div>
in the:
plugin_function_name
Im not a skilled programmor but ill give it a go.
So i need to define the put_thumbnail_in_content function in functions.php and and then place it in this: <?php add_filter( “the_content”, “plugin_function_name” ) ?>
Is this correct?
So i need to define the put_thumbnail_in_content function in functions.php
Yes. You then need to add add_filter( "the_content", "plugin_function_name" ); to the same file (most developers seem to add it just before or just after their add filter function).
In essence, you’re asking WP, to run the normal content filters and then add your custom code to the post content before it’s displayed on the page.
Something like this?
<?php
add_filter( “the_content”, “thumbnail_in_content” );
function thumbnail_in_content() {}
?>
<body>
<?php add_filter( “the_content”, “thumbnail_in_content” ) ?>
</body>
No. You don’t include any <body></body> tags. You’re only adding something to the post content – the bit that’s is generated by <?php the_content();?> in the theme template.
Look at the example in the Create_a_Filter_Function link I gave above.
The body tags was only to illustrate that the last bit was to be put in the body part of the the template whre the content is to be displayed ^^
So, so far its correct then?
The body tags was only to illustrate that the last bit was to be put in the body part of the the template whre the content is to be displayed
No. add_filter( "the_content", "thumbnail_in_content" ) has to be added to your function file.
Hehe thx for the patience, im sure i will get it eventually, just need to get my head around the basics.
So this is what ive got so far, and just to be sure. Am i on the right path?
<?php
add_filter( “the_content”, “thumbnail_in_content” );
function thumbnail_in_content() {}
?>
And this goes into the template.
<?php the_content (); ?>
So im guessing now i have to look at the function “thumbnail_in_content”.