Display ads in categories

Community Forums Forums General Discussion Display ads in categories

This topic is: resolved

Tagged: 

This topic contains 7 replies, has 3 voices, and was last updated by  rammen 9 months, 3 weeks ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #48350

    rammen
    Participant
    Post count: 7

    Hi,

    I want to display specific ads in specific categorie-pages. Let’s say a viewer click on “technology” and it shows all the articles related to technology. I then want to display a ad after, lets say three expert articles, that is related to technology. How can i do that? Do i need to add something in functions.php?

    I use genesis featured widget amplified to solve this in my main page, but how can i do it in categorie-pages?

    Im thankful for any help i can get.

    http://www.finanssans.no
    #48462

    braddalton
    Participant
    Post count: 7473

    Hook in a custom widget area using the conditional tag for a category:

     if (is_category('technology') ) {
    

    Change the hook position if needed.


    WordPress Developer & Consultant
    Brad Dalton400+ StudioPress Tutorials & 1200+ Code snippets

    #48577

    rammen
    Participant
    Post count: 7

    Thanks! That worked. But I still don’t get ads to only appear after post #3. When i use genesis_after_post the ads display after all posts.. I only want it to display after posts #3.

    Do i need to add something in this line: if (is_category(‘technology’) && is_active_sidebar( ‘custom-widget’ ) ) { ?

    #48593

    Summer
    Participant
    Post count: 755

    The way I got something similar to work was to have 2 instances of Genesis Featured Posts Amplified, using the offset.

    So in the sidebar that Brad’s code created, you’d have something like this:

    Genesis Featured Posts Amplified widget (showing only 3 posts)
    Text Widget (containing the code for your ad)
    Genesis Featured Posts Amplified widget (same config as first GFWA, but offset by 3 posts)


    #48602

    braddalton
    Participant
    Post count: 7473

    You can do this and i have answered a question similar to yours before about how to do this which involves adding a variable to the code. Just can’t find it at the moment.


    WordPress Developer & Consultant
    Brad Dalton400+ StudioPress Tutorials & 1200+ Code snippets

    #48637

    rammen
    Participant
    Post count: 7

    Summer: I use that method at the front page. But my problem in categories-page is that it automatically show the last 6 posts in that category, and then the amplified widget on top of that. I know how i can adjust how many post there is in categories, but how can i remove it, and let genesis featured post amplified do all the work?

    I also wondering about how i change the widget text. If i am going to use this method, i need different names for all the categories. Now it is “Custom Widget”.

    Braddalton: If you find the variable, please let me know. It makes is so much easier.

    Again, thanks for all the help!

    #48655

    braddalton
    Participant
    Post count: 7473

    You can tag the posts you want to display ads on and then use the conditional,

     if ( has_tag ('your_tag')  ) { 

    WordPress Developer & Consultant
    Brad Dalton400+ StudioPress Tutorials & 1200+ Code snippets

    #48677

    rammen
    Participant
    Post count: 7

    Works like a charm! Thanks for your help.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.