Oliver
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: How to change the HTML lang attribute in a single page.@jj7374107 I had the same challenge and wrote a lightweight plugin to do this more conveniently from the Posts edit screen:
https://swissmacuser.ch/wordpress-html-lang-locale-overwrite-plugin/
OMG I got it working! What a hack…
Simply put: I rely on the Content No Cache’s AJAX-request referrer header, to find out what post path – and hence which Post-ID – the shortcode was called from.
add_shortcode('post_views', 'get_views_shortcode'); function get_views_shortcode( ) { // Get Post ID from AJAX-Referrer > Slug-to-Post resolver $slug = basename( wp_get_referer() ); $path = '/' . $slug . '/'; $post_id = url_to_postid($path); // Get Views (Post Meta) $views = intval( ( empty($post_id) ? 0 : get_post_meta( $post_id, '_post_views_count', true ) ) ); // Return views return ( !empty($views) ? $views : 0 ); }
@giuse I tried an approach with shortcodes within a Content No Cache-snippet (id=1234):
<!-- Content No Code-Snippet contents --> [post_views]
Whereas I have a function in my child-theme as follows:
add_shortcode('post_views', 'get_views_shortcode'); function get_views_shortcode( ) { global $post; $post_id = $post->ID ?? 0; // get views $views = ( empty($post_id) ? 0 : get_views( $post_id ) ); // return output return $views; }
And finally, in the view rendering function:
<li class="bwp-views-count"><i class="fa fa-eye"></i><?php echo do_shortcode( '[content_no_cache id="1234"]' ); ?></li>
This ?works? but I always get “0” – as the $post->ID cannot be resolved.
But as you might grasp, I’d nee to be able to – dynamically – fetch the Post’s ID in the Content No Cache-snippet & pass it on to the function used for the shortcode.
Is this somehow possible?? Example:
<!-- Content No Code-Snippet contents --> [post_views postid={$post->ID}]
Much appreciate your thoughts / feedback on this. Probably there is a workaround to fiddle directly with the Content No Cache’s code and extend it to pass along a (dynamic) ID retrieved from the HTML of the current Post? I have the feeling for what I want to do – per Post basis with 1 No Cache-snippet – I might have hit a dead end…
- This reply was modified 1 year, 6 months ago by Oliver.
Thanks for the quick reply @giuse , that’s helpful.
To better understand how you populate the ?Content“ area of a No Cache-snippet for dynamic contents, could you share what you put in the corresponding field that dynamically generates a random number from PHP in the example blog page from the Details?
EXAMPLE
You can see Content No Cache in action visiting the blog post Exclude specific content from being cached.
You will see a number that is always different when you refresh the page. But the page is served by full page cache.
In the example it’s just a number, but you can output whatever content you want.@cfinke not sure if you were actually able to improve the pervasive spam rule, or it‘s just ?luck“ again – but since our discussion here I did not receive a single, marked as spam, comment of the mentioned kind!
??
Cool thanks ??
@cfinke is there some way to report such spam-comments in order to help optimize the filter-rule on the global scale? Or does it learn automatically fron when I delete spam-marked comments?
@cfinke the latter: being caught, but would expect it to be “strict” on these cases.
Honestly I compare it to the months < February 2021 where I received zero-to-one such flagged spam comments per month – was I just lucky for long? ??
Update: posted in the Akismet Support Forums (closing here)
Addition: might be seeing the same as reported in this thread ?Spam comments?
Thanks @sterndata! Okay will do – over on Twitter @jetpack pointed me to post here…
And sorry for the mistake with the links, that was dumb of me ??
Forum: Plugins
In reply to: [Fast Velocity Minify] v3.0.7 breaks my page (CSS styles not loading)Or do the css files are getting merged, but are for example empty, or returning 404?
?? This. The merged CSS cannot be read anymore.
Forum: Plugins
In reply to: [Enable Media Replace] Replacement doesn’t work anymoreI still can select the image that I want to replace – but I don’t see the preview and also the button that allows me to replace the image is always inactive.
I have exactly the SAME issue with the Enable Media Replace Plugin (v 3.3.7) on the newest WordPress 5.3.2
Can you share any solution approaches here? @hagbard23 was support able to help you with the problem?
Cheers
Hi @jgrodel
YES – using
addthis.layers.refresh()
did the trick! Awesome!
(you maybe should update the documentation at https://www.addthis.com/academy/using-addthis-asynchronously/ accordingly… ?? )I can reproduce the WPTouch Mobile Share Banner not working only on a physical iOS device, but not in the mobile view on a Desktop Browser. Have to look into this again to verify it properly…
Thanks,
Oliver- This reply was modified 7 years, 10 months ago by Oliver.
Hi @jgrodel
Sure, see this site here – directly on the homepage:
https://swissmacuser.ch/- Search the source code for
addthis_inline_share_toolbox
(especially interesting after having scrolled down and new posts have been loaded dynamically – you’ll properly find the <div> on their markup) - While scrolling down the page and thus triggering the infinite scroll, you’ll see a notice in the browser console stating:
[INFO] calling addthis.toolbox() to show buttons on dynamically added posts
By the way: the AddThis Share Buttons in combination with WPTouch Plugin do not work and run into an infinite loading-loop – you can try to reproduce this here:
https://swissmacuser.ch/fix-wordpress-stuck-in-maintenance-mode-on-macos-mamp/?utm_source=dlvr.it&utm_medium=twitter#.WH6R1diZOV7=> see errorous behaviour when clicking on the “Share”-button in the banner showing up in the bottom
Thanks,
Oliver