Override widget
This topic contains 17 replies, has 4 voices, and was last updated by Stiofan O’Connor 6 years, 4 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: Override widget
-
AuthorPosts
-
July 14, 2018 at 10:51 am #438415
Hey,
When modifying a theme In V2 RC, I tried to override widget and i thought that i just had to edit only one file but i noticed that one widget is spliced into many files:
– content-widget-listing.php
– content-listing.php
– class-geodir-widget-post-images.php
– etc…Is there a way to override widget that displays listing ?
Thank you
July 14, 2018 at 6:11 pm #438458Hi Pablo,
you shouldn’t modify ANY file and use hooks.
I asked to Stiofan to give you more details, it’d be useful to know what you are trying to achieve to give you better pointers…
Thanks
July 14, 2018 at 6:38 pm #438461Hey,
Thank you for your reply
I want to customize the output html of this widget:
– GD> Listing: Best listingsJuly 14, 2018 at 7:38 pm #438467Can you be more specific about how you want to modify the output?
Like, are you trying to output a field label or value?
July 15, 2018 at 12:46 am #438503Hey,
I want to modify the way listing cards are displayed
– I want to use my html code instead of the outputed by GD> Listing: Best listingsMake sense ?
July 16, 2018 at 9:45 am #438609I’m not 100% sure what u are trying to do, if you are trying to mod the actual listing output info (this can be done in the WP page “GD Archive Item”) or if you mean the surrounding wrappers and cat selectors?
Stiofan
July 16, 2018 at 11:57 am #438624Hey
Thank you for all your answers
First of all im talking about V2 RC
I can edit content-widget-listing.php and content-listing.php by copying them to the geodirectory folder of my theme.
content-widget-listing.php calls content-listing.php the calls archive_item_template_content(); and i’m stuck here.I dropped the idea of overriding GD widget
Im creating a widget to display listings, but I couldn’t find any GD api to grab raw content
Example:
–<?php the_title(); ?>
displays title without any html only text
How can I call the content like address, category, rating stars…
Please advice what is the best way to do this
July 16, 2018 at 12:07 pm #438627You can customise the output just by editing the page shortcodes.
Go to WP>Pages>GD Archive Item>edit
Then you can see a button that has 3 little squares, this will let you add more info, look for the GD psot meta, then u can select any meta info.Stiofan
July 16, 2018 at 3:00 pm #438654Thank you
Actually I’ve already tried the shortcode way
But the shortcake displays all html, example here with title:When I use
<?php echo do_shortcode("[gd_post_title]"); ?>
I get this
<div class="geodir-post-title"> <h2 class="geodir-entry-title"> <a href="http://localhost:8888/wp-listimia/places/alexander-inn/" title="View: Alexander Inn">Alexander Inn</a> </h2> </div>
It’s not about adding or removing elements, what I want is to change the layout:
Add/rearrange htmlJuly 16, 2018 at 4:35 pm #438669You can do everything u want without any php code or templates, we just need to know what u want 🙂 If you can explain that we can help more.
Stiofan
July 16, 2018 at 4:49 pm #438675Hi,
I think the misunderstanding comes from you trying to work on the PHP templates, while Alex and Stiofan are suggesting that you use the shortcodes in the WordPress page assigned as “GD Archive Item”. (see image attached.)
You can do everything with shortcodes and position any elements where you wish. At that point you don’t need to edit the HTML, you can simply add some custom CSS.
Let us know how it goes,
July 16, 2018 at 5:59 pm #438690Thank you guys
Paolo, the problem is that i need to edit HTML to use my layout
I can’t achieve what I want simply with CSS.As i told you im trying to create a theme so i need all this modifications in theme files.
July 16, 2018 at 6:15 pm #438693You can programmatically change the shortcodes to be added to that page via functions.php of your theme. (Stiofan will tell you how asap)
Than you can add the GD classes to your CSS to make them look like your theme custom classes. That way you don’t need to change the HTML at all.
Otherwise you need to build your custom widgets from scratches. That will be a lot easier than trying to modify the plugin html output.
We haven’t documented our custom PHP API for V2 but I think you can easily find all that you need by digging into the files that you wanted to modify.
July 16, 2018 at 6:59 pm #438700Exact !
As I told you I dropped the idea of overriding GD widget
Im creating a custom widget to display listings, but I couldn’t find any GD api to grab raw content.
Example:
– <?php the_title(); ?> displays title without any html only text and this is what I want to achieve for other content.How can I call the content like address, category, rating stars… without any html ?
July 16, 2018 at 7:09 pm #438702In V1 we used geodir_get_post_meta, example: https://wpgeodirectory.com/support/topic/custom-field-output/
TBH I’m not 100% sure Stiofan kept the same API for V2. (He’ll confirm tomorrow as soon as he comes back online).
If that returns any unwanted HTML you can remove it with PHP. http://php.net/manual/en/function.strip-tags.php
Thanks for your patience,
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket