Forum Replies Created
-
AuthorPosts
-
Anyone had any ideas?
Hi – anyone had any ideas?
Hi Mike
I found another way – I created an archive.php in my child theme and added –<h1 class="h1-as-h3"><?php post_type_archive_title(); ?></h1>
around line 35.Thanks for your help. I may come back and use this method if mine becomes problematic.
Dominic
- This reply was modified 1 year, 3 months ago by domchocolate.
I guess the difficulty is this:
On the Theme settings under Header/Header Layout/Title and Breadcrumbs, I have “Show only breadcrumbs selected”. I want to show a Title only on archive pages. So I need to modify the archive.php to make this happen I think.
Of course, I could change the setting under Header/Header Layout/Title and Breadcrumbs to show “header and breadcrumbs”, but that would mean manually selecting “breadcrumbs only” on every existing and future page, which isn’t great for management when the site is handed over to the client.
So I think a tweak to archive.php in my child theme is the most sophisticated solution. Any thoughts on that and any ideas on what I change it to?
Dominic
I did this so that I could add a class and control the look of it.
$output = ''; if( empty( $this->entries ) || ! $this->entries instanceof WP_Query || empty( $this->entries->posts ) ) { $output = "<div class='no-articles'>There are currently no related articles</div>"; return $output; }
Excellent – thanks Ismael, that worked a treat!
Hi Mike
Not quite – I’d like to keep the breadcrumb as is but add an H1 heading between that and the post grid with the relevant heading title dynamically generated.
I guess it would require tweaking the archive.php?
Dominic
Forgot password; see private content.
August 7, 2023 at 11:15 am in reply to: Cookie settings privacy policy accessibility issue. #1415694Whoops – just activating email notifications!
July 20, 2023 at 6:23 pm in reply to: Regarding thread Using a Custom Field Type on Pages in Post Slider Element #1413858No worries, I sussed it!
$excerpt = '<a href="' . $link . '"> '. $meta_value .' </a>';
July 20, 2023 at 6:02 pm in reply to: Regarding thread Using a Custom Field Type on Pages in Post Slider Element #1413854Just checking email notifications…
July 11, 2023 at 1:28 pm in reply to: Using a Custom Field Type on Pages in Post Slider Element #1413046Hi Mike
It works – thanks so much for all your help as always! Thrilled with it!July 10, 2023 at 6:18 pm in reply to: Using a Custom Field Type on Pages in Post Slider Element #1412975Thanks, Mike – I’ll try that. It’s so I can have a more advertising-led headline alongside the factual, signpost-type title. It’s about language and hierarchy rather than science. I’ll let you know how I get on.
DominicHi Mike
Thanks for the advice – I’d overlooked the Featured image slider.
It’s pretty handy except the link to the post is only on text and not the whole tile. Is there a way to tweak the Featured image slider so that the whole thing becomes a link to the page/post?
Thanks in advance
Dominic
July 10, 2023 at 2:25 pm in reply to: Using a Custom Field Type on Pages in Post Slider Element #1412958Hi Mike
That works great. One final question – if you now visit the page you’ll see I’ve got the custom headline (thanks) and I’ve added the original post name as a pseudo-class (:before) in the CSS (added as a code block on the page).
Is there a way of automatically calling the original page title into said pseudo-class content variable (content: ‘vision’) or, alternatively, is there another way of doing this by tweaking the postslider.php further?
I’m just trying to make edits as simple as possible for the client.
Thanks so much, again, for all your help.
Dominic
July 10, 2023 at 8:58 am in reply to: Using a Custom Field Type on Pages in Post Slider Element #1412926PS I only want to do this to the page .homepage-page-slider post slider element the others need to stay the same.
Perhaps we show both title and custom field and show/hide whichever using CSS? Any ideas around that?
July 10, 2023 at 8:55 am in reply to: Using a Custom Field Type on Pages in Post Slider Element #1412925Thanks, Mike – I’ll try that. Any pointers on how can I add this code to a child theme.
July 7, 2023 at 12:56 pm in reply to: Using a Custom Field Type on Pages in Post Slider Element #1412693Any ideas, guys?
Thanks, @guenni007 – that didn’t work I’m afraid.
But I did find the solution in the end. For those interested it’s:
function string_limit_words( $string, $word_limit ) { $words = explode( ' ', $string, ( $word_limit + 1 ) ); if ( count( $words ) > $word_limit ) { array_pop( $words ); } return implode( ' ', $words ); } function modify_excerpt( $excerpt, $entry ) { $label = "Read more"; $limit = 50; $excerpt = string_limit_words( $excerpt, $limit ) . '… '; $excerpt .= '<a href="' . get_permalink( $entry->ID ) . '"><span class="avia_iconbox_title">' . $label . '<span class="more-link-arrow"></span></span></a>'; return $excerpt; } // Use custom excerpt for Blogposts for grid layout add_filter( "avf_post_slider_entry_excerpt", function ( $excerpt, $prepare_excerpt, $permalink, $entry, $class ) { $custom_excerpt = get_field( 'the_project', $entry->ID ); if ( $custom_excerpt ) { $excerpt = $custom_excerpt; } return modify_excerpt( $excerpt, $entry ); }, 10, 5 ); // Use custom excerpt for Blogposts in all layout except grid add_filter( 'get_the_excerpt', function ( $excerpt, $entry ) { $custom_excerpt = get_field( 'the_project', $entry->ID ); if ( $custom_excerpt ) { $excerpt = $custom_excerpt; } return modify_excerpt( $excerpt, $entry ); }, 10, 2 );
Thanks again everyone for all your help.
Dominic
Any luck? Anyone? I’m rather keen to fix this because I have a client waiting for this particular request. Sorry to be a pain.
Thanks, Guenni
Like this?
function modify_excerpt($excerpt) { $label = "Read more"; $limit = 50; $excerpt = string_limit_words( $excerpt, $limit) . '… '; $excerpt .= '<a href="'get_permalink($entry->ID)'"><span class="avia_iconbox_title">' . $label . '<span class="more-link-arrow"></span></span></a>'; return $excerpt; }
This returns an error “We encountered an error activating your snippet, please check the syntax and try again.”
- This reply was modified 1 year, 10 months ago by domchocolate.
Hi Nikko
I noticed another issue with the read more links not linking to their respective post or custom post.
function modify_excerpt($excerpt) { $label = "Read More"; $limit = 50; $excerpt = string_limit_words( $excerpt, $limit) . '…'; $excerpt .= '<a href="" class="avia-button av-readmore avia-icon_select-no avia-size-small avia-position-center avia-color-theme-color"><span class="avia_iconbox_title">' . $label . '</span></a>'; return $excerpt; }
Should there not be something here:
<a href="call the post permalink" class="avia-button av-readmore avia-icon_select-no avia-size-small avia-position-center avia-color-theme-color">
eg:
href="'. get_permalink($post->ID) . '"
??? (I tried this one and it didn’t work).Thanks in advance
- This reply was modified 1 year, 10 months ago by domchocolate.
- This reply was modified 1 year, 10 months ago by domchocolate.
- This reply was modified 1 year, 10 months ago by domchocolate.
Thanks, Nikko – Brilliant! That works! One tiny issue…
On the custom posts that use the custom field (the_project) as an excerpt there is one set of ellipses (…) before read more link. eg. https://owe.brother.design/projects/
On the standard posts that use the content as the excerpt there are two sets of ellipses (.……) before read more link. eg. https://owe.brother.design/updates-and-events/
Any ideas on how we fix that so we only get one set on each?
Thanks in advance
- This reply was modified 1 year, 10 months ago by domchocolate.
Hi Ismael – another warning has come up for the timeline element and its this:
Content not included in landmarks
1.3.1 Info and Relationships
HTML5 or WAI-ARIA landmarks are used on the page, but not all content is included.When using HTML5 or WAI-ARIA landmarks it is best practice to include all content on the page in landmarks. In this way users of assistive technologies can use the landmarks for navigating the page without losing track of content.
Make sure that all content on the page is included in HTML5 or WAI-ARIA landmarks.
The offending items from this timeline are (https://owe.brother.design/):
<h2> Principle 1
<h2> Principle 2
<h2> Principle 3
<h2> Principle 4
<h2> Principle 5
<h2> Principle 6
<h2> Principle 7
<h2> Principle 8
<h2> Principle 9
<h2> Principle 10and
<div> 1…through to <div> 10.Obviously, this will also apply to my other timeline https://owe.brother.design/why-here/local-character/
Any thoughts on a fix for this?
Hi Ismael
I have another query around accessibility. I have a form in the footer of my site. It includes a hidden text field.
<p class=”hidden” style=””><input type=”text” name=”avia_6_1″ class=”hidden ” id=”avia_6_1″ value=”” style=””></p>
Apparently this is missing a label which is required for accessibility even though it’s hidden. I appreciate this isn’t going to affect overall accessibility but the client’s software still picks this up. Is it possible to remove this hidden field or give it a label.
Here’s the error
Error
Input field has no description
1.3.1 Info and Relationships
Input fields should always have a description that is explicitly associated with the field to make sure that users of assistive technologies will also know what the field is for.If the input field has a visible description indicating the purpose of the field, this description should be explicitly associated to the input field either as a HTML label or using the WAI-ARIA attribute ‘aria-labelledby’.
If it is not possible to add a visible description, either add a mouseover text (‘title’ attribute) to the input field or create an invisible label using the WAI-ARIA attribute ‘aria-label’.
Occurrences on this page1
<input>
EmptyInvisible
View code snippet in DevTools
Hi Ismael
That’s magic, thanks! Works a treat! Good work and probably worth incorporating in the next release for accessibilities sake.
Dominic
OK – I got this working (almost). So I removed the copy from the excerpt field on the standard post and then the excerpt got pulled from the content field of the post. Perfect. Except it cuts the excerpt off at 9 words (10 including the ellipses (…) ). Can we get this to do 50 words the same as when we use the_project custom field as excerpt?
Example using standard posts: https://owe.brother.design/updates-and-events/
Example using custom post and the_project custom field: https://owe.brother.design/projects/
Thanks in advance
Dominic
Hi Mike
Is it possible to do this with the blog posts element? I want it to show something like 50 words and then Read More. I have set the post element to Title-Exerpt and read more.
Dominic
Hi Nikko or anyone else – any luck with this???
Hi Guenni and thanks for this.
I’m afraid this code has a syntax error somewhere (picked up by WPCode snippets. Any ideas?
Plus the website details are listed below in the private content.
The example page – https://owe.brother.design/excerpt-test/ – shows two post blog elements :
The top one displays standard posts and uses the standard WP excerpt field. This isn’t shortening the excerpt to 50 words.
The second example uses the same blog post element to display a custom post type (in this case Portfolio) and uses Nikko’s code above to use the text found in ‘the_project’ custom field as the excerpt (using Nikko’s code above). This does exactly what I want and shortens the excerpt.
Basically, I want the top one to act like the second one.
Does that make any sense?
-
AuthorPosts