Forum Replies Created
-
AuthorPosts
-
August 22, 2024 at 12:48 pm in reply to: Post Filters showing Categories not included in Selection #466070Lewis HackfathParticipant
Hi David,
Zip File Attached.
I’ve only added the code for the Portfolio Block however it could be used for other post display blocks.
Changes Made:
– Add “Order By” Field to Portfolio Block to allow ordering by Date, Type or Name
– Update Masonry Filter to only show Terms used on the posts being displayed
– Update Masonry Filter to not show the Term selected in the Block settings as there is already a “Show All” buttonAttachments:
You must be logged in to view attached files.August 21, 2024 at 1:58 pm in reply to: Post Filters showing Categories not included in Selection #466016Lewis HackfathParticipantI was also able to edit the Nav Filter to only bring in categories of the posts in the WP_Query Object by updating the following in organic-blocks-bundle/classes/class-obb-portfolio.php
<div class="obb-filter-buttons wp-block-button"> <?php $terms = get_terms( array( 'taxonomy' => $taxonomy, 'object_ids' => wp_list_pluck( $portfolio_query->posts, 'ID' ), //added to retrieve only terms of the posts in the query 'hide_empty' => true, ) ); $count = count( $terms ); // This counts the number of categories. echo '<button class="obb-button wp-block-button__link secondary" data-filter="*">Show All</button>'; if ( $count > 0 ) { foreach ( $terms as $term ) { $termname = strtolower( $term->name ); $termname = str_replace( ' ', '-', $termname ); echo '<button class="obb-button wp-block-button__link secondary" data-filter=".' . esc_attr( $termname ) . '">' . esc_html( $term->name ) . '</button>'; } } // In the above foreach loop, the code will return all the values stored in $terms array. ?> </div>
August 21, 2024 at 1:13 pm in reply to: Post Filters showing Categories not included in Selection #466015Lewis HackfathParticipantHi David,
I’ve edited the OBB Plugin to allow for a “Order By” Field to be added to the Portfolio Block.
This is working and functional with the default setting being “date” but gives the options to order by date, title or type.I’ve attached the two files I’ve made the code changes in as I feel these would be awesome to add into production and wanted to pass them on.
August 21, 2024 at 12:15 pm in reply to: Post Filters showing Categories not included in Selection #466012Lewis HackfathParticipantThis reply has been marked as private.August 13, 2024 at 4:29 pm in reply to: Post Filters showing Categories not included in Selection #465755Lewis HackfathParticipantAdditionally I have been asked if it is possible to sort in alphabetical order?
August 13, 2024 at 1:09 pm in reply to: Post Filters showing Categories not included in Selection #465742Lewis HackfathParticipantThis reply has been marked as private.August 13, 2024 at 12:16 am in reply to: Post Filters showing Categories not included in Selection #465711Lewis HackfathParticipantAdditionally is it possible to change the colour of the active filter? so it is easy to identify which filter is currently in place.
Lewis HackfathParticipantusing the CSS you provided achieves the desired result however when logged in the admin menu bar overlaps the header.
Image attachedAttachments:
You must be logged in to view attached files.Lewis HackfathParticipantHi Dave,
I’ve moved it to the group and it has had some unintended results.
I’ve left it in place for you to see.thanks
Lewis HackfathParticipantHi Dave,
Any update on this one?
thanks
Lewis HackfathParticipantThis reply has been marked as private.Lewis HackfathParticipantHi David,
Thanks for getting back to me.
I’ve added that to the “additional classes” field on the “header” element and saved the changes.
However when I scroll down on any page the header is not following.See attached Screenshot
Attachments:
You must be logged in to view attached files.Lewis HackfathParticipantThis content is restricted to Organic Themes members with an active subscription. Login here.
Lewis HackfathParticipantThis content is restricted to Organic Themes members with an active subscription. Login here.
Lewis HackfathParticipantThis content is restricted to Organic Themes members with an active subscription. Login here.
-
AuthorPosts