Sergio Jardim
Forum Replies Created
-
Forum: Plugins
In reply to: [My YouTube Channel] YTC ERROR: name lookup timed outIt is always kind to leave the solution instead of just saying “solved”. ?? Could you tell how to solve it?
Forum: Plugins
In reply to: [Google Analytics Post Pageviews] No Cache Saved in DBHi Sarah,
Sorry for the late reply.
Could you share all the page’s code somewhere like https://pastebin.com/ ?
And are you sure you place the other code on the plugin file (or created a new plugin)?Forum: Plugins
In reply to: [Google Analytics Post Pageviews] No Cache Saved in DBHi Sarah,
No, you don’t need to call the function on other places. But tell me, what happen on the page in the browser? Some error appears or just nothing? And what is this variable “$show_post_stats”, could you remove it form the IF conditional?
Also check the post meta for the key/value “analytics-pageviews”. Just open a post on the dashboard and see if it has this key/value.
Forum: Plugins
In reply to: [Google Analytics Post Pageviews] No Cache Saved in DBYou can simplify a little bit:
<?php if ($show_post_stats && function_exists('gapp_get_post_pageviews') ) { $views = intval( gapp_get_post_pageviews( null, false ); if ( 0 === $views ) { $views = intval( get_post_custom_values( 'analytics-pageviews', get_the_ID() )[0] ); } echo '<span style="font-size: 14px; line-height: 27px; font-weight: 300; color: #b7b7b7;">'. $views. ' Views</span>'; } ?>
Hope that helps.
Forum: Plugins
In reply to: [Google Analytics Post Pageviews] No Cache Saved in DBHi Sarah,
Place the “add_action” function code on the bottom of the plugin file, after the line “add_action(‘admin_notices’, ‘gapp_admin_notice’);”.And put the “if” condition code on your template. Ok?
Best regards,
SergioForum: Plugins
In reply to: [Google Analytics Post Pageviews] No Cache Saved in DBThank you @totels !
It worked like a charm!Forum: Fixing WordPress
In reply to: [Plugin: NextGEN Gallery] Album & Gallery title displayTo display the gallery title, look here:
https://www.ads-software.com/support/topic/228884But I can’t display the album title yet.
Forum: Plugins
In reply to: [Plugin: qTranslate] Write post only in one languageI managed to do it by reading what mkdotam said and changing the_loop.
One of my loops look like:
<?php query_posts('showposts=10&category_name=news'); if (have_posts()) : while (have_posts()) : the_post(); $hasLanguageContent = get_the_title(); if($hasLanguageContent != "") : //if title is not an empty string, show the code below ?> <div class="news-list"> <a href="<?php the_permalink() ?>">- <?php the_title() ?></a> </div> <?php endif; endwhile; endif; ?>
Forum: Plugins
In reply to: [Plugin: NextGEN Gallery]: Show gallery titles on gallery pageDon’t use the function above!
If you have an & within your gallery title, like “Blue & Bananas”, the function will return only “Bananas”, so I made an improvement:<?php //function when not using permalinks with mod_rewrite $url = $_SERVER['QUERY_STRING']; //eg: page_id=9&album=4&gallery=3&Blue%26Bananas" /*strrchr finds the last appearance of the '&' string and returns it and the last characters. So, using substr we remove the first char of this new string, in this case the '&':*/ $galleryTitle = substr(strrchr($url, '&'), 1); echo urldecode($galleryTitle); ?>
Forum: Plugins
In reply to: [Plugin: NextGEN Gallery]: Show gallery titles on gallery page@svb_wm: Hum, that’s true, I’m using mod_rewrite and permalinks.
My link looks like:example.com/nggallery/page-91/album-1/gallery-2?Hall%20of%20Fame
But you can make it works for you by using two php functions for instance. There are other ways to do it, but let me show you how to do using the substr() and strrchr() functions;
<?php $url = urldecode($_SERVER['QUERY_STRING']); /*strrchr finds the last appearance of the '&' string and returns it and the last characters. So, using substr we remove the first char of this new string, in this case the '&':*/ $galleryTitle = substr(strrchr($url, '&'), 1); echo $galleryTitle; ?>
Give it a test!
Forum: Plugins
In reply to: [Plugin: NextGEN Gallery]: Show gallery titles on gallery pageAlex, first of all thanks for this great plugin. The best out there!
I’ve found a simple solution to this problem using query strings.
In album-compact.php and album-extend.php I changed all the links.
Before: <a href="<?php echo $gallery->pagelink ?>"> ----------------------------------------------------------------- After: <a href="<?php echo $gallery->pagelink ?>?<?php echo $gallery->title ?>">
And I get the query string in the beginning of my gallery.php outside the for loop.
Before:
<div class="ngg-galleryoverview" id="ngg-gallery-<?php echo $gallery->ID ?>"> <!-- Thumbnails -->
————————————————————
After:<div class="ngg-galleryoverview" id="ngg-gallery-<?php echo $gallery->ID ?>"> <strong><h3><?php echo urldecode($_SERVER['QUERY_STRING'])?></h3></strong> <!-- Thumbnails -->
I’ve used the decode function to avoid spaces and accentuation issues.
Maybe it’s not the best solution, but it’s a simple one and works for me. ??Forum: Fixing WordPress
In reply to: Show the first thumbnail of post gallery inside the loopHi!
I think this is what you wanna (even though I probably don’t need it any more):https://wordpresshacker.com/get-images-attached-to-post/
But someone will.