• Resolved seanchk

    (@seanchk)


    I have a site and each post has an ics link in a custom field.

    How do I get that ics link from the custom field into the shortcode?

    Thanks,

    Sean

Viewing 1 replies (of 1 total)
  • I’m not quite sure I understand what you’re trying to do, but if you have the ICS link, you should just paste it into the url attribute of the shortcode.

    If you’re talking about putting the shortcode into your post template so the calendar gets inserted in the page automatically, just using the URL that’s in your custom field, then you’d want to do something like this… (I’m assuming here that you’re using Advanced Custom Fields… if not, replace get_field('…') with the method you typically use to get the value of the custom field.)

    <?php echo do_shortcode('[ics_calendar url="' . get_field('…') . '"]'); ?>

    Replace with the name of your custom field.

    If you haven’t used do_shortcode before, you’re basically just putting the shortcode text string into the function as the first input parameter. I’ve omitted any of the other attributes here, but you can add any of the regular ones from the plugin here… title, description, view, etc.

Viewing 1 replies (of 1 total)

The topic ‘Using shortcode with advanced custom field’ is closed to new replies.