In this Discussion

I've been using Presswork for a while now and quite happy with it. Although I've been trying really hard to add adsense after the post titles yet haven't been able to do it.

I put my adsense code in "loop.php" as shown below but still it shows above the post titles. Any help would be appreciated. Thank you.

----------------------------------------------------------------

<?php<br />/** * The loop that displays posts. * * The loop displays the posts and the post content. See * http://codex.wordpress.org/The_Loop to understand it and * http://codex.wordpress.org/Template_Tags to understand * the tags used in it. * * This can be overridden in child themes with loop.php or * loop-template.php, where 'template' is the loop context * requested by a template. For example, loop-index.php would * be used if it exists and we ask for the loop with: * get_template_part( 'loop', 'index' ); * * Includes all the action blocks for archives, pages and posts. * * @since PressWork 1.0 */?>

First of all, thank you for the answer. Earlier today I did try to adsense in that "actions.php" in my child theme and I had to use a FTP client to access and repair the site which crashed the theme (it has nothing to do with you... all my fault :D).

Since I use a presswork child theme I created a folder called "admin" and then put the "actions.php" file inside it (with my adsense code).

Now I don't know what went wrong and I did tried few times (each time putting adsense code in a different location in the "actions.php") but other than the site not being able to load (gives me php errors, etc) or other times when it loaded the site yet no adsense ads were seen.

So if you could please tell me where to put the adsense code (if i want adsense ads to display post titles) and where I have to put the "actions.php" file (concerning that I'm using a child-theme) I'd really appreciate it. Thank you.

I'm sorry to bother you like this but I just can't get this to work :/.

Here's what I did. Below is the complete copy of my actions.php file (except for the actual adsense code) that I put inside of my child theme and whether I remove the adsense code and just copy and paste the "single posts" php section inside to the actions.php, every time I get errors and the site doesn't load.

I can't download the file you appended, nor see the code but from what I saw before, the code is giving you errors because you use the same function that the PressWork theme uses.That's why I advised you to read here http://presswork.me/2011/custom-css-and-custom-actions/ (specially see the part "Customizing the 404 page:") to understand how custom actions work:

As you can observe you have to do remove_action before you can put your own code, so in your case first you should do this :

<?phpremove_action('pw_index_post_middle','pw_posts');// Then you create your own functionfunction my_custom_posts(){// paste hereafter all the rest of the code}add_action('pw_index_post_middle','my_custom_posts');// here we just registered your own function?>

If you can get it right, please post the code again so I can see it, I will put the whole code for you.

I tried to customize the new 'actions.php' file from scratch so I'd have adsense below the post title and and above the comments. But every time I put the newly created code, Wordpress refuses to render the site and gives a php error.

I guess it has something to do with me not closing the last '?>' (according to my limited knowledge. So if anyone can have a look at it and point out what I'm doing wrong, I'll really appreciate it. Thank you.

Here's the link to the file (sometimes the file attaching in the presswork-support doesn't work, that's why I've also uploaded it to filefactory :D).