Page 1 of 2

Featured Content / Magazine Template

Posted: 22 Jan 2010, 11:24
by pmkelly
Great theme! It has really given me a lot of power and control over my website, and it looks wonderful right out of the box.

I guess this is a combination bug report and feature request. I am running into an issue with Featured Posts and the way it interacts with the Magazine Template. My website is set up to have a separate Home page from the primary Blog page (Settings->Reading->use static page). I am using the Magazine Template for the home page, but not for the Blog page. I would like to see the Featured Posts on the home page, but not the Blog page. Unfortunately, it seems like I can only have it in (A) both places; or (B) neither.

I *believe* the correct settings for this setup would be to:

[Templates->Magazine] Enable Featured Posts on magazine template ENABLED
[Blog Features->Featured Content] Enable Featured Posts on main (default) pages DISABLED

The result of this setup, though, is an empty box on my Home page where the Featured Posts should be. So the only way I can get it to actually show up on the Home page is to turn both of these settings on, but that results in the Featured Posts box also appearing on the Blog page:

[Templates->Magazine] Enable Featured Posts on magazine template ENABLED
[Blog Features->Featured Content] Enable Featured Posts on main (default) pages DISABLED

You can view my website here, and you should see what I am dealing with (although I am actively editing the site as we speak, so it may be changing at regular intervals):

Home Page = http://www.pmkelly.com
Blog Page = http://www.pmkelly.com/blog

On a side note, another option that would be nice to have would be to located the main page content *above* the Featured Post box. Right now, the main page content (if enabled) always displays below it.

Thanks for any help, ideas, or suggestions!

Pat

Re: Featured Content / Magazine Template

Posted: 22 Jan 2010, 12:14
by pmkelly
As a followup, it seems that this issue may not be tied to the Magazine Template. Under the Blog Features -> Featured Content panel, if I disable the first item (Enable Featured Posts on main (default) page), and then select specific pages to display the Featured Content (Featured Posts - Static Pages with Featured Content), then I see the same behavior on the selected pages. That is, a box shows up where I assume the Featured Posts would go, but it shows up empty.

Re: Featured Content / Magazine Template

Posted: 22 Jan 2010, 12:55
by sayontan
Typically an empty box means that there JQuery Cycle failed to start. If you can point me to a link where you are seeing the blank box I might be able to help. Also, can you list out all the settings that you have done on the Featured Content section? Certain combinations there have a weird way of working out, at times.

Re: Featured Content / Magazine Template

Posted: 22 Jan 2010, 13:18
by pmkelly
OK, so I have made some changes, and you can see the blank box at the top of my the home page and my "test" page:

http://www.pmkelly.com
http://www.pmkelly.com/test

The settings from the Featured Content panel are given below (I should mention that I am indeed using the latest version of Suffusion that was released in the past couple of days):

Enable Featured Posts on main (default) page - DISABLED
Enable Featured Posts on the Category view - DISABLED
Enable Featured Posts on the Tag view - DISABLED
Enable Featured Posts on the Author view - DISABLED
Enable Featured Posts on the Search view - DISABLED
Enable Featured Posts on the Time archive view - DISABLED

Featured Posts - Number of Posts 7
Featured Posts - Show Sticky Posts - ENABLED
Featured Posts - Show Latest Posts - DISABLED
Featured Posts - Number of Latest Posts 5
Featured Posts - Select Categories [ selected one category - "Website Design" ]
Featured Posts - Select Pages [ selected one page - "Family Tree" ]
Featured Posts - Static Pages with Featured Content [ selected "Test" ]

I'm guessing the others are not relevant, but I think they were left at their default values anyway.

With this current configuration, Featured Content does not appear anywhere on the website, and an "empty box" sits at the top of my home page and the test page. If I simply turn on the first option (Enable Featured Posts on main (default) page), then the Featured Content appears on three pages (Home, Blog, and Test).

Thanks!

Re: Featured Content / Magazine Template

Posted: 22 Jan 2010, 15:12
by sayontan
Interesting - your problem seems to be something I haven't seen earlier. I will try to replicate it and let you know.

Re: Featured Content / Magazine Template

Posted: 22 Jan 2010, 18:03
by pmkelly
Sounds good. I am going to go ahead and change some things around on my site again, but if you need me to demonstrate the issue again, just let me know. Thanks!

Re: Featured Content / Magazine Template

Posted: 23 Jan 2010, 04:18
by sayontan
Okay, here is the fix. Open the file actions.php and look for the method suffusion_include_featured_js(). Replace its contents with this:

Code: Select all

function suffusion_include_featured_js() {
	global $suf_featured_interval, $suf_featured_fx, $suf_featured_excerpt_type, $suf_featured_category_view, $suf_featured_tag_view, $suf_featured_search_view;
	global $suf_featured_author_view, $suf_featured_time_view, $suf_featured_index_view, $suf_featured_transition_speed, $suf_mag_featured_enabled, $suf_featured_pages_with_fc;
	$pages_with_fc = explode(',', $suf_featured_pages_with_fc);
	$page_id = $post->ID;
	if ((is_category() && $suf_featured_category_view == "enabled") || (is_tag() && $suf_featured_tag_view == "enabled") ||
		(is_search() && $suf_featured_search_view == "enabled") || (is_author() && $suf_featured_author_view == "enabled") ||
		(is_page_template('magazine.php') && $suf_mag_featured_enabled == 'enabled') ||
        (is_page() && $pages_with_fc && is_array($pages_with_fc) && in_array($page_id, $pages_with_fc)) ||
		((is_date() || is_year() || is_month() || is_day() || is_time()) && $suf_featured_time_view == "enabled") ||
		(!(is_category() || is_tag() || is_search() || is_author() || is_date() || is_year() || is_month() || is_day() || is_time() || is_page_template('magazine.php') || is_page()) && $suf_featured_index_view == "enabled")) {
		wp_enqueue_script('slider', get_bloginfo('template_directory') . '/scripts/jquery.cycle.all.min.js', array('jquery'));
        wp_enqueue_script('slider-init', get_bloginfo('template_directory') . '/scripts/slider-init.js', array('slider'));
	}
    if (!is_admin() && is_active_widget('Suffusion_Featured_Posts', false, 'suf-featured-posts', true)) {
        wp_enqueue_script('widget-slider', get_bloginfo('template_directory') . '/scripts/jquery.cycle.all.min.js', array('jquery'));
    }
}
Let me know if there are any issues.

Re: Featured Content / Magazine Template

Posted: 23 Jan 2010, 09:01
by pmkelly
Still not working, but it is behaving a bit differently. I did some troubleshooting by adding a couple of echo statements in the new code you sent me. Not sure how to fix it, but perhaps this insight can help.

First scenario, with "Enable Featured Posts on main (default) page" ENABLED... the featured content still shows up on the HOME page and BLOG page, but not on the TEST page. It appears that "if" test fails inside of the TEST page, but not the other two. An interesting side note is that the box at the top of the TEST page is now bigger -- the same size as it is on the other two pages. But it does not show any content.

Second scenario, with "Enable Featured Posts on main (default) page" DISABLED... the results "look" the same as they did before the code change. It is apparent, though, that the "if" test similarly to the way it worked above. The "if" test SUCCEEDS on the HOME page, and FAILS on the TEST page. In both cases, though, the box is small and empty like it was before the modification.

Based on my testing, these are my conclusions. The changes you provided in the previous code:

(A) The changes SUCCEEDED in allowing the "if" test to pass for my static HOME page.
(B) The changes FAILED to change the fact that the "if" test fails for my regular TEST page.
(C) It appears that the portion of the code that manages the appearance and size of the box is probably affected from a different portion of the code.

I appreciate you looking into all of this. Thanks!

Re: Featured Content / Magazine Template

Posted: 23 Jan 2010, 09:05
by pmkelly
By the way, if you look at my pages now, the new code has been installed and the "Enable Featured Posts on main page" is ENABLED. So you can see the issue related to the empty -- but larger -- box on the test page here:

http://www.pmkelly.com/test/

Thanks!

Re: Featured Content / Magazine Template

Posted: 24 Jan 2010, 10:11
by sayontan
OK, I figured it out (I think). The problem was at quite a few different places. Basically to display the featured posts there are 4 things needed:
1. The JS library called JQuery Cycle
2. The JS calls initiating the slideshow
3. The actual contents of the slideshow
4. The styling for the slideshow.

Now, apart from #3, all the others are being executed outside the "loop". The loop is a WP concept which defines some global variables, most importantly, the $post variable. As a result of the $post variable not being available, #1, #2 and #4 were not being included for individual pages (which depend on page id), causing the errors. I have fixed it and the change should be in version 3.2.3.