WordPress.org

Ready to get started?Download WordPress

Forums

How to use shortcode - pricing table (3 posts)

  1. ddzc
    Member
    Posted 2 years ago #

    Hi everyone,

    I'm trying to add a pricing table into my site. I want it on my homepage and the theme that I have requires that I edit the php file. I created the table with one of the pricing table plugins but how do I display it on my homepage? What would I have to put in my php file to show the table. For eg, this was given to me after I created the table: Shortcode to use: [pricing_wpress id="4" style="1"]

    Thanks!

  2. Good Guy
    Member
    Posted 2 years ago #

    Is your table dynamic? i.e. is your price list pulled from the database? If the answer is no then you can create a basic table using normal html tags. Perhaps you should post back to tell us what do you want in your table so that somebody can give you a basic/simple layout here.

    Good luck.

  3. michael.mariart
    Member
    Posted 2 years ago #

    If you are going to use a shortcode like you are, then you don't want to do anything in your PHP files.

    All that you need to do is add that shortcode to your home pages content in the admin area. Shortcodes are meant to be used from inside the content of a page, post, etc, so that you don't have to make any changes to the sites files.

    If you do have to edit the PHP files (I would really hope not...) then it's a bit more complicated, but can still be done. The first thing that you have to do is search your site to find out what function that shortcode is registered to. There will be a function that looks like
    add_shortcode( 'pricing_wpress, 'function_name' );
    When you find that, the part where I have 'function_name' will be the function that the shortcode calls. When you find that you can call it from your PHP file by doing something like this;
    <?php echo function_name (array ("id" => 4, "style" => 1)); ?>
    Of course that might not be the right variables, but that's what I'd asusme they are from your post before.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags