Skip Navigation

[Closed] Theme Shortcode not working in View

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 9 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

This topic contains 12 replies, has 3 voices.

Last updated by Paweł Pela 9 years, 6 months ago.

Assisted by: Paweł Pela.

Author
Posts
#242855

I am using a shortcode that comes with the Avada theme to create tabs in a view. The view is creating just one of the tabs. It is then inserted into a Content Template that has other tabs.

This shortcode is not working though to create the tab: [fusion_tab title="Discounts/Coupons"]
It is putting some of the code, but not the ID # for the tab - therefore the tab isn't displaying. It is putting this: <div class="tab-pane fade" id>
instead of this: <div class="tab-pane fade" id="dbce051fca73cf9a9">

Do you have any ideas on how I can get this tab to work inside the View? It is working great in the Content Template.

#243009

Hi julieM-2,

Could you post a downloadable URL for the Avada theme, and describe detail steps to duplicate same problem, I need debug in my localhost. thanks

#245871

Sure. It is a theme I purchased, but I've uploaded a zip file for you. You can download it at: hidden link

I have a content template with the following code that sets up the tabs:
[fusion_tabs layout="horizontal" justified="" backgroundcolor="" inactivecolor="" class="" id=""]
[wpv-if photos="wpcf-listing-photos" evaluate = "!empty($photos)" debug="true"]
[fusion_tab title="Photos"]<script type="text/javascript" src="hidden link"></script>
<script type="text/javascript" src="/wp-content/themes/Avada-Child-Theme/js/jquery.sudoSlider.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var sudoSlider = $("#slider").sudoSlider({
responsive: true,
prevNext: true,
numeric:false,
continuous:true,
slideCount: 1
});
});
</script>
<style>
#container, #slider {width: auto;}
#slider, #slider img {width: 100%;}
</style>
<div id="slider">[types field="listing-photos" size="large" resize="proportional"][/types]
</div>

[/fusion_tab][/wpv-if]
[wpv-if address="wpcf-physical-address" evaluate = "!empty($address)" debug="true"]
[fusion_tab title="Driving Directions/Map"]
[map address="[types field="physical-address"][/types][types field="physical-address-2"][/types], [types field="physical-city"][/types], [types field="physical-state"][/types] [types field="physical-zip"][/types]" type="roadmap" infobox_content="[wpv-post-title]" width="100%" height="400px" zoom="12" scrollwheel="yes" scale="yes" zoom_pancontrol="yes" popup="yes" class="" id=""][/map]
<script type="text/javascript">
function openDirections(url)
{
window.open(url);
}</script>
<div id="directionsform"><form name="directions"><input type="text" name="saddr" class="long" value="Starting Location" /><input class="dirsubmit" type="button" value="Get Directions" onclick="openDirections('hidden link)" /><input type="hidden" name="daddr" value="[types field="physical-address"][/types][types field="physical-address-2"][/types], [types field="physical-city"][/types], [types field="physical-state"][/types] [types field="physical-zip"][/types]" /></form></div>[/fusion_tab][/wpv-if]
[wpv-view name="Coupon"]
[/fusion_tabs]

The first two tabs are working great. The third tab is created using a View because that content is from a fields table separate from the actual listing. The post type Coupon is a child of the Listing post.
Here is the code from the Coupon View:

[wpv-layout-start]
[wpv-items-found]

<script type="text/javascript">
function PrintElem(elem)
{
Popup($(elem).html());
}

function Popup(data)
{
var mywindow = window.open('', 'discounts', 'height=400,width=650');
mywindow.document.write('<html><head><title>Print Coupons</title>');
mywindow.document.write('<link rel="stylesheet" href="/templates/foley/css/couponprint.css" type="text/css" />');
mywindow.document.write('</head><body >');
mywindow.document.write(data);
mywindow.document.write('</body></html>');
mywindow.document.close();
mywindow.print();
return true;
}</script>
[fusion_tab title="Discounts/Coupons"]
<!-- wpv-loop-start -->
<wpv-loop>
<div id="coupon"><div><h2>[wpv-post-title id="$current_page"]</h2>
<p class="address">[types field="physical-address" id="$current_page"][/types][types field="physical-address-2" id="$current_page"][/types], [types field="physical-city" id="$current_page"][/types], [types field="physical-state" id="$current_page"][/types] [types field="physical-zip" id="$current_page"][/types] • [types field="local-phone" id="$current_page"][/types]</p>
<h3>[types field="offer-name"][/types]</h3><p class="coupondescrip">[types field="offer-description"][/types]</p><p class="disclaimer">[types field="offer-disclaimer"][/types] [wpv-if enddate="wpcf-offer-end-date" evaluate = "!empty($enddate)" debug="true"]Expires: [types field="offer-end-date" style="text" format="m/d/Y"][/types].[/wpv-if] [wpv-if code="wpcf-offer-code" evaluate = "!empty($code)" debug="true"]Offer Code: [types field="offer-code"][/types][/wpv-if]</p></div></div><input type="button" value="Print Coupon" onclick="PrintElem('#discounts')" class="button small default" />
</wpv-loop>
<!-- wpv-loop-end -->
[/fusion_tab]
[/wpv-items-found]
[wpv-no-items-found][/wpv-no-items-found]
[wpv-layout-end]

#246047

Thanks for the details, I download the theme file and install in my localhost, but the shortcode fusion_tabs can not be resolved, it display as text.
And I can not find where is the problem div class="tab-pane fade", could you duplicate same problem in a test site, and fill below private details box with the login details, also point the problem page URL and problem view URL, I need debug in a live website, thanks

#246102

Thanks. We are still working on a test site, so I'll give you those credentials.

Listing Details ALL - is the Content Template
Coupon - is the View

Here's a link to a page it should be working on: hidden link

If you look in the source code you'll see this line <div class="tab-pane fade" id>
That is where it should have an id number like the other tabs.

Thanks so much for your help on this.

#246397

I can see the problem div in your test site:
hidden link

<div class="tab-pane fade" id> 

resolved from the shortcode in your view "Coupon":

[fusion_tab title="Discounts/Coupons"]

But I am not sure plugin or theme produce it, could you post the PHP source code of it? or post a downloadable URL for it, I need duplicate same problem and debug in my localhost. thanks

#246481

Where would I find the php?

#246560

The shortcode [fusion_tab] PHP source codes is in the plugin "Fusion Core", you can try deactivate this plugin, check the problem page in front-end, you will see the shortcode isn't been resolved, and display as plain text.

And the FTP access you provide in the private details box isn't valid, I get this error:
530 Login authentication failed
Status: Check your login credentials. The entered password starts or ends with a space character.
Error: Critical error: Could not connect to server

So I can not duplicate same problem and debug in my localhost, Please post a download able URL for the plugin "Fusion Core".
And it is out the range of Toolset, you can also Check out our certified partners:
https://toolset.com/consultant/

#247583

I reput in the ftp details. Please try them again. They are working now for me. Thank you for your help!

#247668

There is a easy workaround:
Move the shortcode [fusion_tab] from your view to content template:
1) I have modified the problem content template "Listing Details - ALL", the codes in it, from:

[wpv-view name="Coupon"]

To:

[fusion_tab title="Discounts/Coupons"] 
[wpv-view name="Coupon"]
[/fusion_tab]

2) codes in the problem view "Coupon", from:

...
[fusion_tab title="Discounts/Coupons"] 
	<!-- wpv-loop-start -->
...
	<!-- wpv-loop-end -->
[/fusion_tab]
...

To:

...
	<!-- wpv-loop-start -->
...
	<!-- wpv-loop-end -->
...

See the result page:
hidden link

#247793

Yes I said originally that it works great in the content template, but not every listing has a coupon. So I only need it to display when there is one. If you put it directly in the content template, the tab shows the whole time. I thought about doing an if statement to see if the coupon view is empty and not display the tab, but from what I read on the forums it isn't possible to do that type of if statement. That's why I needed the tab to be in the view as well and only display when there is a coupon. Any other ideas?

#247866

Did you add in some code to disable the jquery datepicker on that content template? It is no longer working on those pages.

#248968

Dear Julie,

For checking if a post has children (Coupons), you can create what's called a View inside a View.

You can query for child posts of type Coupon and then just put the appropriate code in the wpv-items-found section and remove the wpv-loop which is unnecessary here (as I think there's only one coupon per listing).

It would look something like this: http://pastebin.com/yLGqCC8m

As for the second question, please tell me where I can find those errors, on which page?

Regards,
Paweł

The topic ‘[Closed] Theme Shortcode not working in View’ is closed to new replies.