Status
Not open for further replies.

Divvy

Active Member
806
2009
18
0
Hi guys,

I need a little help here, can someone help me? :)

I'm trying to make an specific widget to appear in my blog frontpage only, but I cant figure out...
I already tried plugins like Widget Logic but didn't worked.
I know that I need to use is_home() or is_frontpage() in the code but it seems that nothing works.

My theme already have a section to add widgets in homepage, but it seems that is not working, because the widgets appears in pagination (only I think) too...

8CFzefJ.png


Here are some code of my theme:

functions.php
Paste2.org - Viewing Paste YVx8fbvK

sidebar.php
Paste2.org - Viewing Paste WYNYxknX

Can someone give me a solution, please? :)

Thanks!
 
4 comments
for what you need use widgets? much better way, drop all you widgets, and code you own sidebars, widgets make site just slowly. you can make you own php, and you can use another sidebars on every page, category, signle posts, pagination, etc etc.

if you have big traffic, widgets - thats bad way, many queries for nothing


tag cloud and everythong else, thats simple codes, you not need widgets for this. ifm you use just normal widgets, you can write everything with you own codes to you own sidebars, you not need a widgets.

some like this

on sidebar.php

<?php
if (is_paged()){include (TEMPLATEPATH . '/sidebar-1.php');
}
else if (is_home()){include (TEMPLATEPATH . '/sidebar-2.php');
}
else if (is_single()){include (TEMPLATEPATH . '/sidebar-3.php');
}
else if (is_archive()){include (TEMPLATEPATH . '/sidebar-4.php');
}
else { include (TEMPLATEPATH . '/sidebar-5.php');
}
?>

and make own sidebar-1.php
sidebar-2.php
etc
etc

and end of every page call <?php get_sidebar(); ?> before you call footer.


for example, al tag cloud widget you can write with one row code))

Function Reference/wp tag cloud « WordPress Codex

http://pastebin.com/m0UiYHSw
and define all on you css, for this one row code you not need use widget, for example
 
Last edited:
tembel, thank you for your reply and for your great help!
Im going to create a note with your suggestion.

But for this website in particular, I really need a fix.
Can you help me with this? :)
 
send my PM with you URL and what you need, but i can see this only after this weekend, monday or some like this. Im running some WP websites , maybe i can help you.
 
Thank you buddy!

If I don't have this fixed by Monday, I will send you the PM with details, thank you for your help offer! :)

I think the solution is in this part of the code of functions.php file:

PHP:
function wptThemeRegisterSidebars() {
register_sidebar(array(
'name' => 'Main Page',
'description' => 'Widgets will be shown on the main page',
'before_widget' => '<div class="side_cont"><div class="side_cont_top"><div class="side_cont_bttm">',
'after_widget' => '</div></div></div></div>',
'before_title' => '<div class="side_title">',
'after_title' => '</div><div class="side_content">',
));

Or here in sidebar.php file:

PHP:
if ( is_single() && is_active_sidebar( 2 )) {
dynamic_sidebar(2);
} else if ( is_home() && is_active_sidebar( 1 )) {
dynamic_sidebar(1);
} else if ( is_page() && is_active_sidebar( 3 )) {
dynamic_sidebar(3);
} else {
dynamic_sidebar(4);
}

Can someone help me please? :)

Note: The strange part is that this is kind of working to show in index only. Except in pagination... when I go to any page, the widget appears and is not supposed to.

__________________
Added after 17 Hours 47 minutes:

Anyone please? :)
 
Last edited:
Status
Not open for further replies.
Back
Top