Community Forums › Forums › Archived Forums › General Discussion › Dear members of this distinguished forum, I need your help!
Tagged: Corrected.
- This topic has 20 replies, 2 voices, and was last updated 9 years, 4 months ago by Fonte.
-
AuthorPosts
-
November 12, 2014 at 12:41 pm #131322FonteMember
Hello everyone, this is about Agency Pro
Can some of you tell me how can I have an full open sticky post above of excerpted posts in the home page of my blog?
Looking around in this forum I got the following snippets but it doesn't works 🙁
function dan_sticky_filter($content) { if(is_sticky()) $content = the_content(); return $content; } add_filter(‘the_excerpt’, ‘dan_sticky_filter’);
Can you help me with this please?
Thanks in advance for any advise
November 12, 2014 at 4:02 pm #131348LenParticipantHello Fonte. See if this helps. It's kind of what you're looking for. I think. http://sridharkatakam.com/displaying-latest-post-full-followed-excerpts-genesis/
November 16, 2014 at 3:42 pm #131775FonteMemberHello Len, thanks. I just got time to try this.
Unfortunately it broke my blog. But fortunately it is a test blog 🙂
The thing is that that piece has something wrong in it.
I got the following:
Parse error: syntax error, unexpected end of file in /home/comocr5/public_html/matriz.website/wp-content/themes/agency-pro/functions.php on line 216
This is the test blog: http://matriz.website/
Do you have an idea how can I fix it??
Thanks again buddy for any advise!
November 17, 2014 at 2:44 pm #131888LenParticipantHi Fonte.
unexpected end of file in
It seems like you're missing a closing "curly" bracket. Double check to make sure you copied/pasted the code from Sridhar's gist correctly. Also, make sure you're not copying directly from the embedded gist - use the View Raw link. You probably know that but I just want to rule it out.
Here is a test site using Sridhar's mod. http://dev.wpcanada.ca/
November 17, 2014 at 4:00 pm #131899FonteMemberWoow Len, you rock man! That's is exactly what I want.
I will try to do what you just said.
BTW this is what I bot from your link:
/* Show full content for the latest post and excerpts for the rest while respecting the Content archive limit and Featured image options in Genesis settings */
add_action('template_redirect', 'sk_full_content_latest_post_homepage');
function sk_full_content_latest_post_homepage() {if ( !is_home() || is_paged() )
return;// Prevent Genesis from outputting content. We still want other functions like genesis_do_post_image() to continue to work at this hook
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'sk_full_content_latest_post_homepage_loop' );}
function sk_full_content_latest_post_homepage_loop() {
global $wp_query;
if ( have_posts() ) : while ( have_posts() ) : the_post();
do_action( 'genesis_before_entry' );
printf( '<article %s>', genesis_attr( 'entry' ) );
do_action( 'genesis_entry_header' );
do_action( 'genesis_before_entry_content' );
printf( '<div %s>', genesis_attr( 'entry-content' ) );
do_action( 'genesis_entry_content' );// let's define the way content should be shown
// if current post is the latest
if ( $wp_query->current_post == 0 )
sk_do_post_content();
else
the_excerpt();
echo '</div>'; //* end .entry-content
do_action( 'genesis_after_entry_content' );do_action( 'genesis_entry_footer' );
echo '</article>';
do_action( 'genesis_after_entry' );
endwhile; //* end of one post
do_action( 'genesis_after_endwhile' );else : //* if no posts exist
do_action( 'genesis_loop_else' );
endif; //* end loop}
function sk_do_post_content() {
if ( genesis_get_option( 'content_archive_limit' ) )
the_content_limit( (int) genesis_get_option( 'content_archive_limit' ), __( '[Read more...]', 'genesis' ) );
else
the_content( __( '[Read more...]', 'genesis' ) );}
Do you see something wrong it it??
Thank you buddy for your valuable help 🙂
November 17, 2014 at 5:13 pm #131914LenParticipantIt's difficult to read that without the proper formatting but it *looks right. On my test site and simply added it to the end of the functions.php file.
November 17, 2014 at 8:18 pm #131929FonteMemberThanks Len. I tried but it broke my blog again.
Now the error message is different, it says:
Parse error: syntax error, unexpected '>' in /home/comocr5/public_html/matriz.website/wp-content/themes/agency-pro/functions.php on line 171
Seems that the problem is in this line: printf( ‘<article %s>’, genesis_attr( ‘entry’ ) );
So I will create the blog again and delete that thing before paste the code.
Thanks Len again for your support 🙂
November 17, 2014 at 8:40 pm #131936LenParticipantHave you added anything else or in any way modified the functions.php file?
November 17, 2014 at 11:06 pm #131949FonteMemberHi Len.
I didn't add anything else, all this error are from every new WP installation I do.Attempt 1, error in line 176: printf( ‘<div %s>’, genesis_attr( ‘entry-content’ ) );
Parse error: syntax error, unexpected '>' in /home/comocr5/public_html/matriz.website/wp-content/themes/agency-pro/functions.php on line 176Then attempt 2, error in line 185: echo ‘</div>’; //* end .entry-content
Parse error: syntax error, unexpected '/' in /home/comocr5/public_html/matriz.website/wp-content/themes/agency-pro/functions.php on line 185Attempt 3, error in line 185: echo ‘<div>’; //* end .entry-content
Parse error: syntax error, unexpected '>' in /home/comocr5/public_html/matriz.website/wp-content/themes/agency-pro/functions.php on line 185If I keeping doing this I will spend the whole night I think LOL...
November 17, 2014 at 11:37 pm #131954LenParticipantHi Fonte. This has something to do with the way it is being copy/pasted. I'm certain of it. Unfortunately there is only so much I can do from here in the forum. Tell you what, drop me a line using the contact form at my site.
November 18, 2014 at 12:14 am #131956FonteMemberHi Len, you said it and I got it now.
I use to do mouse copy/paste, now I learned something very useful FROM YOU, and from now on I will always copy/paste using Ctrl+C and Ctrl+V.Due to this little detail last week I lost a complete blog.
Hope this topic can help to someone else who may face the same issue than me 🙂
THANK YOU VERY MUCH LEN
November 18, 2014 at 12:21 am #131957LenParticipantYou're very welcome. Glad to see you got it sorted out.
Life is a never ending learning process. I learn something new every day simply by helping out here and reading other forum posts. 🙂
November 18, 2014 at 3:06 pm #132030FonteMemberYeah, totally right, we are always learning, and I thing that is what the life is about, keep learning and improving ourselves.
Len, I set the post as a sticky post in order to have an optin box in there.
Now is there a way to remove the post title and post info just from that post?
Maybe all I need is to add some line in the snippet. I spent some time looking around for info about this but with no luck.
Thanks Len.
November 18, 2014 at 5:03 pm #132050LenParticipantIf you set that post as sticky, WordPress will assign the class .sticky to it (which you can see if you view the source code) So, we can target that class in our CSS.
You could do something like,
.sticky .entry-meta, .sticky .entry-title { display: none; }
Perhaps I can suggest something else if I better understand what you are trying to do?
Let me see if I have this right. You have set the post as a sticky post which will contain an optin box. So this post is not necessarily a post? The only reason you have set it as a sticky post is so that it will sit at the top of the page? What you are really looking for is a method that allows you to have a piece of content sit at the top of the content area? Is that right?
November 18, 2014 at 6:49 pm #132053FonteMemberYeeessss, you got it perfectly right. That's what I want 🙂
Let me see if I have this right. You have set the post as a sticky post which will contain an optin box. YES
So this post is not necessarily a post? YOU RIGHT
The only reason you have set it as a sticky post is so that it will sit at the top of the page? YOU GOT IT
What you are really looking for is a method that allows you to have a piece of content sit at the top of the content area? YEAH
Is that right? You are incredible man, you really understand what Im looking for. This make me feel that someone understand 100% my issue, you made my day just with that Len.Thanks a lot buddy 🙂
November 18, 2014 at 8:50 pm #132062LenParticipantI kind of had a feeling that is what you were after? 😉
We can create a custom widget area & situate it above the content area. I have a couple of questions first.
1. Agency Pro comes with a widgetized front-page.php file. Will you be using this template file at all to display it's custom widgets or will you be sticking with the regular blog format?
2. After we create a new widget area (which will sit above the content area) do you want this widget area to appear on all pages or just the front page?November 19, 2014 at 1:00 am #132080FonteMemberYou got it 100% haha... That great, thank you!
I want it to appear just in the front page, and sticky with the regular blog format. That will be awesome to achieve 🙂
November 19, 2014 at 1:38 am #132087LenParticipantHi Fonte. This is what I did on the test site. http://dev.wpcanada.ca/
It has a new widget area that appears above the content area and only on the front page. The styling matches the After Entry widget area which already comes with the theme. (You can style that any way you want) And I got rid of all the code I pointed you towards earlier.
Is this what you are after?
November 19, 2014 at 2:07 pm #132178FonteMemberHi Len, thanks again.
Yeah, that's what I'm after, but the only thing is that I'm not clear how do I place that widget in there?
November 19, 2014 at 3:26 pm #132205LenParticipantNot a problem, I have everything here for you. I just wanted to first make sure this is what you want. 🙂
We'll be editing 2 files:
- Agency Pro's style.css file
- Agency Pro's functions.php file
First Step:
Open Agency Pro's style.css file in a plain text editor and add the following .../* Before Entry --------------------------------------------- */ .before-entry { background-color: #fff; border-radius: 3px; margin-bottom: 40px; padding: 40px; text-align: center; } .before-entry .widget { margin-bottom: 40px; } .before-entry .widget:last-child, .before-entry p:last-child { margin: 0; } .before-entry li { list-style-type: none; }
To keep things organized you could add that right before this section (which is already there) ...
/* After Entry --------------------------------------------- */
Second Step:
We'll be making 2 edits to Agency Pro's functions.php file. Open that file in a plain text editor and add the following ...//* Add Before Entry widget area to front page add_action( 'genesis_before_loop', 'agency_before_entry' ); function agency_before_entry() { if ( ! is_front_page() || get_query_var( 'paged' ) >= 2 ) return; genesis_widget_area( 'before-entry', array( 'before' => '<div class="before-entry widget-area">', 'after' => '</div>', ) ); }
The above will place the new widget area, which I called Before Entry, above the content area using the genesis_before_loop hook and it will appear on the front page only.
It doesn't matter where in the functions.php file you put it. For the sake of organization and to keep things neat & tidy you could put it right above this bit ...
//* Add support for after entry widget add_theme_support( 'genesis-after-entry-widget-area' );
Next, scroll down towards the bottom where you will see this ...
//* Register widget areas
Somewhere beneath that add the following ...
genesis_register_sidebar( array( 'id' => 'before-entry', 'name' => __( 'Before Entry', 'agency' ), 'description' => __( 'This is the Before Entry widget area.', 'agency' ), ) );
-
AuthorPosts
- The topic ‘Dear members of this distinguished forum, I need your help!’ is closed to new replies.