1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to convert a wordpress short code into php

Discussion in 'PHP' started by ashokdhan, Sep 10, 2015.

  1. #1
    hello guys i hope you all well...

    i have php code and short code
    SEMrush
    can anyone tell me how i can convert my shortcode into php code
    i use this but it cannot display create a error.
    <?php echo do_shortcode("[lms_feature_course count="5"]"); ?>
    i need this will done like this
    [lms_feature_course count="5"] = <?php php funtion ; ?>
     
    ashokdhan, Sep 10, 2015 IP
    SEMrush
  2. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #2
    Do you mean something like this:

    
    <?php echo do_shortcode(function_name()); ?>
    
    PHP:
     
    ThePHPMaster, Sep 10, 2015 IP
  3. billzo

    billzo Well-Known Member

    Messages:
    961
    Likes Received:
    278
    Best Answers:
    15
    Trophy Points:
    113
    #3
    Are you doing this inside a post/page editor or in PHP code? If you are doing it in PHP code, I cannot see why you need to use a shortcode at all when you can just do it in code. If you are using the shortcode in the post/page editor, you are best to use add_shortcode() to declare a function to be used to process your shortcode tag.

    And since you are passing in a value with the shortcode, be sure to study the examples using
    $atts.

    https://codex.wordpress.org/Function_Reference/add_shortcode

    Unless I misinterpreted your post.
     
    billzo, Sep 10, 2015 IP