Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Sidebars & Widgets (http://forum.bytesforall.com/forumdisplay.php?f=14)
-   -   [SOLVED] New widget area after 1st excerpt (http://forum.bytesforall.com/showthread.php?t=22717)

timdevogel Aug 13, 2014 09:35 AM

[SOLVED] New widget area after 1st excerpt
 
Hi,

Is it doable to make a new widget area after the first excerpt in the center column and, if so, how do I do it?
I'm talking about the following site: www.elektroretailmagazine.nl

Cheers,
Tim

juggledad Aug 13, 2014 04:08 PM

One way would be to edit index.php and put some code in the loop to check if it is a multi post page and if the post count is 2 and then execute the new widget code

timdevogel Aug 14, 2014 01:29 AM

Goodmorning JD (at least, over here it's morning),

Thnx for the reply. 2 more questions: where can I see & learn what this code would look like and if I alter index.php, does this mean I'll have to do this after each theme update?

juggledad Aug 14, 2014 03:23 AM

the code would be something like this
HTML Code:

            <?php if ($bfa_ata_postcount == 2) { bfa_widget_area('name=middle widget area');} ?>
and yes you will have to update index.php after each update.

UPDATE: that line would go right after the line
HTML Code:

        <?php while (have_posts()) : the_post(); $bfa_ata_postcount++; ?>

timdevogel Aug 14, 2014 03:46 AM

Thank you very much JD.

Would working with a child theme solve this problem? If so, I guess I'll have to dig into that.

Cheers,
Tim

juggledad Aug 14, 2014 03:57 AM

not sure, you would have to try it out

timdevogel Aug 14, 2014 04:03 AM

Okay, thanks. I have some homework te do.

Cheers,
Tim

juggledad Aug 14, 2014 04:05 AM

there is a widget area at the top of the center area now but it will only work before the first post (and it is a theme option)

timdevogel Aug 14, 2014 04:15 AM

Yes, I know. But of course, that's too easy for me. I want it somewhere else, after the first (or second, or third...) excerpt.

timdevogel Aug 15, 2014 08:57 AM

Tried inserting the code you gave me in functions.php, but that resulted in a syntax error. Either I placed it in the wrong place or there's something wrong with the code. Could you check to see if it's the latter, JD?

juggledad Aug 15, 2014 11:30 AM

ummmm (warning: be prepared to give yourself a head slap) why don't you go back and read that post again about where I told you to put it

timdevogel Aug 15, 2014 12:05 PM

Oops, sorry. Guess it's Friday....

:o

timdevogel Aug 27, 2014 07:14 AM

Did everything you said, Juggeldad, but the widget won't appear....

juggledad Aug 27, 2014 07:26 AM

what is the exact code you used and where did you put it?

timdevogel Aug 27, 2014 09:17 AM

the code you gave me and the place you told me

juggledad Aug 27, 2014 09:59 AM

if you go to the dashboard->appearances->widgets is the widget area showing up?

if not, attach a copy of your index.php to a reply

timdevogel Aug 28, 2014 03:33 AM

Hi JD,
Solved it. Just a matter of putting the code in the right place.
Thanks!


All times are GMT -6. The time now is 03:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.