Build Your Own Business Website header image

Welcome to our Members Only Forum

You are welcome to view the content on our Forum, just scroll down to view this forum post.
If you like what you find and want to be able to post a question, please check out our subscription options.
Please feel free to search the forum using either the Google Site Search above or the forum search below.

Avatar
Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Insert BYOB shortcode content widgets using do_shortcode()
Avatar
Michelle Miller
Florida
Member
Members
Forum Posts: 39
Member Since:
November 3, 2011
sp_UserOfflineSmall Offline
1
December 5, 2012 - 11:10 pm
sp_Permalink sp_Print

Rick,

I want to use "add_action" function to insert [byob-content-widget block=2] to the end of a div tag. Here is the script code I used:

<script type="text/javascript">                
        nmr(document).ready(function($){                     
        $('.nmr_tabContainer').append("<?php echo do_shortcode('[byob-content-widget      block=2]');?>");                                                            
        });
 </script>

I inserted my own code in the widget from "wp-admin"->"appearence"->"widgets".

 

The result didn't get to appended within "nmr_tabContainer" tag at all, but I can see the script code from "view sourcecode" showing:

<script type="text/javascript">                
                nmr(document).ready(function($){                     
                    $('.nmr_tabContainer').append("<div id="byob-content-block-2" class="sidebar"><div class="byob-content-block-2-widgets"><div class="byob-widget-column column-1">
<ul class="sidebar_list"><li class="widget widget_text" id="text-10"><div class="textwidget"><div id="mlcalc-w1">

.... plus whole bunch of my own code showing up here...

</div></div></li></ul></div></div></div>");                                                            
                 });
 </script>

any idea why it isn't working?

Michelle Miller

http://dreamhomequest.com

Avatar
Rick Anderson
Desert Hot Springs, CA
Admin
Forum Posts: 13637
Member Since:
November 8, 2009
sp_UserOfflineSmall Offline
2
December 6, 2012 - 4:09 pm
sp_Permalink sp_Print

Yes, because javascript acts in the reader's browser but my code acts on the server.  You can't use javascript to place a shortcode because all of the shortcode processing is completed before the javascript ever kicks in.

Avatar
Michelle Miller
Florida
Member
Members
Forum Posts: 39
Member Since:
November 3, 2011
sp_UserOfflineSmall Offline
3
December 6, 2012 - 6:03 pm
sp_Permalink sp_Print

Oh, that's right! I have asked this question before, just didn't understand why. Sorry about that!

Michelle Miller

http://dreamhomequest.com

Forum Timezone: America/Los_Angeles

Most Users Ever Online: 228

Currently Online:
19 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Keith W Jones: 1428

Brian Tozer: 1004

Carolin: 982

Heidi Hafner: 508

John Cunningham: 423

Reece Morrel: 353

Newest Members:

emma62755

sharonmarks

emma80233

Tijs de Jong

Daniel Frey

mutek

Forum Stats:

Groups: 8

Forums: 46

Topics: 6995

Posts: 34796

 

Member Stats:

Guest Posters: 6

Members: 6761

Moderators: 2

Admins: 2

Administrators: Rick Anderson, Rick Anderson

Moderators: Pierre Cote, Laura Nugent