Relja
Forum Replies Created
-
Forum: Themes and Templates
In reply to: [GeneratePress] Main drop-down menu won’t work with AMPJust to clarify there hasn’t been a misunderstanding:
GeneratePress works perfectly in full version. In AMP, the main menu doesn’t work.
The code provided in this topic didn’t solve the main menu problem – it’s still there and still doesn’t work. Did I implement it wrong (tried puting it in functions.php of the child theme)?
Instead of the main menu disappearing, I’d love to replace it with the non-amp page version link, or at least a home-page link – is that possible with some code?
Thanks in advance for any help.
Forum: Themes and Templates
In reply to: [GeneratePress] Main drop-down menu won’t work with AMPThank you for the reply and the code. In case it makes anyone any wiser, some more info I found this question (Googling):
https://generatepress.com/forums/topic/navigational-menu-not-showing-on-amp-page/The website seems to be working now, even the amp version. Non AMP:
/yahava-coffee-ethiopia-sidamo-review/
AMP:
/yahava-coffee-ethiopia-sidamo-review/?ampThe menu on that site doesn’t drop down when hovered with mouse. Tried to do that change to my menu – but didn’t help with AMP in my case. ??
Wrote to the website owner asking for info – no reply for now.Anyway, I’d definitely be interested at least in a (static) link to the original page, or the website homepage – as a menu replacement in AMP page version.
Or at least in hiding the menu. The code above didn’t help (put it in the child theme functions.php).
Update:
The problem seems to be fixed with todays plugin update – tried it just now. ??Thank you, great job on the plugin.
Update:
Functionality seems to be fine, just the css error still worries me.Tested another comment plugin – it also does it with gutenberg and polylang.
Forum: Plugins
In reply to: [Hyper Cache Extended] Polylang homepage problemsI’ve found the solution – sorry to have bothered. In case it helps anyone else:
Advanced options -> “Redirect caching” – should be left unchecked.
Just to give feedback and in case anyone else finds it useful:
Your code works well. I did eventually test and implement the child-theme route. It is more elegant – both for custom CSS, for this function, along with some other functions I had previously implemented editing header.php etc.
My first obstacle, what code to include in the child’s function.php was solved by GeneratePress offering already finished GeneratePress child theme (template).
That solved the “should I include style.css, or rtl.css, or both…” dilema.
Took some trial and error, googling – but child theme is worth the bother, thanks for pointing in that direction.
I can also say that “preliminary” test results (just one week for now) show GeneratePress to give about 1 second faster page load times on average (3 compared to 4, on a very slow, shared hosting server) – same site, similar number of visits. Will write a “full review” of the theme (+ stars) after a few more weeks of testing.
Thanks again – great support, and a pretty good them you’ve made. ??
Thank you very much.
Made a mental note – now in writing ?? to add “excellent support” when I do the theme reveiw.Made it work, if there’s a better solution, please let me know. This is in case there isn’t one and anyone else has a similar problem.
For a full disclosure: I have NO IDEA how WordPress works. The methods for making this work was page-inspection and clicking on GeneratePress site version relevant icons and a different theme that did work icons, comparing, figuring out the names and what is used for what, with a help of a friend who’s also got no idea about WordPress but has some php and css experience. Took us a few hours to make it work, and I’m far from convinced it’s the best, fastest and the most elegant solution.
1) First thing to note
From what I found out, GeneratePress doesn’t use the searchform.php for main menu search button searches (final test of this was completely removing the searchform.php, making sure any page caching is avoided and then seeing that the function still worked perfectly).2) Finding where the search is “defined”.
Turns out the main menu search is set at this directory (within the themes directory, of course):
generatepress/inc/structure/navigation.php3) Editing the navigation.php
if ( ! function_exists( ‘generate_navigation_search’ ) ) {
add_action( ‘generate_inside_navigation’, ‘generate_navigation_search’ );
/**
* Add the search bar to the navigation.
*
* @since 1.1.4
*/
function generate_navigation_search() {
$generate_settings = wp_parse_args(
get_option( ‘generate_settings’, array() ),
generate_get_defaults()
);if ( ‘enable’ !== $generate_settings[‘nav_search’] ) {
return;
}// BEGINNING OF CUSTOM SEARCH CHANGES
// SNIPPED PART
/*echo apply_filters( ‘generate_navigation_search_output’, sprintf( // WPCS: XSS ok, sanitization ok.
‘<form method=”get” class=”search-form navigation-search” action=”%1$s”>
<input type=”search” class=”search-field” value=”%2$s” name=”s” title=”%3$s” />
</form>’,
esc_url( home_url( ‘/’ ) ),
esc_attr( get_search_query() ),
esc_attr_x( ‘Search’, ‘label’, ‘generatepress’ )
));
*/
// THE END OF SNIPPED PART – DIDN’T DELETE IT, JUST TURNED IT INTO A COMMENT, TO BE MORE CLEAR
// CUSTOM SEARCH PART ADDITION
// “MOJ” MEANS MINE IN SERBIAN, HENCE “mojs”$mojs=” <script>
(function() {
// BEGGINING OF COPY-PASTED GOOGLE PROVIDED CODE
var cx = ‘partner-pub-MY_GOOGLE_NUMBER:MORE_GOOGLE_NUMBERS’;
var gcse = document.createElement(‘script’);
gcse.type = ‘text/javascript’;
gcse.async = true;
gcse.src = ‘https://cse.google.com/cse.js?cx=’ + cx;
var s = document.getElementsByTagName(‘script’)[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:searchbox-only></gcse:searchbox-only>”;
// END OF COPY-PASTED GOOGLE PROVIDED CODEecho apply_filters( ‘generate_navigation_search_output’, sprintf( // WPCS: XSS ok, sanitization ok.
‘<form method=”get” class=”search-form navigation-search” action=”%1$s” >
<input type=”search” style=”display:none” class=”search-field” value=”%2$s” name=”s” title=”%3$s” />
%4$s
</form>’,
esc_url( home_url( ‘/’ ) ),
esc_attr( get_search_query() ),
esc_attr_x( ‘Search’, ‘label’, ‘generatepress’ ),
$mojs
));// THE END OF CUSTOM SEARCH ADDITION
}
}4) Making it all look not too bad on desktops and mobiles:
Some Additional CSS added for this purpose. Without the padding the Google search button would overlap with the hteme’s button for closing the search. This was as god as I could make it.
Would have preffered to have the Google searc button always below, but without moving it a bit to the right, it looks bad/overlaps on smaller screens for some reason. Will play with it a bit more.#___gcse_0{
margin-top:60px;
background-color: #222;
}.gsc-search-button{
/*padding-left:0px;*/
/*height:60px;*/
/*width:60px;*/
padding-right:60px;
}
.gsc-input{
/*padding-right:0px !important ;*/
}5) Potential problems:
If google changes their code, this implementation won’t work. So if gsc-search-button (Google Search Custom? ) becomes some other name, the solution won’t work.- This reply was modified 6 years ago by Relja.
OK, it was my mistake – already placing donkey ears on my head. ??
And your reply was very helpful, the sentence “That CSS should work”, coming from the theme author was enough to turn me towards finding out what I did wrong, not looking for other solutions. Thank you. ??The apostrophe signs I copy-pasted were not the correct ASCII characters. I had used these: ‘
Instead of these: ‘
OK – with the forum font, they look exactly the same, but a copy/paste to a different text editor shows the difference.
I case anyone else has a similar problem, the final working solution (viewed source code of the theme that allows in-theme background image setting and positioning) is the following, Additional CSS within GeneratePress appearance settings:
body {
background-image: url( ‘https://www.example.com/wp-content/uploads/2018/10/background_image.jpg’ );
background-position: center center;
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
}First line gives the image address, while the rest is formatting. This setup is a fixed background with no background image scrolling with text scroll.
Fixed the website logo icon to stay in-line with the website name, not below it, again, using Additional CSS:
.site-branding{
display: inline-grid;
}
.site-logo{
float: left;
margin-right: 20px;
}First to thank you for your time and help. For what it’s worth, if the GeneratePress performs well (so far quite good and fast), I’m planning to get the “pro” version.
Digression:
Child themes are for now beyond my grasp – I understand it’s the proper way of editing themes, but for the past three years, the minimal number of edits I’ve made was executed by copying original files (with the .orig extension added), then editing them and keeping the edited copies along. Keeping the list of the few edited files (and directory structure).Adding comments of my edits – so when a theme is updated, I can easily re-do the needed edits.
If a child theme is necessary, I’d need to spend some days learning about that – it’s not a “deal breaker”, just something I’d still like to avoid for now, unless it’s much harder doing it without a child theme.
Google Custom Search:
I’ve set up a custom search engine with Google, using instructions that look very much like these (not sure of the particular how-to link I had originally used, wasn’t wise enough to write it down):
https://www.wpbeginner.com/wp-tutorials/how-to-add-google-search-in-a-wordpress-site/The section “Method 2: Manually Adding Google Search in WordPress” sums up the way I had implemented it, but in the theme I’ve been using, it had worked for the main menu search button as well.
In short, made a page called SearchResults, that had text: “Search results:” and then, in the “text” editing mode of the page (not the WYSIWYG) I copy/pasted the code provided by Google:
<gcse:searchbox-only></gcse:searchbox-only>
Then I copied the searchform code into the searchform.php, so that the code is all there is in the searchform.php:
<script>
(function() {
var cx = ‘partner-pub-SOME_NUMBERS’;
var gcse = document.createElement(‘script’);
gcse.type = ‘text/javascript’;
gcse.async = true;
gcse.src = ‘https://cse.google.com/cse.js?cx=’ + cx;
var s = document.getElementsByTagName(‘script’)[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:searchbox-only></gcse:searchbox-only>This is the way search works on the English website version (different theme, separate WordPress installation on a subdomain: bike.bikegremlin.com), but it won’t work implemented the same way in the Serbocroatian site version, using GeneratePress (bikegremlin.com). The idea is to get it all to work, then switch to GeneratePress “completely”.
bikegremlin.com – the website is in Serbocroatian.
The english website version uses a different theme and that’s the look I’m trying to achieve (separate WordPress installation in the bike.bikegremlin.com subdomain).The reason for trying the GeneratePress is all the good reviews and recommendations in terms of speed (and stability). The website is non-profit, info, about bicycles, but I’ve listed all the setup I’ve done (plugins used, and all the rest) in a couple of posts at this link (for my reference primarily), if that’s of any help:
https://bike.bikegremlin.com/category/gremlin-in-action/it-section-computers-internet/Forum: Fixing WordPress
In reply to: Two-language website setupThanks for the reply. Have looked into the plugin. Apparently, there are people complaining it slows the website performance down. From what i could tell, all the multilanguage plugins have downsides, even the “premium” ones.
My website is not very large – about 10 pages and 130 posts (per language version). But it’s growing about 1 post per week.
Might just leave it as it is, without any multilang support, apart from a choice in the top-right corner that takes you to the alt. language website version. Google searches in each language show the relevant language page version, so it seems to have figured it out without the hreflang. With good page rankings as well – so probably no double content penalties (languages differ vastly, only images are the same).
I’m not selling anything so this seems like too much bother with questionable benefits to the visitors and the google as well.
Considering adding hreflang codes manually on home pages, and a few top-landing pages perhaps, but not sure how exactly to do it or if it has any downsides (like plugins do, in terms of slower website, problems when/if uninstalling them etc.).
Thank you very much for explaining this.
Relja
Forum: Fixing WordPress
In reply to: Related posts – yay or nayTried it.
Functionality is great. But it does slow the site down noticeably.From some things I’ve read (Google not “liking” auto-created links and content), I’m not 100% sure it doesn’t hurt the SEO, much less help it.
Apart from slowing down, it improves the user interdace, making navigation easier.
Forum: Fixing WordPress
In reply to: Search “spy glass” menu for mobile version of the siteAdditional question:
is there a way to change the spyglass size/colour/backgroubd?
At least for the desktop version.Not prepared to make a child theme – seens complicated. Unless I really have to. Fund it easier to write down the changes and re-apply them when uptading the theme.
Thanks in advance for any help.