Viewing 6 replies - 16 through 21 (of 21 total)
  • @esmi: Amen.

    @mxpimp:
    It would seem as if you have everything you need now. It looks like you even got it figured out yourself. Good job. I would recommend rolling the homepage template we were editing earlier back to the original to avoid future issues. The pastebin on the original post was and still is, a complete mess.

    If I could give you one more suggestion. Now that we have that working properly, you don’t want to write out all the code to display the ads on index.php. Use get_template_part(). More info here.

    Thread Starter mxpimp47

    (@mxpimp47)

    ok i got it working. but I need just a little help cleaning up how this part is written –

    /* Set up and display AdRotate content */
                    if ($count % 5 == 0){                   // Returns True every 5th post
                            echo '<div class="boxed-mason col2"><div class="content-container">';
                            echo adrotate_ad(1);             // Displays Ads on Frontend
                            echo '</div></div>';
                    }

    its not wrapping those two divs around the adrotate correctly and its leaving theme open and breaking the layout. And the other post are inside of the opening divs. you can view the page an see what I am talking about.

    Thanks for helping me with this I really appreciate this a lot.

    Is ad rotate outputting an extra </div>? Comment out // echo adrotate_ad(1); and add </p>Hello World</p> below it on a new line. If that works okay, the issue is with adrotate_ad() function, which should be supported by the original developer.

    And for readability, change this line:

    echo '</div></div>';

    to this (updated, my bad.):

    echo '</div>' .PHP_EOL;
    echo '<!-- end content-container -->' .PHP_EOL;
    echo '</div>' .PHP_EOL;
    echo '<!-- close boxed-mason-->' .PHP_EOL;

    Thread Starter mxpimp47

    (@mxpimp47)

    Edit- the way I had it worked too as far as my previous post once I resolved whats below. But for better readability is it more appropriate to have it the last way you posted?

    After digging into it further it was within the adrotate ad settings, not an actual problem. Some how the closing tag for the url was left off and breaking the layout. But its up and running now.

    Thanks so much for the help with this. I appreciate it.

    One last question – any resources you recommend reading up on to help bridge the gap between wordpress and standard php usage? It takes a bit to figure out things or outside help or clarification when working with wordpress. I find standard php examples all the time. But sometimes I cant apply them cause I don’t know how to tweak it to work with wordpress functions etc…

    Again thanks for the help!

    No the readability thing isn’t necessary or anything, but I think adding a comment when you close a container div is sort of best practices. It’s really for other devs/programmers, so when they read your code, they can see what’s going on quickly and easily.

    As for resources, there are a lot, but none specific to

    help bridge the gap between wordpress and standard php usage.

    However, I will say this. There is nothing special about WordPress’ PHP.

    Thread Starter mxpimp47

    (@mxpimp47)

    Thanks. I just know that sometimes with all the necessary hooks for functions its is hard for me to wrap my head around sometimes.

    Thanks again for the help. The community has always got me through a hang up!

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘Need help modifying loop to display ads every few posts’ is closed to new replies.