Shortcode in template

WordPress Released
16 March, 2020 07:08:17
Topics: 4
Messages: 12
Hi!

What a great plugin you guys have! I am using it to get custom post types printed on labels. Each label has a barcode. I'm looking for a way to get the barcode (which is created with a shortcode: [barcode text='12345' type=code128]) within the template.
Could you guys help me out a little.

I have basic knowledge of php en wordpress backend if needed.
16 March, 2020 07:49:43
E2Pdf
Support
Topics: 7
Messages: 2298
Hi, thank you.

Can you please clarify some information:

1. Does your meta values contains just text (12345) from which you need to generate barcode?
2. Do you have this shortcode inserted inside page body?
3. Which plugin are you using to generate barcodes?

We remain at your service.
If you appreciate our support , we would really appreciate your feedback at WordPress.org!
16 March, 2020 08:21:53
Topics: 4
Messages: 12
Hi and thank you for the quick reply.

1. No 12345 is a placeholder for now. 12345 should be replaced with the title of the current post.
like this: [barcode text='<?php get_the_title();?>' type=code128]. But first things first, a 12345 would be a small victory.

2. I have the shortcode displayed on the post as well. This however is not per se necessary

3. The plugin: https://nl.wordpress.org/plugins/barcode-qrcode-generator/
17 March, 2020 04:40:17
E2Pdf
Support
Topics: 7
Messages: 2298
Hi,

To accomplish this task please update plugin to latest version (1.10.07). After this follow instruction below:

1. Create E2Pdf Image object inside template with [post_title] as "value" if you need to generate barcode from title. (Screenshot 1)

2. Copy and add filter to your theme functions.php https://codeshare.io/5DyDRp. Modify the values of Template ID (46) and Element ID (2) according to your values. (Screenshot 2 attached with information where you can find Template ID and Element ID).

After this steps barcode must be generated from the title. Let us know please if there will be any issues. Thank you.

P.S. [barcode text='12345' type=code128] will also work properly if set as "value" inside Image Object.

We remain at your service.
If you appreciate our support , we would really appreciate your feedback at WordPress.org!
17 March, 2020 05:57:00
Topics: 4
Messages: 12
Awesome!