Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

How i show same shortcode value in different place

Open xperter opened this issue 11 years ago • 7 comments

Hi I have a shortcode and i like to print same saved value in another place. Like i have shortcode name xyz and i need get the save value (not options) which saved in db.

I have tried with fw_get_db_ext_settings_option() but nothing found any value in shortcodes

Is it possible to print another place ??

Thanks for your help

xperter avatar May 02 '15 05:05 xperter

Hello, It's not possible.


Similar issue https://github.com/ThemeFuse/Unyson/issues/497


Imagine you have

[section][row][col][xyz/][xyz/][xyz/][/col][col][xyz/][button/][/col][/row][/section]
[section][row][col][xyz/][divider/][xyz/][/col][col][button/][/col][/row][/section]
[section][row][col][button/][divider/][button/][/col][col][xyz/][/col][/row][/section]

How will you get the value of a specific xyz shortcode? If there was a function to access shortcodes db values, how will you specify in function parameters which shortcode you want to access?

ghost avatar May 02 '15 06:05 ghost

Hi @moldcraft

Maybe i cant tell you clearly :( let me clear. we have create a shortcode called xyz and view.php we can print all the option details with fw_print('$atts')

I wanna print xyz $atts another place so we can get the same result which saved in xyz shortcode. and if i change anything in xyz shortcode from page there will be same result.

i just need to enter xyz shortcode $atts so i can use this anywhere I thing you clear now :)

Thanks for your help

xperter avatar May 02 '15 09:05 xperter

Sorry, I don't understand. Please try to explain again (with more concrete details) or maybe someone who is reading this, understood you and can describe your question better. Thanks

ghost avatar May 02 '15 17:05 ghost

@xperter Please check the solution here https://github.com/ThemeFuse/Unyson/issues/275#issuecomment-94061237

I think @moldcraft explained it very good. If you have more than one instance there is no way that your external function will know from which shortcode to get the options.

pnpetroff avatar May 02 '15 19:05 pnpetroff

@pe6o Unyson team doing great job. i dont see anywhere like them. specially moldcraft and valeriuzdrobau brothers are great :)

Thanks brothers

xperter avatar May 03 '15 04:05 xperter

Alright, I am making a Portfolio Grid shortcode with an AJAX "Load More" button. The problem is that when the button is pressed I can't work with the options field of the shortcode.

I am sending some variables with JS and data attributes but there are some complex ones like arrays but there is no way that I can reach the $atts variable of the shortcode...

Or is there?

pnpetroff avatar May 18 '16 13:05 pnpetroff

I am sending some variables with JS and data attributes but there are some complex ones like arrays

<div data-atts="<?php echo fw_htmlspecialchars(json_encode($atts)); ?>"></div>

then using those in javascript isn't a solution?

ghost avatar May 18 '16 14:05 ghost