revive
Forum Replies Created
-
Deactivating the Give Fee Recovery plugin restored the donation form.. any thoughts?
Forum: Plugins
In reply to: [Reading Time WP] All ACF posts are still under 1 minuteOk, given the 3 yr old post regarding getting counts for ACF sub_fields, and no new info up to this point.. I’ve put this together and it works, if a little bloated IMHO. ??
But, it DOES count sub_fields for every flexible content if you include the IF check and WHILE loop for that flexible content field.// Word Count support for ACF sub_fields add_filter('rtwp_filter_wordcount', 'up_the_count'); function up_the_count($count) { $field_count =0; // set the field_count to 0 if( have_rows('flexible_content') ): // flexible content field type IF while ( have_rows('flexible_content') ) : the_row(); // flexible content field WHILE loop if( get_row_layout() == 'editable_text' ): // flexible content layout $field_count += count( preg_split('/\s+/', get_sub_field('editable_text', $post->ID) )); // flexible content sub_field elseif( get_row_layout() == 'related_content' ): // another flexible content layout $field_count += count( preg_split('/\s+/', get_sub_field('title', $post->ID) )); // flexible content sub_field $field_count += count( preg_split('/\s+/', get_sub_field('content', $post->ID) )); // flexible content sub_field endif; endwhile; endif; $count += $field_count; // adding the field_count to count return $count; // returning the count }
Forum: Plugins
In reply to: [Reading Time WP] All ACF posts are still under 1 minutehttps://www.ads-software.com/support/topic/adding-to-count-with-acf-flexible-content/#post-12088849
I came across this post, stating you have to wrap the Reading Time code in the ACF repeater field.. to get the value of the sub_field!
What if you have 10 repeater / Flexible Content fields.. you would really need to run loops for each one?
Is there no way to check the sub_field count aside from doing this??Forum: Plugins
In reply to: [Reading Time WP] All ACF posts are still under 1 minuteThe second snippet returns a word count… because the ACF get_field is in it’s parent field, a flexible content type… but get_sub_field(‘editable_text’) doesn’t return anything outside of that if/while statement check… so, it cannot be used standalone to get a word count to be added to Reading Time..
if( have_rows('flexible_content') ): while ( have_rows('flexible_content') ) : the_row(); if( get_row_layout() == 'editable_text'): $the_content = wp_strip_all_tags( get_sub_field('editable_text', $post->ID)); $word_count = count(preg_split('/\s+/',$the_content ) ); $reading_time = $word_count / 200; echo $reading_time; <- this will return a value for $reading_time and $word_count endif; endwhile; endif;
So, how can someone inject the value of an ACF child or nested field, like those of Flexible Content or Repeaters into Reading Time?
add_filter('rtwp_filter_wordcount', 'up_the_count'); function up_the_count($count) { $ACFcount = array( ** THIS NEXT LINE IS A FIELD FROM A FLEXIBLE CONTENT TYPE, it doesn't return a value (because it's outside of the if/when statement for the parent). This is the field we need the value from, and other sub_fields. count( preg_split('/\s+/', get_sub_field('editable_text', $post->ID) )) ); foreach($ACFcount as $words) { $count += $words; } return $count; }
- This reply was modified 1 year, 8 months ago by revive. Reason: update code example
Forum: Plugins
In reply to: [W3 Total Cache] Exclude caching of Draft postsYes.
Here is our workflow.
Post is created and content is added by various departments, etc.. it is in Draft status. The post is only viewable by admin, which is the expected result.
Once approved the post is then published and purged from cache. However, it is still only viewable by an admin and not publicly visible on the site – until the entire cache times out and reloads.
Not sure why purging one article is not actually purging it from cache or why a Draft would even be cached.. but, this is what is happening and it’s causing a major delay in getting new content onto the site (these are items for sale, so much more important than an article post.)
- This reply was modified 1 year, 11 months ago by revive.
Forum: Plugins
In reply to: [W3 Total Cache] Exclude caching of Draft postsHi Marko,
Thanks for reaching out. My apologies, I should have included that we also tried to clear cache for that specific page, once we published and realized that it is not on the live site for visitors (only admins can see it because they’re logged in)…
It seems the cache is aggressively retaining the drafts that are then published, in draft status.resolved. was a CSS conflict.
All good, I applied the code from https://adambalee.com/lazy-loading-responsive-images-in-wordpress-without-a-plugin/ and search is pulling ACF field data.
Side note, I do already have the pre_get_posts function applied to the search query to add the CPTs
if ( $query->is_search ) { $query->set( 'post_type', array( 'page','post', 'inventory', 'auction', 'liquidation' ) ); }
Forum: Plugins
In reply to: [Regenerate Thumbnails] Restore deleted images (original sized images)@gikaragia Thanks for the reply.
We don’t have any other image plugins installed on the site. Regenerate Thumbnails is the only image plugin we’ve ever installed.. which is why we’re wondering what happened to the original images (Regenerate Thumbnails has never affected them in the past).
Is there anyway for Regenerate Thumbnails to delete the original images??Forum: Plugins
In reply to: [Regenerate Thumbnails] Restore deleted images (original sized images)Rephrased and reposted to clarify support request
Forum: Plugins
In reply to: [The Events Calendar] Can’t switch List/Month view@marckolo
It’s in your functions.php file usuallyForum: Plugins
In reply to: [The Events Calendar] Can’t switch List/Month viewI replaced the themes enqueue of jQuery from:
wp_register_script('jquery-3.5.1', 'https://code.jquery.com/jquery-3.5.1.js', false, '3.5.1', true); wp_enqueue_script('jquery-3.5.1');
to just the basic enqueue that the TwentyTwentyOne theme uses:
wp_enqueue_script('jquery');
- This reply was modified 3 years, 2 months ago by revive.
Forum: Plugins
In reply to: [The Events Calendar] Search, Data dropdown and view selector now workingFound the issue for us.. WP was loading jQuery twice. resolved that, and TEC works great. Thanks!
Forum: Plugins
In reply to: [The Events Calendar] Can’t switch List/Month viewFound the issue for us.. WP was loading jQuery twice. resolved that, and TEC works great. Thanks!