Get value from html

WordPress Resolved
23 September, 2020 03:14:48
Peter
Topics: 2
Messages: 6
Hello,

Your plugin works very well for me, I think it's the best solution on the market.

But I have one problem: the shortcode [e2pdf-content key="locked"]Dummy text[/e2pdf-content] doesn't work for me nor [post_content]. The problem is that I don't have custom meta field for the price and I need to put in PDF somehow.

Ideally I would like to take value straight from html markup as this value is fetched from google sheets. Can it be done with js or php? Or maybe you can recommend other solution for this.

Thank you!
23 September, 2020 05:28:45
E2Pdf
Support
Topics: 7
Messages: 3156
Hi, thank you.

Can you please confirm: [post_content] currently contains 'price' value? Is it correct?

----------------------------------------------

If you need to output "price" value from [post_content] in separate field/object you can try to complete task with preg_match_all filter, as in this example, however it will be need to identify it somehow to match: https://e2pdf.com/support/desk/how-to-show-image-gallery.

----------------------------------------------

If it's not in separate field/object than it looks like it will be need to add custom shortcode with current way: https://codeshare.io/aYQY9Q. It must be added to functions.php

After adding shortcode and filter which will allow using it inside E2Pdf Template, you can add to template:

[e2pdf_custom_price][post_content][/e2pdf_custom_price]

$content inside function will contain rendered [post_content] shortcode, so you will need to extract needed value with PHP from it and assign to $value.

----------------------------------------------

Let us know please if it will be any issues or misunderstanding in completing the task. Thank you.

We remain at your service.

We would really appreciate your feedback at WordPress.org!
23 September, 2020 06:05:25
Peter
Topics: 2
Messages: 6
Hello, thank you for a quick answer! I appreciate it.

I'm sorry I think I misled you. I have a custom post type with custom meta field "cena". In this price meta field I use a shortcode to fetch data from google sheets.

For now it works only if I put google sheet shortcode directly to E2pdf Template, but when I use [meta key="cena"] instead it outputs my google sheets shortcode, not the actual content.

Is it possible to skip [post_content] and output rendered information from a shortcode? Or take this value directly from html?

Thank you!
23 September, 2020 06:34:31
E2Pdf
Support
Topics: 7
Messages: 3156
Current behavior connected with security restriction and E2Pdf restrict firing shortcodes 2nd time. So you need just to fire shortcode that is located under [meta key="cena"] field?

If so, see please this updated function: https://codeshare.io/ad39RR

Inside E2Pdf Template it must be used:

[e2pdf_custom_price][meta key="cena"][/e2pdf_custom_price]

We remain at your service.
We would really appreciate your feedback at WordPress.org!
23 September, 2020 11:54:36
Peter
Topics: 2
Messages: 6
Thank you so much for your help!

I wish I needed more than one template so I could buy your plugin and use your support.
Least I can do is write a review for you.
24 September, 2020 01:17:25
E2Pdf
Support
Topics: 7
Messages: 3156
Thank you!
We would really appreciate your feedback at WordPress.org!