Forum Replies Created
-
AuthorPosts
-
slydawggMember
Looks like Sridhar already answered how I would have done it.
slydawggMemberSridhar,
This is very close to what I am trying to do because it does display the category name, but I still need it to do one thing.I need it to filter the Posts found within those categories; looks like I didn't say that in my above code.
So...
if (all categories)
show all Posts by displaying the title of each post, as a list.
if(CategoryA)
show only CategoryA posts as a list)
if(CategoryB)
show only CategoryB posts as a list)
etc...Let's say my Categories are Apples and Grapes; I would want to have a page that filters out:
This is the Apples Category (title of Category)
>Red Apples (title of Post)
>Green Apples (title of Post)
>Apple Pie (title of Post)
>etc...This is the Grapes Category (title of Category)
>White Grapes (title of Post)
>Red Grapes (title of Post)
>Wine Grapes (title of Post)
>etc...The is ALL Categories (displaying all Categories on one page)
>Red Apples (title of Post)
>Green Apples (title of Post)
>Apple Pie (title of Post)
>White Grapes (title of Post)
>Red Grapes (title of Post)
>Wine Grapes (title of Post)I hope this makes sense, and you can assist
slydawggMember@Bill - You were correct a few different times with this one - The code was over complicated and the Thumbnail size...
> Agency was grabbing a random thumbnail size, as well as WP was still set at 150x150. Once you reminded me about Agency's thumbnail size I switched that... Almost got frustrated, until I realized something that I want to smack myself for...
> Over complicating things = because WP has imported those images in while the settings were 150x150, the "thumbnail" image was set at 150x150 even though Agency had been changed. Once I deleted a sample out of the Media library and re-uploaded it - worked like a charm.Thanks for everybody who helped with this - Genesis & WordPress community, as always, rocks!
slydawggMember@Bill - I'm sure I am over complicating things, as I have stared at this for a few days now.
The only thing about this particular solution (although much more simple than what I was trying to do), when I am on the Single Page, I had hoped to be able to get rid of the 150x150 thumbnail and actually display the Full sized Featured Image (if it exists). If there wasn't a Featured Image, nothing has to exists (even the fallback image).Category Page:
thumbnails of featured images or fallback imageSingle Posts:
Full size featured image only; no thumbnail...slydawggMemberWould something like this work if you placed it in your themes function.php file:
<?php function theme_scripts(){ wp_register_script('hoverizer', get_template_directory_uri() . '/library/hoverizer/jquery.hoverizr.min.js', array('jquery')); wp_enqueue_script('hoverizer'); } function cwp_theme_footer(){ ?> <script type="text/javascript"> jQuery.noConflict(true); jQuery('.attachment-themes-thumbnail').hoverizr(); </script> <?php } add_action('wp_footer', 'cwp_theme_footer'); add_action('wp_enqueue_scripts', 'theme_scripts'); ?>
slydawggMemberThanks for your advice so far @cehwitham and @anitac. I may not have fully explained myself before. The Featured Image portion of the single_post pages don't seem to be the problem.
I think the problem lays within the fact I am trying to display "default blank images" when a post does not have a featured image attached to it. What do I mean by this?My best example is this:
If I go to the Category Page = http://goo.gl/mhcVi2 you should see 2 Posts, one that actually has a Featured image (the rabbit) and one that does not have any image connected to it - so it defaults to a blank image (blue image called "no-image")If I go to the Single/Individual Post without an image http://goo.gl/nUrZyp no image appears, which is PERFECT
If I go to the Single/Individual Post with an image http://goo.gl/U3luni I see both the original Featured Image and the little 150x150 thumbnail from the Category Page. This thumbnail I would like gone on the Single/Individual Post Page.I tried the above ideas, and they provided me some interesting information for a few other issues I had, except they were not able to resolve this particular issue. I had hoped I could go into the single.php page template for the Agency Theme and make the adjustments, but it doesn't appear I can do that within Genesis.
My current code consists of a few things:
/*adds featured image is one is there*/ function agency_post_image() { if ( is_category() ) return; if ( $image = genesis_get_image( 'format=url&size=post-image' ) ) { printf( '<a href="%s" rel="bookmark"><img class="post-photo" src="%s" alt="%s" /></a>', get_permalink(), $image, the_title_attribute( 'echo=0' ) ); } } /*adds default image if nothing exists*/ add_action('genesis_post_content', 'be_no_thumbnail'); function be_no_thumbnail( $size ) { if ( is_category() ) return '<img width="'.get_option($size.'_size_w').'" height="'.get_option($size.'_size_h').'" src="'.get_bloginfo('stylesheet_directory').'/images/no-image.jpg" />'; } /*the hope is on Single Post, add Featured Image, remove thumbnail action*/ if ( ! is_singular() ) { add_action( 'genesis_before_post_content', 'agency_post_image' ); remove_action('genesis_post_content', 'be_no_thumbnail'); } /*the hope is on Single Post, add Featured Image, remove thumbnail action*/ if ( ! is_single() ) { remove_action('genesis_post_content', 'be_no_thumbnail'); }
I hope this makes sense...
slydawggMemberChris, thanks for assistance and I will give your advice another go today as I think I tried this already without success.
Also, I republished the " John Doe" link found above if you want to see what I'm seeing.slydawggMemberI meant to follow up on this. I ended up using a combination of Brad's code above, and changing it to better suit my needs. Here is what I ended up using in case it helps others.
add_action('genesis_post_content', 'title'); function title() { if ( is_single() && genesis_get_custom_field('title') ) echo '<hr /><div id="postition_title">Title: '. genesis_get_custom_field('title') .'</div>'; } add_action('genesis_post_content', 'phone'); function phone() { if ( is_single() && genesis_get_custom_field('phone') ) echo '<div id="phone">Phone Number: '. '<a href="tel:' .genesis_get_custom_field('phone') . '">' . genesis_get_custom_field('phone') .'</a></div>'; }
slydawggMember@cdils - I've tried your method but cannot seem to make it do what I am trying to do. Hopefully you have an idea regarding this issue:
http://www.studiopress.community/topic/category-vs-single-featured-images-ideas-agency/
slydawggMemberI've done some more to the code, and am getting better results - but still cannot figure out how to remove the 2nd thumbnail on the actual Single Post Page.
My current code:
add_action('genesis_post_content', 'be_no_thumbnail'); function be_no_thumbnail( $size ) { if ( is_single() ) return ''; if ( is_category() ) return '<img width="'.get_option($size.'_size_w').'" height="'.get_option($size.'_size_h').'" src="'.get_bloginfo('stylesheet_directory').'/images/no-image.png" />'; } add_action('genesis_after_post_title', 'fac_image'); function fac_image( $size ) { if ( is_category() ) return; if ( $image = genesis_get_image( 'format=url&size=post-image' ) ) { printf( '<a href="%s" rel="bookmark"><img class="post-photo" src="%s" alt="%s" /></a>', get_permalink(), $image, the_title_attribute( 'echo=0' ) ); }
Please, does anybody know what to do? Is there something I can do with the "genesis_after_post_content" tag or some where else?
Any assistance would be greatly appreciated!
slydawggMemberAre you using Genesis Slider? If so, you might need to change the parameters within the slider settings of that plugin.
One thing I noticed in your code is the following styles are being used:
.flexslider { max-width: 920px; max-height: 400px; }
.slide-image { max-height: 400px; }If you have put the .flexslider style into place in your CSS, you might want to change the 920px value to 1140px, and see what happens. If it doesn't help, or you don't see it in your code, let me know.
slydawggMemberAh, I figured it out Brad.
I have figured out what I was trying to do. Looks like the following:
add_action( 'genesis_before_post', 'agency_post_image' ); function agency_post_image() { if ( is_category() ) return; if ( $image = genesis_get_image( 'format=url&size=post-image' ) ) { printf( '<a href="%s" rel="bookmark"><img class="post-photo" src="%s" alt="%s" /></a>', get_permalink(), $image, the_title_attribute( 'echo=0' ) ); } }
That way, it doesn't display on the Category pages, but does display on all other types of Single Posts and Pages.
Thanks for getting me on the right track!
slydawggMemberThanks Brad, and I did see that before, which I thought I explained in my previous message. So the code I have in place in functions.php is
add_action( 'genesis_before_post', 'wpsites_before_post_image', 5 ); function wpsites_before_post_image() { if ( is_single() ) return; if ( $image = genesis_get_image( 'format=url&size=post-image' ) ) { printf( '<a href="%s" rel="bookmark"><img class="post-photo" src="%s" alt="%s" /></a>', get_permalink(), $image, the_title_attribute( 'echo=0' ) ); } }
Unfortunately, for reasons I can't figure out, is the Category page is showing the large images above each Posts on the Category page; while the Single Post page doesn't even show the featured image.
Also, I did just try this for testing, without any change:
add_action( 'genesis_before_post', 'agency_post_image' ); function agency_post_image() { if ( is_single() ) return; if ( $image = genesis_get_image( 'format=url&size=post-image' ) ) { printf( '<a href="%s" rel="bookmark"><img class="post-photo" src="%s" alt="%s" /></a>', get_permalink(), $image, the_title_attribute( 'echo=0' ) ); } }
Am I missing something still?
Thanks for your patience
slydawggMemberBrad, your code example came close to what I was trying to do; but not 100%. Hopefully you can assist:
> On a Category Posts Page = just show small thumbnail of the featured image (this seemed to work just fine by using a Page, set to Blog, and adding the Custom Field of query_arg = 7 (or whatever my category id was)
> On Single Posts = need to show the full sized image of the featured image
=======
So imagine this =Category page = images are 150x150 and 1 per post Posts single page = images are 500x450
=======
Currently I have a Page with Blog template & query_id Custom field & it displays little sized thumbnails just fine, also
If I go to the /category/whateverCat link I see thumbnails as well, but when I go to the Posts single page - no image displays.If I add your code above, and change to is_single I then see large images for each Posts on the Category page, but still not on the Post Single page... Any ideas?
Should I open a new thread?
Also, I can't include the URL publicly yet, but if you need me to email you the URL privately I can do so.
slydawggMemberThanks for the quick reply. Unfortunately I was trying to use this plugin earlier and although I created a custom field and gave all of the "Location" information, the custom field still doesn't appear to ever display on the page itself.
I guess I will keep trying to see if there is something I have missed along the way.
slydawggMemberUpdate from my end. It was actually a Gravity Forms issue. When updating their plugin, they moved the jQuery script call in a different order than before, which messed up a few things. I just modified it directly and it works again just fine.
My suggestion - always check the order of the jQuery scripts.
slydawggMemberJen - there is no other way to put it except =
Thank you, you are awesome!
This was the issue
-
AuthorPosts