Giri
Forum Replies Created
-
AuthorPosts
-
Hi rigots,
Since you are programmer, let me give you tips how it should work.
When it comes to any geodirectory pages, you show always use hooks to modify the page, instead of editing the template.
These are our geodirectory templates.
https://github.com/mistergiri/geodirectory/tree/master/geodirectory-templates
Each template has hooks.
You will see these two words often in that templates
1) do_action
2) apply_filters
do_action hook is used for ADDING NEW CONTENT
apply_filters hook is used for MODIFYING EXISTING CONTENT
In other words the functions hooked to
apply_filters
must always have return statement.
Since we are talking about GD home page, you need to look at this template.
https://github.com/mistergiri/geodirectory/blob/master/geodirectory-templates/geodir-home.php
For example, this line
https://github.com/mistergiri/geodirectory/blob/master/geodirectory-templates/geodir-home.php#L28contain hook like this
do_action('geodir_home_before_main_content');
All you have to do now is make a new function and place your new code inside that function.
PHP can contain html. But it must be between?>
and
<?php
tags.
The function name can be anything.
function this_is_my_custom_function() { ?> your html goes here <?php }
Once thats done, you final job is hook that function.
This is how you should do that.
add_action('geodir_home_before_main_content', 'this_is_my_custom_function');
Hope that helps.
If you need more help refer these pages. Because we don’t have enough time to explain everything.
https://developer.wordpress.org/reference/functions/do_action/
https://developer.wordpress.org/reference/functions/add_action/https://developer.wordpress.org/reference/functions/apply_filters/
https://developer.wordpress.org/reference/functions/add_filter/Thanks
The code I provided would work for all listings.
1) Have you activated the code snippet?
2) What happens when you click the “Send Enquiry” link?
3) Try switching to some other theme and test it.Let me know if none of them solve your problem.
Thanks
add_action( 'geodir_details_main_content', 'custom_details', 31, 1 ); function custom_details($post) { echo 'Address:'.$post->post_address; }
Hi oliver,
you seem like you have enough skills to edit the file. 🙂
please edit the geodirectory plugin via ftp and apply this changes.
Let me know how that goes.
Thanks
Looks like I missed
$
symbol in the code.
Change the text
post->post_author
to
$post->post_author
That will fix your syntax errors.
But you still need the changes I added in my Geodirectory plugin in order to work.
Thanks
what is the error you see?
This reply has been marked as private.Hi Victor,
Try adding this custom css.
.geodir_map_v3_home_map_1-control-div { left: 15px !important; }
Yes you don’t have to remove categories.
I’m glad it works.
Thanks
This reply has been marked as private.Hi Lance,
Please try this code in code snippets.
add_filter('sd_details_output_address', 'modify_sd_details_output_address'); function modify_sd_details_output_address() { global $post; $sd_address = '<div class="sd-address">'; if (isset($post->post_address) && $post->post_address) { $sd_address .= apply_filters('sd_detail_address', $post->post_address, $post); } if (isset($post->post_city) && $post->post_city) { $sd_address .= '<br/>' . apply_filters('sd_detail_city_name', $post->post_city, $post); } if (isset($post->post_region) && $post->post_region) { $sd_address .= ', ' . apply_filters('sd_detail_region_name', $post->post_region, $post); } if (isset($post->post_zip) && $post->post_zip) { $sd_address .= ', ' . apply_filters('sd_detail_zip', $post->post_zip, $post); } $sd_address .= '</div>'; return $sd_address; }
Yes follow guust solution.
But before that, can you try this solution.?
.geodir_category_list_view li.geodir-gridview { float: none !important; display: inline-block; vertical-align: top; }
Thanks
You are welcome 🙂
I have added some filters in GD to modify send enquiry link. It will be availble from next version.
Please post your wp admin details. So I can apply the changes.
You need to use a custom function like this in code snippets
function bp_custom_get_send_private_message_link($to_id,$subject=false,$message=false) { //if user is not logged, do not prepare the link if ( !is_user_logged_in() ) return false; $compose_url=bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?'; if($to_id) $compose_url.=('r=' . bp_core_get_username( $to_id )); if($subject) $compose_url.=('&subject='.$subject); if($message) $compose_url.=('&content='.$message); return wp_nonce_url( $compose_url ) ; } add_filter('b_send_inquiry_url', 'b_send_inquiry_url'); function b_send_inquiry_url() { global $post; $url = bp_custom_get_send_private_message_link($post->post_author); return $url; }
Thanks
-
AuthorPosts