• aga2442

    (@aga2442)


    Hello,

    I am doing work for some important pages on my website.

    I use this code to reuse the page title in the important fields of these pages.

    [post_title]

    it works smoothly.

    but this is my purpose:

    I want to show some meta key of the theme I am using again in the page.

    example code: [char_sektor]

    When I use it this way, no data appears and it only appears the way I added it.

    I wonder what I should do to show the sample code I gave above correctly?

Viewing 5 replies - 1 through 5 (of 5 total)
  • threadi

    (@threadi)

    [char_sector] is a shortcode. How is this defined? And what does your question have to do with meta keys?

    Thread Starter aga2442

    (@aga2442)

    @threadi hello, thanks.

    I may have probably defined it wrong.

    I want to explain again what I actually want to do.

    The purpose of the theme I use on my website is the listings system.

    I include car listings.

    It produces content like the [char_sector] I specified when listing car features in the theme I use. example: model year, brand, etc.

    My goal is this: on any car listing page, to reveal that information by reusing the [char_sector] code outside of the theme’s standard display.

    threadi

    (@threadi)

    Maybe I too expressed myself incorrectly. My point is that you have to define a shortcode for [char_sector] that is executed to produce output instead of the shortcode.

    Small example:

    function custom_shortcode_char_sector($att) {
        return 'Hello World';
    }
    add_shortcode('char_sector', 'custom_shortcode_char_sector');

    If you haven’t defined something like this yet, you would have to write a shortcode exactly like this to get the desired output via shortcode

    Thread Starter aga2442

    (@aga2442)

    @threadi

    I added the code you gave to the functions.php file. then I added the [char_sector] to the area I wanted to display. When I refreshed the page: “hello world” text appeared ??

    My goal is to display the relevant data in the area where I added the shortcode.

    threadi

    (@threadi)

    Where are the meta keys stored that you want to output? You wrote something about themes above – but a theme doesn’t have anything like that. What kind of sites do you put these short tags on? What post type do they have? Are these simple pages or do you work with custom post types and if the latter: what are they called? This information is important to be able to show you a way to find a suitable shortcode.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘meta key problem’ is closed to new replies.