Hide grid view selections
This topic contains 15 replies, has 4 voices, and was last updated by Barbara Magee 5 years, 3 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
June 26, 2019 at 7:09 pm #494988
Hello,
The gridview List-view option is now missing from our front end gridview selector. I went to the forum and discovered the addition of gridview-1 in the most recent GD update, which is creating the wonky layout mentioned by others in the forum.We are launching our new site tomorrow and just saw the blog post about the new Gridview-1. Besides hiding the new Gridview-1 we also wish to hide gridview select options 4 and 5 on the front end. How would we amend this code to include 4 and 5. We don’t wish to disable 1,4,5 completely, just hide them on the front end.
add_filter(‘geodir_layout_options’,’_my_remove_layout_options’,10,2);
function _my_remove_layout_options($layouts,$frontend){
if($frontend){
unset($layouts[“1”]);
}
return $layouts;
}Thanks for your super support! Writing a review is on our to-do list after we go live.
June 26, 2019 at 7:18 pm #494990On the same subject, my developer tried adding this code and got a white screen error:
add_filter(‘geodir_layout_options’,’_my_remove_layout_options’,10,2);
function _my_remove_layout_options($layouts,$frontend){
if($frontend){
unset($layouts[“1”]);
}
return $layouts;
}
June 26, 2019 at 11:04 pm #495021Hello,
I will flag your question for the developers to let us know if there is a workaround for that.
The original code snippet can be found here, for reference: https://wpgeodirectory.com/release-of-geodirectory-v-2-0-0-61/
June 27, 2019 at 12:05 am #495037Yes, that is the code I gave my developer. Does it make a difference if the code is double-spaced when they try to add it?
June 27, 2019 at 5:06 am #495070Hello Barbara,
Try following PHP snippet to hide layout options.
function gd_snippet_240619_layout_options( $layouts, $frontend ) { if ( $frontend ) { //unset( $layouts["0"] ); // Hide List view unset( $layouts["1"] ); // Hide Grid View (One Column) //unset( $layouts["2"] ); // Hide Grid View (Two Columns) //unset( $layouts["3"] ); // Hide Grid View (Three Columns) //unset( $layouts["4"] ); // Hide Grid View (Four Columns) //unset( $layouts["5"] ); // Hide Grid View (Five Columns) } return $layouts; } add_filter( 'geodir_layout_options', 'gd_snippet_240619_layout_options', 10, 2 );
Kiran
June 27, 2019 at 5:55 pm #495238Hi guys,
Here is the response from my developer when they try to add the code you provided:
“This is a function, not CSS, and somewhere in the copy/paste ' replaced code. This takes your site down as is. Can you share it again with those codes replaced with whatever it should be?”Thanks!
June 29, 2019 at 3:54 am #495390You can add the code with the Code Snippets plugin. There is not a CSS solution available for this outcome.
https://wpgeodirectory.com/docs-v2/faq/customizing/#custom-codeJuly 4, 2019 at 4:50 am #496191We have added the snippets to the functions and did not get any errors. However, View Grid 1, 4 and 5 (the views we are attempting to hide) are still displaying on the front end. My developer is asking “what modifications are needed for their function in order to give the correct layout?”
Your link from above is no longer working: https://wpgeodirectory.com/docs-v2/faq/customizing/#custom-code
Thanks!
July 5, 2019 at 6:21 am #496351Hi Badbara,
Try below code to hide grid 1, 4,5 option. It is working on my local. also if you have any cache plugin. clear cache and browser cache.function gd_snippet_240619_layout_options( $layouts, $frontend ) { if ( $frontend ) { unset( $layouts["1"] ); // Hide Grid View (One Column unset( $layouts["4"] ); // Hide Grid View (Four Columns) unset( $layouts["5"] ); // Hide Grid View (Five Columns) } return $layouts; } add_filter( 'geodir_layout_options', 'gd_snippet_240619_layout_options', 10, 2 );
July 11, 2019 at 6:06 pm #497170We’ve got that code in the functions file. The last line of that code is what identifies which options should show:
‘gd_snippet_240619_layout_options’, 10, 2What we need to know is what number/numbers to replace the 10, 2 with to show View Grid:List, View Grid:2 and View Grid:3 selection options on the front end.
Thanks for your assistance!
July 11, 2019 at 7:23 pm #497195Add gd_loop_actions to the archive template
https://wpgeodirectory.com/docs-v2/geodirectory/design-elements/#gd_loop_actionsJuly 12, 2019 at 6:03 pm #497421We’ve had the gd_loop_actions in the builder since the beginning of site development. What we are trying to do is hide the Grid view 1, 4 and 5 in the dropdown selector that are currently visible to the user on the front end.
The Grid View:1 produces a wonky layout (see attached image), as mentioned by other GD users in the forum, and View 4 & 5 don’t fit in our column width very well, so we just want Grid View List, 2 and 3 available to users to change their layout view.
July 14, 2019 at 6:23 am #497549Hello,
the snippet only hides, so, no need to adjust it to show. It does not appear to be active on the site (or it is not working as expected).
Please share WP Admin and FTP credentials if we need to take a look.
WordPress Credentials
WP Admin Login URL:
WP Admin Username:
WP Admin Password:FTP Credentials
FTP Host:
FTP Port:
FTP User:
FTP Password:July 24, 2019 at 6:53 am #499314Attached is a screenshot verifying the snippet is installed. However, the grid views we are attempting to hide from the “View:grid selector are still displaying on the front end. Screenshot also attached.
What do you suggest next to solve this?
Thanks!
July 24, 2019 at 7:30 am #499319Hi @localdish,
Where you have added the script code?
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket