Hide #gd_placecategory_row in the add listing form
This topic contains 15 replies, has 3 voices, and was last updated by Giri 8 years, 6 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
May 11, 2017 at 9:44 am #377851
Hi,
I’m trying to hide the category selector in the add place form ONLY FOR SOME PRICE PACKAGES.
I already had this fonction to create a different class for each packages :
// add the package id to the body
add_filter( ‘body_class’, ‘my_add_package_class’,10,1 );
function my_add_package_class($class){
global $post;
if (geodir_is_page(‘detail’) && isset($post->package_id)) {
$class[] = “gd-package-id-“.$post->package_id;
}
return $class;
}(I know it works because I’m using this classes for hiding something else)
I added this CSS :
.gd-package-id-10 #gd_placecategory_row {
display: none;
}But doesn’t work and no idea what’s wrong on it.
As it is a customisation I can paye if someone find the solution 🙂
Just for information, I want to hide it for some packages because they have only 1 category and I did an automatique selection
Here is the code I added to the “Footer script code” (works perfectly):
jQuery(document).ready(function(){
if(location.pathname == “/add-listing/”)
{
$price_id = jQuery(‘[name=”package_id”]:checked’).val();if($price_id == 1)
{
jQuery(‘#gd_placecategory.chosen_select’).val(’68’).change();
setTimeout(function()
{
jQuery(‘input[name = post_default_category][value = 68]’).attr(“checked”, “checked”);
}, 2000);}
Thanks in advance !
Clem
May 11, 2017 at 6:28 pm #377945Hi,
the function for the body class only works for details pages because of this:
if (geodir_is_page(‘detail’)It doesn’t work for the add listing page.
I asked to the developers to provide the code to make it work in the add listing page too.
Thanks
May 11, 2017 at 11:36 pm #378004Ok I understand now
I’m waiting for the solution
Thanks again Paolo !
May 18, 2017 at 12:47 pm #378941Hi Paolo
Just to know if you had some information from the developers about this piece of code ?
Thanks
Clem
May 18, 2017 at 8:51 pm #379019I reminded them about your question.
Thanks for your patience
May 19, 2017 at 10:03 am #379080Hi clem,
Try changing
geodir_is_page('detail')with
geodir_is_page('add-listing')Let me know how that goes.
Thanks
May 21, 2017 at 4:46 am #379363Hi Giri,
Thanks for your answer, I did some tests and apparently it doesn’t work 🙁
May 22, 2017 at 1:29 pm #379476Hi clem,
In that case post your login credentials. I’ll take a look.
Thanks
PS: Provide the location for the current snippet
May 23, 2017 at 4:04 am #379618This reply has been marked as private.May 23, 2017 at 12:00 pm #379659This reply has been marked as private.May 23, 2017 at 1:15 pm #379668This reply has been marked as private.May 24, 2017 at 2:26 pm #379868Everything in your code is correct except this part.
$class[] = "gd-package-id-".$post->package_id;It should be
$class[] = "gd-package-id-".$_REQUEST['package_id'];Please make sure you are using the correct quotes in code while copy and pasting.
May 24, 2017 at 2:46 pm #379872I did it right away but still not working 😔
// add the package id to the body
add_filter( ‘body_class’, ‘my_add_package_class_add_listing’,10,1 );
function my_add_package_class_add_listing($class){
global $post;
if (geodir_is_page(‘add-listing’) && isset($_REQUEST[‘package_id’])) {
$class[] = “gd-package-id-“.$_REQUEST[‘package_id’];
}return $class;
}The credentials I gave you are still valid in case you want to have a look …
Thanks anyway !!
May 25, 2017 at 9:59 am #379983This reply has been marked as private.May 25, 2017 at 1:30 pm #380014Giri you’re a genius ! 😃
It works perfectly now
Thank you very much …
After 9 months work I will launch the site very soon, I will let Geodirectory know
I will buy 3 other add-ons for my next version (stripe – GD business hours – GD related post ) for the next version
Clem
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket