Community Forums › Forums › Archived Forums › General Discussion › Help with coding Magazine pro
Tagged: Magazine Pro php header image
- This topic has 13 replies, 2 voices, and was last updated 9 years, 11 months ago by jourdain.
-
AuthorPosts
-
May 2, 2014 at 12:58 pm #103356jourdainMember
Hi Guys and Girls, I have a couple of questions that I hope you guys can help me with.
A little about me, I am familiar with html and css and have created a few sites. On the other hand I am not that good with php (I'm working on it)
Link To site: http://creativefreaks.co.uk/
So here is what I would like to do:
Firstly I would would like to remove the site title (creative Freaks) and replace it with a static image that is centralised. This will be my logo.
Secondly I was wondering if there was a way I could add a featured article to the content archives pages similar to the homepage. I would also like to be able to set the article to what i like and not just the most recent post.
If you could point me in the write direction or know how this could be achieved then any help is appreciated.
Thanks to all replies in advance
Jourdain
http://creativefreaks.co.uk/May 2, 2014 at 9:30 pm #103387Brad DaltonParticipant1. Go to Appearance > Header and upload your logo.
You can change the dimensions in your style sheet under the Site Header section.
2. You can hook in a new widget area into any archive
Change the conditional tag from is_front_page() to is_archive(archive-slug)
May 3, 2014 at 3:11 am #103425jourdainMemberI can't believe I missed that header option in the settings! Thanks for that.
I have hooked a new widget are into the archive page ( http://creativefreaks.co.uk/category/inspiration ) but I have a few questions before I proceed.
1. Does the widget need to styled or should it take on the themes styling? I just want to make sure I have not made a mistake.
2. I was hoping to have a different featured post for each archive category, is this possible?
3. Can the widget be removed when the user clicks through to page 2 of the archive?
If you could point me the write direction and I will learn/teach myself.
Thanks again
Jourdain
May 3, 2014 at 4:14 am #103428jourdainMemberI have worked out question number 2.
I have used ( is_category( 'tutorials' ) in order to display on a single category page. Then I will just hook a new widget in for each category page. Does this sound ok?
Jourdain
May 3, 2014 at 4:16 am #103429Brad DaltonParticipant1. You would style it depending on what you populate it with. You could grab the classes from an existing widget in your functions file and use the same classes in your custom widget.
'before' => '<div class="after-entry">',
2. Try the Genesis Featured Posts Widget.
3. You can control the widget so it only displays on the first page of the archive by using:
(i) A conditional tag after the function
is_paged()
https://codex.wordpress.org/Conditional_Tags#A_Paged_Page
(ii) Or a query variable
get_query_var('paged') == 1)
http://codex.wordpress.org/Function_Reference/get_query_var
May 3, 2014 at 12:10 pm #103476jourdainMemberAgain thanks for your help, I have one other question about the formatting.
I would like to style the widget in the same way the home page is styled with the sidebar in line with the featured post widget. Is there anything I need to consider in order to achieve this?
Jourdain
May 3, 2014 at 1:58 pm #103485Brad DaltonParticipantThe hook position and use the dame class as the widget on the home page.
Any of these hooks
genesis_before_loop genesis_loop loop_start genesis_before_entry
Absolutely. Rinse and repeat as they say but do change both instances of the function name in the code.
May 4, 2014 at 7:31 am #103576jourdainMemberI am having trouble adding a conditional tag after the function.
I have tried adding the is_paged code in many ways using tutorials and WordPress codex you linked but each time I break break my site. So I am defiantly doing something wrong.
This is what the code currently looks like for your reference.
genesis_register_sidebar( array( 'id' => 'new-widget', 'name' => __( 'Featured Tutorials', 'domain' ), 'description' => __( 'Add Content Here', 'domain' ), ) ); add_action( 'genesis_before_loop', 'your_widget' ); function your_widget() { if ( is_category( 'tutorials' ) && is_active_sidebar('new-widget') ) { genesis_widget_area( 'new-widget', array( 'before' => '<div class="home-top widget-area">', 'after' => '</div>', ) ); }
Link: http://creativefreaks.co.uk/category/tutorials
Secondly, the widget title styling did not transfer over. I was wondering if I need to add something to the code for that to be pulled? I can change it with css but I am just curious.
Jourdain
May 4, 2014 at 3:12 pm #103622Brad DaltonParticipantYou need to add another closing curly bracket at the end of the code as you have add an opening one at the end of the line which includes the conditional tag.
You can change the home-top class in the code or style each widget differently using CSS
May 4, 2014 at 5:02 pm #103629jourdainMemberI am stumped with this one, sorry for being a total newb but I cant figure it out.
her is the code.
genesis_register_sidebar( array( 'id' => 'new-widget', 'name' => __( 'Featured Tutorials', 'domain' ), 'description' => __( 'Add Content Here', 'domain' ), ) ); add_action( 'genesis_before_loop', 'your_widget' ); function your_widget() { if ( is_category( 'tutorials' ) && is_active_sidebar('new-widget') ) { if ( is_paged() ) { } genesis_widget_area( 'new-widget', array( 'before' => '<div class="home-top widget-area">', 'after' => '</div>', ) ); } }
What else needs to be added to the code so the widget is only displayed on the 1 page of the archive.
Thanks in advance.
May 4, 2014 at 5:29 pm #103630Brad DaltonParticipantRemove this:
if ( is_paged() ) { }
If you want to add another conditional, add it like this:
if ( is_category( '007' ) && is_active_sidebar('new-widget') && is_paged() ) {
Or like this:
if ( is_category( '007' ) && is_active_sidebar('new-widget') || is_paged() ) {
Change 007 to the tutorials category i.d
May 5, 2014 at 3:56 am #103683jourdainMemberI added the code in like you said and it now looks like this
if ( is_category( 'tutorials' ) && is_active_sidebar('new-widget') && is_paged( '') ) {
The only problem is that it has had the reverse affect. I would like the widget to only appear on page 1 and not subsequent pages. However, at the moment it does not appear on page 1, but does appear on pages 2, 3, 4, 5 ...
Is there a way to fix that?
Link to tutorials page: http://creativefreaks.co.uk/category/tutorials
May 5, 2014 at 2:30 pm #103745Brad DaltonParticipantMay 5, 2014 at 2:48 pm #103750jourdainMemberAMAZING!!!
Thanks for your help and patience buddy, it is working correctly now.
Jourdain
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.