color-palette-generator icon indicating copy to clipboard operation
color-palette-generator copied to clipboard

ACF Gallery

Open garethhorner opened this issue 6 years ago • 12 comments
trafficstars

Hi I have a cpt set up titled 'works' and using an acf pro gallery-field titled 'rga_images' - im appending the main url with the various /color/color options but nothing is showing up. What's the best option here? Do I need to edit the search.php template?

Incredible work on the plugin btw

garethhorner avatar Dec 06 '18 19:12 garethhorner

I override the default search query if several params are set. (You can check https://github.com/houke/color-palette-generator/blob/master/inc/cpg-admin-search-rewrites.php#L26).

After the query is altered I check for a custom search template. If your theme already has a custom search template it might need to be changed. Else I fallback on the search template in the plugins folder: https://github.com/houke/color-palette-generator/blob/master/templates/search.php.

If you want to add your own search template for our plugin, add a templates folder to your theme and add search.php in there.

houke avatar Dec 18 '18 15:12 houke

Hey Happy new year! Thank you for your reply - I've tried to understand but fear it is a bit beyond me, I have a custom search template implemented and working but still the plugin tells me 'No artworks found for this color...'

I understand and apologise for being a little naive here. I can view all my media and associated palettes are generated so the plugin is working. I just can't understand how to associate it with my custom post type 'works' when searching, any help would be massively appreciated now - and happy to make a donation to offer my thanks

Desperate to use this plugin as I think its fantastic!

garethhorner avatar Jan 08 '19 15:01 garethhorner

No worries :) Let's see if we can figure this out.

  • First of all, save this image and upload it to your library
  • Generate the palette. The dominant color is brownish (#82624a in my case)
  • Now go to yoururl.com/color/brown

What is the result? Do you see the image? I've tested above scenario in a new website with only the color palette generator and I get the coffee image back as a result.

houke avatar Jan 08 '19 18:01 houke

Hey - Followed the steps, and this is what I see http://ryanganderarchive.com/color/brown I can see the image on the backend with the generated palette with the same #82624a dominant colour So somewhere I’ve gone wrong right?

— Gareth Horner garethhorner.eu

On 8 January 2019 at 18:11:32, Houke ([email protected]) wrote:

No worries :) Let's see if we can figure this out.

What is the result? Do you see the image? I've tested above scenario in a new website with only the color palette generator and I get the coffee image back as a result.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/houke/color-palette-generator/issues/2#issuecomment-452397034, or mute the thread https://github.com/notifications/unsubscribe-auth/AKJRv85UGu46p4ABaoOO_UzTCDzrvm1sks5vBN9NgaJpZM4ZHKYU .

garethhorner avatar Jan 08 '19 18:01 garethhorner

How are your permalinks set? (Settings > Permalinks). Try to set that one on Post Name if it isn't already.

Does that change anything?

Do you have other plugins active as well?

houke avatar Jan 09 '19 08:01 houke

Yeah permalinks are set as you mentioned :(

screenshot 2019-01-09 at 09 20 38 screenshot 2019-01-09 at 09 20 48

Notable plugins in use… ACF Pro 5 CPT UI SearchWP

Some more info…

` WordPress Version: 5.0.2 Permalink Structure: /%postname%/ Active Theme: Ryan Gander Archive 0.6

	Registered Post Types:    post, page, attachment, revision, nav_menu_item, custom_css, customize_changeset, oembed_cache, user_request, wp_block, acf-field-group, acf-field, works

	PHP Version:              7.0.33
	MySQL Version:            5.6.41
	Web Server Info:          Apache

	Show On Front:            page
	Page On Front:            Front Page (#23)
	Page For Posts:            (#0)`

garethhorner avatar Jan 09 '19 09:01 garethhorner

It's not because I'm on Wordpress 5 is it?

garethhorner avatar Jan 09 '19 09:01 garethhorner

WP5 isn't the issue, I am using it with no problem with 5.0.2. I see you've SearchWP as a plugin. I think they alter the search query as well and we might collide with one another.

What happens if you disable that one for a bit?

houke avatar Jan 09 '19 20:01 houke

Yeah turning off SearchWP has worked! — http://ryanganderarchive.com/color/grey

garethhorner avatar Jan 10 '19 11:01 garethhorner

Good to hear :). I think we're both modifying the search query and SearchWP was overwriting mine. It's a paid plugin from the looks of it, so I won't be able to debug further I think.

Are you planning to use SearchWP in the future?

houke avatar Jan 10 '19 11:01 houke

Spoke too soon, deleted the previous comment. CPG is working with https://wordpress.org/plugins/acf-better-search/ installed rather than SearchWP, amazing.

Do have one more query - now that I can see the plugin working, is it possible to show the post an attachment is related too rather than a list of the attachments like so… http://ryanganderarchive.com/color/grey

Essentially displaying like the search template here… http://ryanganderarchive.com/search/art

Does it require customising the search template in the CPG plugin folder?

garethhorner avatar Jan 10 '19 12:01 garethhorner

I think there is already a custom search template active. My template would output this by default

				if ( have_posts() ) {
					while ( have_posts() ) {
						the_post();
						$cpg_img = wp_get_attachment_image_src( get_the_ID(), 'thumbnail' );
						$cpg_link = get_permalink( get_the_ID() );
			?>
				<div class="c-search__result">
					<a href="<?php echo $cpg_link; ?>">
						<img src="<?php echo $cpg_img[0]; ?>" alt="<?php echo get_the_title(); ?>" />
						<span><?php echo get_the_title(); ?></span>
					</a>
				</div>
			<?php
					}
					echo get_the_posts_pagination();
				} else {
					echo '<h2>No artworks found for this color...</h2>';
				}

So the first step for you would be to find the template in your theme which is setting the layout you're seeing

houke avatar Jan 10 '19 19:01 houke