- This topic has 32 replies, 3 voices, and was last updated 5 years, 6 months ago by Tom.
-
AuthorPosts
-
August 12, 2018 at 9:37 pm #646660Hans
Hi everybody,
on specific taxonomy archives I use alphabetical order. I acchieved it by this code:
function member_abc( $query ) { if (($query->is_tax('ausschuss')) || ($query->is_tax('amtingemeinde')) ||($query->is_tax('ansprechpartnerin')) || ($query->is_tax('aufgabe')) || ($query->is_tax('funktionov')) || ($query->is_tax('mandat')) || ($query->is_tax('fraktionov'))) { $query->set( 'orderby', 'name' ); $query->set( 'order', 'ASC' ); } } add_action( 'pre_get_posts', 'member_abc' );
On exactly these archives I do not want to apply masonry as this destroys the abc-order from left to right. Which code will solve the problem?
August 13, 2018 at 5:49 am #646865HansI tried this code:
add_filter( 'generate_blog_masonry', 'tu_adjust_masonry' ); function tu_adjust_masonry( $masonry ) { if ((is_tax('ausschuss')) || (is_tax('amtingemeinde')) ||(is_tax('ansprechpartnerin')) || (is_tax('aufgabe')) || (is_tax('funktionov')) || (is_tax('mandat')) || (is_tax('fraktionov'))) { return 'false'; } return $masonry; }
It did not work.
August 13, 2018 at 7:59 am #647025LeoStaffCustomer SupportHi there,
Can you try this:
add_filter( 'generate_blog_masonry','tu_portfolio_masonry' ); function tu_portfolio_masonry( $masonry ) { if ( is_tax( 'tax1', 'tax2') ) { return 'false'; } return $masonry; }
August 13, 2018 at 8:13 am #647049HansHi Leo,
it did not help!
August 13, 2018 at 10:15 am #647154TomLead DeveloperLead DeveloperAre those the taxonomies, or the terms?: https://codex.wordpress.org/Function_Reference/is_tax
Ideally, it would be like this:
add_filter( 'generate_blog_masonry','tu_portfolio_masonry' ); function tu_portfolio_masonry( $masonry ) { $taxonomies = array( 'some-taxonomy', 'another-taxonomy', 'one-more', ); if ( is_tax( $taxonomies ) ) { return 'false'; } return $masonry; }
August 13, 2018 at 10:46 am #647166HansHi Tom,
this did not chnge the situation. The taxnomy is part of a cpt. Might this be the source of trouble? I use the follwoing content-template:
<?php /** * @package GeneratePress */ ?> <!-- Hans Keutgen Neue Datei für Theme - Mitglieder hehandeln --> <style> .post-image img { display: center; margin-left: auto; margin-right: auto; } </style> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_article_schema( 'CreativeWork' ); ?>> <div class="inside-article"> <?php do_action( 'generate_before_content'); ?> <header class="entry-header"> <?php do_action( 'generate_before_entry_title'); ?> <?php if ( generate_show_title() ) : ?> <?php the_title( '<h1 class="entry-title" itemprop="headline">', '</h1>' ); ?> <?php endif; ?> <?php do_action( 'generate_after_entry_title'); ?> </header><!-- .entry-header --> <?php do_action( 'generate_after_entry_header'); ?> <div class="entry-content" itemprop="text"> <?php // the_content(); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ), 'after' => '</div>', ) ); ?> </div><!-- .entry-content --> <?php do_action( 'generate_after_entry_content' ); ?> <?php do_action( 'generate_after_content' ); ?> </div><!-- .inside-article --> </article><!-- #post-## -->
The code is in a child theme.
August 13, 2018 at 6:58 pm #647441TomLead DeveloperLead DeveloperAny chance you can link me to one of those taxonomy archives?
August 14, 2018 at 12:47 am #647567HansI send the access data to your pre-sales support. The easiest way to see what happens: Look on menu bar “Ortsverein -> Who is who”. This is an example of taxonomy ‘fraktionov’ and CPT ‘mitglieder’.
August 14, 2018 at 10:20 am #648047TomLead DeveloperLead DeveloperJust as a test, does this work?:
add_filter( 'generate_blog_masonry','tu_portfolio_masonry' ); function tu_portfolio_masonry( $masonry ) { if ( is_archive() ) { return 'false'; } return $masonry; }
It will apply to all archives, so it’s not the solution, but I just want to know if it works or not.
August 14, 2018 at 11:18 am #648117HansHi Tom,
unforturnately it changed nothing – even archives stay in masonry.
August 14, 2018 at 12:54 pm #648234TomLead DeveloperLead DeveloperThat tells us something. Let’s go back to our original function, and change it to this:
add_action( 'wp', function() { add_filter( 'generate_blog_masonry','tu_portfolio_masonry' ); } ); function tu_portfolio_masonry( $masonry ) { $taxonomies = array( 'some-taxonomy', 'another-taxonomy', 'one-more', ); if ( is_tax( $taxonomies ) ) { return 'false'; } return $masonry; }
August 14, 2018 at 1:55 pm #648316HansHi Tom,
things seem to become more complicated. Masonry is still there but additional problems have come up. Some taxonomies have no longer columns. I have to investigate this and will report tomorrow.
August 14, 2018 at 7:15 pm #648578TomLead DeveloperLead DeveloperSounds good – let me know what you find out.
August 15, 2018 at 1:20 am #648811HansHi Tom,
I did not find a reason why there are three columns or one column in the taxonomies view in your last proposal. Prior to your last proposed code there where always three columns – all of them had the mansonry view.
When you enter the site – I send the access data to your pre-sales desk, you find the view as I designed it. Just go to “Examples” in the secondary menu under the primary one. There you find different views on taxonomies. When you enter Dashboard -> Snippets, the two deactivated snippets at the end of the list are your proposals. The penultimate snippet – your latest proposal – gives three/one column(s) back. The last one doesn’t change anything – your first proposal.
I checked the taxonomy definitions – they are all exactly the same.
My wish is still to have these taxonomies in non-masonry view to get an alphabetical order despite of the size of the featured Image and lenghth of title.
August 15, 2018 at 10:16 am #649510TomLead DeveloperLead DeveloperHi there,
So your “Who is Who” page is using this taxonomy:
fraktionov
That was missing from the function. I added it to the code snippet, and masonry was disabled. Columns were also disabled though – do you want those back?
-
AuthorPosts
- You must be logged in to reply to this topic.