Search Results for 'do_shortcode'

Results from the Forum
Lucian
tagDiv Staff

Hi,

Yes you can do it by adding this code to loop-single.php file:

<?php echo do_shortcode('[vc_row][vc_column width="1/1"][td_ad_box spot_id="custom_ad_3"][/vc_column][/vc_row]'); ?>

like this: http://screencast.com/t/L5bcdJal0, and you will get this result: http://screencast.com/t/CGRi9VLbmy.

Also you will have to style the ad box to lower it a bit using this CSS code, that you will add to your Custom CSS in Thme Panel:

.post .td-a-rec-id-custom_ad_3 {
margin-top: 30px;
}

You will then get this result: http://screencast.com/t/bzUSSMDXnws

Thank you.

Emil G
tagDiv Staff

Hi,

1. To center it you have to add this CSS code to your Custom CSS in Theme Panel:

.td-g-rec-id-custom_ad_3{
padding-left:52px;
padding-right:52px;
}

2. To do that you have to add this code:

 <?php echo do_shortcode('[vc_row][vc_column width="1/1"][td_ad_box spot_id="custom_ad_3"][/vc_column][/vc_row]'); ?>

to the loop-single.php file, like this: http://screencast.com/t/L5bcdJal0

Result: http://screencast.com/t/CGRi9VLbmy

Also you will have to style the ad box to lower it a bit, to do that add this CSS to your Custom CSS in Theme Panel:

.post .td-a-rec-id-custom_ad_3 {
margin-top: 30px;
}

Result: http://screencast.com/t/bzUSSMDXnws

Thank you.

  • This reply was modified 12 years by Emil G.
Marius
tagDiv Staff

Hi,
Try this:
Add this code echo do_shortcode('[ssba]'); like here: http://screencast.com/t/BC9QxywENNff

Thanks!

Peter
Participant
#0

Hi there,

I have set up my site on my local server and had everything working perfectly. I then migrated several times with different methods but each time I have the same broken theme which is currently live: http://coconutoilpost.com

I have gone back to my development site and deactivated all the plugins which then broke mainly the home page. I then worked through and found the issue with your integration with WPBakery Visual Composer, all other plugins work on the development site. The issue was the same with wp 3.9 and with 3.9.1 – Theme version 3.8 – Media Bakery 4.1.2

The issues are:
1. When logged in the front page admin bar not showing
2. Drop down mega menu not working
3. Search bar not working
4. Bottom page related articles pop up not working.
5. Back forward navigation not working.
6. Category Background images not working.

Here we are with the error messages with All plugins turned off:

( ! ) Fatal error: Call to undefined function wpb_js_remove_wpautop() in /Users/Icon/Documents/Websites/coconutoilpost.dev/wp-content/themes/Newspaper/includes/shortcodes/td_text_with_title.php on line 30
Call Stack
# Time Memory Function Location
1 0.0093 310272 {main}( ) ../index.php:0
2 0.0131 313392 require( ‘/Users/Icon/Documents/Websites/coconutoilpost.dev/wp-blog-header.php’ ) ../index.php:17
3 0.1704 21169656 require_once( ‘/Users/Icon/Documents/Websites/coconutoilpost.dev/wp-includes/template-loader.php’ ) ../wp-blog-header.php:16
4 0.2031 21516928 include( ‘/Users/Icon/Documents/Websites/coconutoilpost.dev/wp-content/themes/Newspaper/page-homepage-blank.php’ ) ../template-loader.php:74
5 0.8090 25106152 the_content( ) ../page-homepage-blank.php:13
6 0.8091 25108296 apply_filters( ) ../post-template.php:211
7 0.8106 25112024 call_user_func_array ( ) ../plugin.php:192
8 0.8106 25112056 do_shortcode( ) ../plugin.php:192
9 0.8107 25113504 preg_replace_callback ( ) ../shortcodes.php:201
10 1.5932 29247360 do_shortcode_tag( ) ../shortcodes.php:201
11 1.5933 29247824 call_user_func ( ) ../shortcodes.php:287
12 1.5933 29247864 td_text_with_title->render( ) ../shortcodes.php:287

That’s all I can find at the moment. Hope all can be sorted out.

Many thanks

Peter

Marius
tagDiv Staff

Hi,
Here is the code located: http://screencast.com/t/PpXru48Ew7P

About the nRelate plugin you can place it manually using this:
<?php nrelate_related(); ?>

or this:

<?php echo do_shortcode('[nrelate-related]'); ?>

Add one of this code in post code where you want: http://screencast.com/t/UY99mVWsA

Thanks!

Radu A
tagDiv Member

hi,
the add_filter is a standard function from wordpress not from the theme.
documentation about add_filter : http://codex.wordpress.org/Function_Reference/add_filter

do you have the ‘do_shortcode’ function declared global?

check your code, we cannot offer support for custom code.

Thanks for you message.
Radu A.

davistar
Participant
#0

Hello dear TagDiv team,

I’m not getting shortcodes to work in category description. I’ve tried to add add_filter( ‘category_description’, ‘do_shortcode’ ); to functions.php but sadly it didn’t work 🙁

Do you know why? Thank you!!

Kind Regards

lancelot
Participant
#0

Hi!

I’ve been searching for hours if there is a way to always keep the logged in users the in front-end with the Newspaper theme.

For example, I’d like that the different users have a profile page in the front-end where they can edit their informations.

Another thing I’d like to do is making the “you must be logged in to comment” link call the ajax login system. Is there a shortcode to do this?

For example, with bbPress, if I am not wrong, you can do something like this :

if (!is_user_logged_in()){
    echo do_shortcode( '[bbp-login]'  );
}

Is this possible to do something like this with the Newspaper theme (maybe with a widget)? I really like the ajax login system and I don’t want users go to the WordPress’s admin panel.

Thank you very much!

Marius
tagDiv Staff

Hi,
Add this code

<?php
    if (!is_user_logged_in()){
        echo do_shortcode( '[bbp-register]'  );
    }
?>

In this 2 files at the end above the </div> like here: http://screencast.com/t/FkfdnQpfelgd

Thanks!

r1kay
Participant
#0

Hi,

I would like to know if it’s possible to hide ads from a certain post by adding a custom fields to that post and create a function in functions.php. I really need this option because some of my posts are not confirm google’s policy. Function could look something like this, but i don’t know the name for the ad spots and i lack php skills so don’t know if this works:

function hide_ads($content) {
                global $wp_query;	
		$postid = $wp_query->post->ID;                  
		if (is_single((get_post_meta($postid, 'top_ad', true) != 'off' )))  {
			$top_ad = do_shortcode('[td_ad_box spot_name="Ad spot -- topad"]');
			}

I’m sure it’s possible to make a function that work!!

Also, i would like the ability to show or hide author info per post. This could also be done with a function, but again: i don’t know what the function and custom field meta should look like!

I really hope you can help me!

Marius
tagDiv Staff

Hi,
Is not posible, sorry for that.
What you can do is to use this template: Homepage – with article list and add the slider directly in code, something like here: http://screencast.com/t/wvDhzF7TZVBs

echo do_shortcode('[vc_row][vc_column width="1/1"][td_slide hide_title="hide_title" limit="5"][/vc_column][/vc_row]');

You add the shortcode of the slider there, but the slider doesn’t know on what column is and you need to fix the height via CSS

Thanks for the message!

yoluca
tagDiv Member

am rezolvat … nu vedeam bine de pe mobile…

am adaugat <div style=”display: inline-block”><?php echo do_shortcode( ‘[vc_button title="New topic" target="_self" color="default2" size="default2" href="#new-post"]‘ ) ?></div>

in form-search.php

si <div style=”display: inline-block”><?php echo do_shortcode( ‘[vc_button title="Post reply" target="_self" color="default2" size="default2" href="#new-post"]‘ ) ?></div>

in content-single-topic.php

exact ce imi trebuia ;))

merci

Marius
tagDiv Staff

Salut,

Adauga acest code ca si aici: http://screencast.com/t/vR8Dc0dxDrd

<div style="display: inline-block"><?php echo do_shortcode( '[vc_button title="New topic" target="_self" color="default2" size="default2" href="#new-post"]' ) ?></div>
<div style="display: inline-block"><?php echo do_shortcode( '[vc_button title="Post reply" target="_self" color="default2" size="default2" href="#new-post"]' ) ?></div>

Copiaza acest CSS in Theme panel -> Custom CSS

.bbp-search-form {
  display: inline-block;
}
.bbp-search-wrap {
  margin-bottom: 11px;
}
Marius
tagDiv Staff

Salut,

Acel shortcode poti sa il pui unde vrei tu, daca il pui direct in code il folosesti asa
<?php echo do_shortcode( '[vc_button title="New topic" target="_self" color="default" size="size_large2" href="#new-post"]' ) ?>

sau merge si cu simplu link adica <a href="#new-post">New topic</a>

Pune acest cod oriunde vrei in tema, in meniu, sub meniu.

Marius
tagDiv Staff

Hello,
Not easily, but the easy way is to add it directly in code.
You can make the content with visual composer, switch to classic editor, copy the shortcode and add it as a shortcode directly in code like:

<?php echo do_shortcode('paste your shortcode here') ?>
Edit you template for homeapges are in root like page-homepage-loop.php
Thanks!

Marius
tagDiv Staff

Hello,
What you can do is to use Homepage – with article list, leave the page builder empty, and add the slider directly in file like here: http://screencast.com/t/GQwjEwdEnX

echo do_shortcode('[vc_row][vc_column width="1/1"][td_slide hide_title="hide_title" limit="5"][/vc_column][/vc_row]');

Add a slider in page builder, configure it, then switch to classic editor and take the shortcode and use it live above.

Than you have to add some css to fix the height of the slider like:

@media
(min-width: 768px) and (max-width: 1018px) {
.iosSlider-col-3, .iosSlider-col-3 .item {
height: 310px !important;
}

Hope this help!
Thanks!
}

Anonymous
tagDiv Member

Yes r1kay it’s basically this:

function revv(){
   global $post;
   $test_module_inst = new td_module_1($post);
   $review = $test_module_inst->get_review();
 return $review;
}

function content_injector($content) { 
		global $wp_query;
		global $post;	
		$postid = $wp_query->post->ID;                  
		if (get_post_meta($postid, 'top_ad', true) != 'off' ) {	
			//top_ad code
		} 		
		if (get_post_meta($postid, 'bottom_ad', true) != 'off' ) {	
			//bottom_ad code
		}
		 if (is_single()) {
			$share_after_ad = do_shortcode('[shareaholic app="share_buttons" id="4703992"]');
			$related_after_ad = do_shortcode('[shareaholic app="recommendations" id="4704000"]');
		 }

		$review = revv();
	        
		$content = $top_ad . $content . $review . $bottom_ad . $share_after_ad . $related_after_ad;
		
		return $content; 
}
add_filter('the_content', 'content_injector');

By using the code above you can move the review to the top of the post, bottom, after content and before ad, etc.

Thanks for helping me out Radu.

Also you will need to comment out or remove the function that calls the review on td_module_1.php

r1kay
tagDiv Member

I edited the code a little more and got it working. However, i know run into the same problem as Octavian. The reviews shows up beneath the sharing buttons and comment box i inserted. Can’t we use the include() function to somehow get the get_review working? My code now looks like this:

function content_injector($content) { 
		global $wp_query;	
		$postid = $wp_query->post->ID;                  
		if (is_single((get_post_meta($postid, 'top_ad', true) != 'off' )))  {	
$top_ad = do_shortcode('[td_ad_box spot_name="Ad spot -- topad"]');
} 		
		if (is_single((get_post_meta($postid, 'bottom_ad', true) != 'off' ))) {	
$bottom_ad = do_shortcode('[td_ad_box spot_name="Ad spot -- topad"]');
}
 if (is_single()) {
$custom_share = '<div id="title-deel"><h4 class="block-title"><span>DEEL</span></h4></div>' . do_shortcode('[ssba]');
$facebook_comments = '<div id="title-reageer"><h4 class="block-title"><span>REAGEER</span></h4></div>' . '<div class="fb-comments" data-href="' . get_permalink() . '" data-colorscheme="light" data-numposts="5" data-mobile="false" data-width="700"></div>';
}	
$content = $top_ad . $content . $bottom_ad . $custom_share . $facebook_comments;
return $content; 

}
add_filter('the_content', 'content_injector');

Oh and Octo, u might want to add the if_single code to your ads code like i did to prevent them from showing up on the homepage and other pages!

r1kay
tagDiv Member

Ocatavian, i tried to copy your code and modify it to my own likes, but i only get a blank page. The code looks a little like this

function content_injector($content) { 
		global $wp_query;	
		$postid = $wp_query->post->ID;                  
		if (get_post_meta($postid, 'top_ad', true) != 'off' ) {	
$top_ad = do_shortcode('[td_ad_box spot_name="Ad spot -- topad"]')
} 		
		if (get_post_meta($postid, 'bottom_ad', true) != 'off' ) {	
$bottom_ad = do_shortcode('[td_ad_box spot_name="Ad spot -- topad"]')
}
 if (is_single()) {
$share_after_ad = <div id="title-deel"><h4 class="block-title"><span>DEEL</span></h4></div>; do_shortcode('[ssba]');
$comment_after_ad = <div id="title-reageer"><h4 class="block-title"><span>REAGEER</span></h4></div>; '<div class="fb-comments" data-href="' . get_permalink() . '" data-colorscheme="light" data-numposts="5" data-mobile="false" data-width="700"></div>';
 }	
$content = $top_ad . $content . $bottom_ad . $share_after_ad . $comment_after_ad; 
return $content; 

}
add_filter('the_content', 'content_injector');
Radu A
tagDiv Member

hello,
I have tryd to do something different,
please try this code, if this doesn’t work sorry

function content_injector($content) { 
		global $wp_query;
		global $post;	
		$postid = $wp_query->post->ID;                  
		if (get_post_meta($postid, 'top_ad', true) != 'off' ) {	
			//top_ad code
		} 		
		if (get_post_meta($postid, 'bottom_ad', true) != 'off' ) {	
			//bottom_ad code
		}
		 if (is_single()) {
			$share_after_ad = do_shortcode('[shareaholic app="share_buttons" id="4703992"]');
			$related_after_ad = do_shortcode('[shareaholic app="recommendations" id="4704000"]');
		 }

		$test_module_inst = new td_module_1($post);
		$review = $test_module_inst->get_review();
	        
		$content = $top_ad . $content . $review . $bottom_ad . $share_after_ad . $related_after_ad;
		
		return $content; 
}
add_filter('the_content', 'content_injector');
Radu A
tagDiv Member

hello

try this

function content_injector($content) { 
		global $wp_query;	
		$postid = $wp_query->post->ID;                  
		if (get_post_meta($postid, 'top_ad', true) != 'off' ) {	
			//top_ad code
		} 		
		if (get_post_meta($postid, 'bottom_ad', true) != 'off' ) {	
			//bottom_ad code
		}
		 if (is_single()) {
			$share_after_ad = do_shortcode('[shareaholic app="share_buttons" id="4703992"]');
			$related_after_ad = do_shortcode('[shareaholic app="recommendations" id="4704000"]');
		 }

		$test_module_inst = new td_module_blog();
    $review = $test_module_inst->get_review();
	        $content = $top_ad . $content . $review . $bottom_ad . $share_after_ad . $related_after_ad;
		
		return $content; 
}
add_filter('the_content', 'content_injector');
Anonymous
Inactive
#0

Hi,

I’m trying to do this http://screencast.com/t/kDbmDCa9

Currently I have a function that looks like this:

/*** Adds ads and share/related items

function content_injector($content) { 
		global $wp_query;	
		$postid = $wp_query->post->ID;                  
		if (get_post_meta($postid, 'top_ad', true) != 'off' ) {	
top_ad code
} 		
		if (get_post_meta($postid, 'bottom_ad', true) != 'off' ) {	
bottom_ad code
}
 if (is_single()) {
$share_after_ad = do_shortcode('[shareaholic app="share_buttons" id="4703992"]');
$related_after_ad = do_shortcode('[shareaholic app="recommendations" id="4704000"]');
 }	
$content = $top_ad . $content . $bottom_ad . $share_after_ad . $related_after_ad; 
return $content; 

}
add_filter('the_content', 'content_injector');

I’m wondering how I can run the theme’s get_review() function and assigned it to a variable $review so I can do something like this:

$content = $top_ad . $content . $review . $bottom_ad . $share_after_ad . $related_after_ad; 
return $content; 

I don’t really know my way around PHP that well so I’m not sure if I have to use echo get_review() or something like that to make get_review() output its HTML goodies.

So far everything I’ve tried just brings up a white page when I refresh.

Marius
tagDiv Staff

Hello,
Replace with this code

$buffy ='';
$buffy .= '<div style="text-align: center">';
$buffy .= do_shortcode('[vc_button title="Button" target="_self" color="default" href="#"]');
$buffy .= '</div>';
return $buffy;

all from this function like here: http://screencast.com/t/6zHDP7U1sQd
and change the title of the button and the href link.

Thanks!
Happy New Year 2014!!!

r1kay
tagDiv Member

Well i’ve found another post regarding to the single.php and figured it out myself. Here’s the solution:

$buffy .= '<br><h4 class="block-title"><span>DEEL</span></h4>';
			$buffy .= do_shortcode('[ssba]');

$buffy .= do_shortcode(‘[ssba]’) is the code that triggers my social sharing buttons plugin.

I’ve added this to line 58 in themes/Newspaper/includes/app/modules/td_module_1.php. Any modification to the standard post lay-out (normally made in single.php) can be made in this file.

Marius
tagDiv Staff

You can use in php like

<?php echo do_shortcode('[adrotate group="1"]'); ?>

Thanks

Viewing 25 results - 1,051 through 1,075 (of 1,077 total)