Shortcodes in the sidebar

This topic contains 16 replies, has 4 voices, and was last updated by  Alex Rollin 5 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #464470

    Fernando
    Free User
    Post count: 120

    Hi,

    I see a discussion on shortcodes going on under a different topic. But don’t want to interfere there.
    I am aware that Shortcodes in the sidebar has been discussed several times on this forum. I have been following this topic for sometime as I am interested in displaying dynamic content in the custom field where shortcodes are involved. Also, it is not so difficult to do it on the template.

    But is there any way to create a Custom Field for it as a snippet where you can display Admin Title, Frontend Title etc.?

    Tks.

    #464472

    Kor
    Moderator
    Post count: 16516

    Hi Fernando,

    Thanks for your post. Sorry, I’m not getting this, are you trying to display the listing details on the sidebar? Are you using GDV2 and also, could you possibly share your Website URL here in question so that we could take a look at your GD setup?

    Thanks!

    #464487

    Fernando
    Free User
    Post count: 120

    Hi Kor,

    Thanks for the very quick response.

    I have a snippet for enabling the text and textarea fields for shortcode input.
    But was checking if anyone is aware of creating a predefined field exclusively for short codes. (i.e pre-defined fields in GeoDirectory –> Place Settings.

    The reason is that there is a security threat for having text and textarea enabled for shortcodes sitewide.

    Rgds

    #464535

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Can you explain what situation you are concerned about exactly? ( i don’t really understand )

    Stiofan

    #464618

    Alex Rollin
    Moderator
    Post count: 27815

    It would be best to use an “Admin only” field so that your front end users cannot put random and unwelcome shortcodes into the field.

    #464719

    Fernando
    Free User
    Post count: 120

    Hi,

    Many thanks for the replies.
    I need to display a certain dynamic item right below the category field in the right sidebar.
    This is already done by creating a Text Custom Field for the shortcode. But not satisfied as it is going to be used by Users. Concerned by security issues.

    Rgds

    #464722

    Alex Rollin
    Moderator
    Post count: 27815

    Mark the field ‘Adkin only’ in the field settings so users cannot edit the value

    #464725

    Fernando
    Free User
    Post count: 120

    @alex

    Thanks.
    But this is something that users are supposed to insert.
    Otherwise there wouldn’t be any issue.

    #464727

    Fernando
    Free User
    Post count: 120

    It is also possible to hardcore the entire shortcode and the request the front end Users to insert only a figure (i.e. ID number in figure).
    I believe it has to be done by using a function code snippet.
    Tried a few but no success yet.

    #464785

    Alex Rollin
    Moderator
    Post count: 27815

    Yes, that sounds right.

    You can find a freelancer here to help you with customizations like that:

    https://geodirectoryexperts.com/experts/

    #464912

    Fernando
    Free User
    Post count: 120

    @alex

    It’s Okay.
    I’ll try to find a way to sanitize it before getting into the database.

    Thanks.

    #464920

    Fernando
    Free User
    Post count: 120

    Hi,

    Can someone please tell me if the following code needs to be sanitized any further?
    function my_custom_field($html,$location,$cf){
    $html = do_shortcode( $html );
    return $html;
    }
    add_filter(‘geodir_custom_field_output_text’,’my_custom_field’,15,3);

    Thanks.

    #465585

    Fernando
    Free User
    Post count: 120

    If anyone interested more information is here in GDV2
    geodirectory/includes/custom-fields/

    – Rgds

    #469667

    Fernando
    Free User
    Post count: 120

    Hi,

    I can use the shortcode (Places->Tabs->Custom Fields) on the tabs and make them accessible from the listing page and also from the side bar. The shortcode is something like [myinfo id=1]. Here the “myinfo” remains same but obviously the “id” (variable) changes. What I want to achieve here is allow the users to insert only the number (i.e. 1, 3, 7 etc) from the front end.
    How would I make a filter to achieve this?

    Thanks.

    #469792

    Alex Rollin
    Moderator
    Post count: 27815

    Get the iD?
    https://developer.wordpress.org/reference/functions/get_the_id/

    We have a feature request on file to create a ‘raw’ output of gd_post_meta, which, in theory, could be useful for inserting a custom field value into another shortcode. We will post an update here if we decide to implement that in the future.

    In the meantime you would need to customize to achieve what you are looking for.

Viewing 15 posts - 1 through 15 (of 17 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket