- TutorialsFrom WPBakery to tagDiv Composer
- TutorialsDefault Block Settings Guide
- TutorialsHow to Update the WPBakery Page Builder plugin
Hi. I have two questions if I may.
First of all. In order to show category on modules we use echo $this->get_category(). However, if you need to show both category and subcategory on module, what do you use and how?
I have tried :
<?php
$categories = get_the_category();
$separator = ' ';
$output = '';
if($categories){
foreach($categories as $category) {
$output .= 'term_id ).'" class= "cats" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '">'.$category->cat_name.''.$separator;
}
echo trim($output, $separator);
}
?>
It works fine, but only for the theme pages (authors, categories, search etc.). The modules just ignoring the php and do not show any category/subcategory on the pages created through visual composer.
Second question. In order to get rid of the title tool-tips I have used some JS snippets.
var imgs = document.getElementsByTagName('img');
for (var i = 0; i < imgs.length; i++) {
imgs[i].removeAttribute('title');
}
var alinks = document.getElementsByTagName("a"); for (var i = 0; i < alinks.length; i++) { alinks[i].removeAttribute("title"); }
Or
var titled = document.querySelectorAll('[title]'); // gets all elements with a 'title' attribute, as long as the browser supports the css attribute-selector
var numTitled = titled.length;
for (i=0; i<numTitled; i++){
titled[i].setAttribute('data-title',titled[i].title); // copies from 'title' to 'data-title' attribute
titled[i].removeAttribute('title'); // removes the 'title' attribute
}
They both work fine. However, after Ajax (load more, filters, mega menu etc.) they come back. So, basically JS resets after the ajax process. Is it possible to somehow implement JS so it works even after ajax?
Any help would be appreciated. Thank you in advance.
Having similar problems.
The big grid slider was replaced by a static grid, I had to add a new grid slider and delete the static grid. Not sure if this is because it is a depreciated Visual composer element.
Haven’t figured out the home logo yet
Hi,
Please provide a link so we can take a look, also you can check this without any plugins active, leave only Visual Composer active, clear cache and see if you still have this issue with megamenu. If you don’t please activate your plugins one by one and see which one caused this issue.
Thanks!
the slider gets messed up by the speedbooster plugin, sooo…here is the code 😉 as I don’t know what I did other than the performance improvement tips ( Is this required? As the performance drops from 93 to 91 after activating it).
<?php
/*
Plugin Name: tagDiv Speed Booster
Plugin URI: http://tagdiv.com
Description: Speed booster for Newspaper and Newsmag theme - It moves the styles and all the scripts of the theme to the bottom when needed. It activates internal theme optimizations for better speed and it adds async js .
Author: tagDiv
Version: 3.2
Author URI: http://tagdiv.com
*/
/*
3.2 - better bbpress support on newsmag
3.1 - fixed issue with flashing white on load on newspaper theme
- better compatibility with themes that do not have wp booster framework
- Newsmag loads fonts in a bundle now
3.0 - better visual composer support
2.8 - Newsmag support added :)
2.7 - fixed ie 9 10 11 window resize bug
2.6 - fixed rendering bug on the loading of the page
2.5 - code improvements, newspaper 4 compatibility
- makes most of the javascript files use defer parsing
- better compatibility with revolution slider
2.4 - updated jquery version
- support for https
2.3 - fixed warnings when trying to move javascript files that are not registered
*/
define('TD_SPEED_BOOSTER' , 'v3.2');
class td_speed_booster {
var $styles_for_footer = array(); // here we keep all the stylesheets IDs that we want to move to the footer
var $is_ie = false; // if the browser is detected as IE, treat it differently
var $async_js_scripts = array(
'contact-form-7',
'bbpress',
'woocommerce',
'site',
'devicepx',
'js_composer_front'
);
var $td_theme_name = '';
var $td_theme_version = '';
var $td_deploy_mode = '';
function __construct() {
add_action('td_wp_booster_loaded', array($this, 'td_wp_booster_loaded'));
}
function td_wp_booster_loaded() {
// read the theme version and name if defined
if (defined('TD_THEME_VERSION') and defined('TD_THEME_NAME') and defined('TD_DEPLOY_MODE')) {
$this->td_theme_version = TD_THEME_VERSION;
$this->td_theme_name = TD_THEME_NAME;
$this->td_deploy_mode = TD_DEPLOY_MODE;
} else {
return;
}
// detect IE 8 9 10 11
if (!empty($_SERVER['HTTP_USER_AGENT']) and (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) || (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false))) {
$this->is_ie = true;
}
// add hooks
add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_hook'), 1002); // 1002 priority - because visual composer has 1000 and we use 1001 in the wp010 theme
add_action('wp_footer', array($this, 'wp_footer_hook'), 15);
if ($this->is_ie === false) {
add_action('wp_head', array($this, 'wp_head_hook'), 15);
}
}
function enqueue_scripts_hook() {
global $wp_scripts;
//detect revmin - revolution slider and do not move jquery
if( !is_admin() and !isset($wp_scripts->registered['revmin'])){
if (is_ssl()) {
$td_protocol = 'https';
} else {
$td_protocol = 'http';
}
wp_deregister_script('jquery');
wp_register_script('jquery', ($td_protocol . '://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'), true, '1.11.1', true);
wp_enqueue_script('jquery');
}
if ($this->td_theme_name == 'Newsmag') {
/* wp 010*/
$this->move_style_to_footer('js_composer_front');
$this->move_style_to_footer('js_composer_custom_css');
}
// Newsmag dosn't move the css to the bottom as such, bbpress should stay at the top
if ($this->td_theme_name != 'Newsmag') {
$this->move_style_to_footer('bbp-default-bbpress'); //bpress old
$this->move_style_to_footer('bbp-default'); //bpress
$this->move_style_to_footer('google-font-rest');
$this->move_style_to_footer('contact-form-7');
$this->move_style_to_footer('genericons');
$this->move_style_to_footer('jetpack');
$this->move_style_to_footer('jetpack-widgets');
$this->move_style_to_footer('jetpack-subscriptions');
$this->move_style_to_footer('sharing-css');
}
/**
* Move the style only on newspaper
* @todo move the style also on newsmag after we fix all the issues
*/
if ($this->is_ie === false and $this->td_theme_name == 'Newspaper') {
$this->move_style_to_footer('td-bootstrap');
$this->move_style_to_footer('td-theme'); //this is the main style of the theme, it depends on td-bootstrap to load
}
$this->move_style_to_footer('woocommerce_frontend_styles');
//jetpack lost styles
$this->move_style_to_footer('jetpack-subscriptions');
$this->move_style_to_footer('jetpack-widgets');
$this->move_style_to_footer('genericons');
$this->move_style_to_footer('jetpack');
$this->move_style_to_footer('td-theme');
$this->move_style_to_footer('sharing-css');
/**
* move javascript to footer
*/
$this->move_js_to_footer('themepunchtools');
$this->move_js_to_footer('revmin');
// remove strange custom.css file loaded by visual composer
wp_deregister_style('js_composer_custom_css');
// replace comment-reply.min.js with inline version
}
function wp_footer_hook() {
//get the theme version for style
$current_theme_version = $this->td_theme_version;
//on demo mode, autogenerate version hourly + day
if ($this->td_deploy_mode == 'demo') {
$current_theme_version = date('jG');
}
foreach ($this->styles_for_footer as $style_id => $style_src) {
echo "<link rel='stylesheet' id='" . $style_id . "-css' href='" . $style_src . "?ver=" . $current_theme_version . "' type='text/css' media='all' />\n";
}
}
function wp_head_hook() {
if ($this->td_theme_name == 'Newspaper') {
echo '<style>body {visibility:hidden;}</style>';
}
}
function move_style_to_footer($style_id) {
global $wp_styles;
if (!empty($wp_styles->registered[$style_id]) and !empty($wp_styles->registered[$style_id]->src)) {
$this->styles_for_footer[$style_id] = $wp_styles->registered[$style_id]->src;
wp_deregister_style($style_id);
}
}
function move_js_to_footer($js_id) {
global $wp_scripts;
if (isset($wp_scripts->registered[$js_id])) {
wp_enqueue_script($js_id, ($wp_scripts->registered[$js_id]->src), '', $wp_scripts->registered[$js_id]->ver, true);
}
}
function async_js_hook($url) {
//check to see if we have js
if (strpos( $url, '.js' ) === false) {
return $url;
}
if ($this->strpos_array($url, $this->async_js_scripts) === false) {
return $url;
} else {
return "$url' defer='defer";
}
}
private function strpos_array($haystack_string, $needle_array, $offset=0) {
foreach($needle_array as $query) {
if(strpos($haystack_string, $query, $offset) !== false) {
return true; // stop on first true result
}
}
return false;
}
}
new td_speed_booster();
-
This reply was modified 11 years by
cem.
thx Alin
unfortunately I’m not able to resolve the issue. At this moment all plugins are deactivated except composer and I get
Fatal error: Call to undefined function get_base_recaptcha_lang_code
I think I played too much with fucntion.php would be cool if someone would take a look and I think the prob for the jquery messages may lay here too.
EDIT: ok I commented the lang part out and now it works, somehow it was anyway double. The slider is also visible now though the thumbs and image are scaled too large, how can fix that one ?
On the jquery error before I assume I activate plugins one by one and see where the pain comes right ? and off I go..
<?php
/* ----------------------------------------------------------------------------
WordPress booster framework - this is our theme framework - all the content and settings are there
It is not necessary to include it in the child theme only if you want to use the API
*/
if (!defined('TD_THEME_WP_BOOSTER')) {
include TEMPLATEPATH . '/includes/td_config.php';
include TEMPLATEPATH . '/includes/wp_booster/td_wp_booster_functions.php';
}
/*include theme.js under newsmag to put modal image on*/
/* include theme.js*/
/*wp_enqueue_script( 'theme-js', get_stylesheet_directory_uri() . '/js/theme.js', array( 'jquery'), NULL, TRUE );*/
remove_action( 'wp_head', 'wp_generator' ) ;
remove_action( 'wp_head', 'wlwmanifest_link' ) ;
remove_action( 'wp_head', 'rsd_link' ) ;
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
add_filter( 'pre_comment_content', 'wp_specialchars' );
function no_errors_please(){
return 'You appear to be up to no good. Please stop now!';
}
add_filter( 'login_errors', 'no_errors_please' );
// and we hook our function via
add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );
function delete_enclosure(){
return '';
}
add_filter( 'get_enclosed', 'delete_enclosure' );
add_filter( 'rss_enclosure', 'delete_enclosure' );
add_filter( 'atom_enclosure', 'delete_enclosure' );
// function remove_cssjs_ver( $src ) {
// if( strpos( $src, '?ver=' ) )
// $src = remove_query_arg( 'ver', $src );
// return $src;
// }
// add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
// add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'jpeg_quality', create_function( '', 'return 65;' ) );
//remove render blocking by jetpack
add_filter( 'jetpack_implode_frontend_css', '__return_false' );
function remove_pingback_url( $output, $show ) {
if ( $show == 'pingback_url' ) $output = '';
return $output;
}
add_filter( 'bloginfo_url', 'remove_pingback_url', 10, 2 );
// add_action('init', 'myoverride', 100);
function myoverride() {
remove_action('wp_head', array(visual_composer(), 'addMetaData'));
}
function dequeue_visual_composer_css() {
if (is_single()) {
wp_dequeue_style('js_composer_front');
}
}
// Defer jQuery Parsing using the HTML5 defer property
if (!(is_admin() )) {
function defer_parsing_of_js ( $url ) {
if ( FALSE === strpos( $url, '.js' ) ) return $url;
if ( strpos( $url, 'jquery.js' ) ) return $url;
// return "$url' defer ";
return "$url' defer onload='";
}
add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
}
// Remove WP version number from js and css files.
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
function tweakjp_add_sharing_js() {
wp_enqueue_script( 'sharing-js', WP_SHARING_PLUGIN_URL . 'sharing.js', array( ), 4 );
$sharing_js_options = array(
'lang' => get_base_recaptcha_lang_code(),
'counts' => apply_filters( 'jetpack_sharing_counts', true )
);
wp_localize_script( 'sharing-js', 'sharing_js_options', $sharing_js_options );
}
add_action( 'wp_enqueue_scripts', 'tweakjp_add_sharing_js' );
function tweakjp_add_sharing_css() {
wp_enqueue_style( 'sharing', WP_SHARING_PLUGIN_URL. 'sharing.css', false, JETPACK__VERSION );
}
add_action( 'wp_enqueue_scripts', 'tweakjp_add_sharing_css' );
-
This reply was modified 11 years by
cem.
Since updating, quite a few of our pages are showing as full width when they should have a sidebar!
I have made sure that Template Settings -> page has got sidebar right selected and that the individual pages have got default template selected but this is making no difference 🙁
These pages do not use any VC elements. Interestingly, if I disable Visual composer all my page templates give an error in nginx and I can’t see anything, yet posts and taxonomies still work fine.
Hi,
Visual Composer doesn’t come by default with this type of icons. Maybe you have used a plugin/extension.
Thanks!
Hi,
We implemented a check, if you add visual composer content to the page on the default template the sidebar is disabled. You can easily override this check by adding the following line in page.php – http://screencast.com/t/WvbLIzGyYj
Hope this helps. If it doesn’t work please provide more details about your pages, what template did you use and details about the blocks used.
Sorry for the trouble you encountered with this update.
Thank you, Emil G.
The following prompt comes after updating to V6:

But when clicking, (Link is: /wp-admin/admin.php?page=vc-color) there comes an error message: “You have not the rights to view his page”
Any help?
Hi,
Your article/link doesn’t exist – http://screencast.com/t/sohKgn4pY7
Any way I have checked an article from your site and this word comes from a share plugin that you use – http://screencast.com/t/i47BJ2U7 Or did you have made custom modifications to the code?
Please disable all yuor plugins except of Visual Composer, clear cache and check again your article.
Thanks!
-
This reply was modified 11 years by
Alin [tagDiv].
Hi,
I have checked your site and you have this js error in the console. Please disable all your plugins leave just Visual Composer active, clear cache and see if you still have issues with log in/registration. If you don’t please activate your plugins one by one and see which one caused this.
Thanks!
Hi,
Do you have any custom modification to the pagination? If not please check this also without any plugins active, leave just Visual Composer active, clear cache and purge your file if you use CDN, then see if you still have this issue.
Thanks!
I love the icon feature in the visual composer. I’d like to use some of the Entypo icons elsewhere on the site. I’ve been unable to find out if there is a code that could be used for this. Does anyone know if there is?
I tried the following:
[vc icon type="entypo" icon_entypo="video" color="#000000" link="url:XXX|title:XXX"]
😉
I sometimes answer sardonically ahead of the official answer, which might be the same but worded differently (as was this case!).
Sadly there is no ‘one way’ to optimize anything with WordPress — as the theme itself needs a little tweaking as with ALL themes (seriously, want to hear about my fun with Canvas or MyThemeShop, ThemeFuse, etc.?).
Most of MY particular tweaks have to do with “baseline” things needed for ANY website/wordpress install -regardless of theme (I am working on an ebook on this topic in my hahahahahah spare time… no really…. someday….).
Theme tweaks are really just setting up site how you want it; and then more recently the pesky Visual Composer stuff (hence the shim of doom, er … solution).
Technically theme doesn’t need any special optimization vs any other site of comparable complexity, but your mileage may vary as I am wont to say.
I will post the cheat sheet on how to load Google Fonts more better good too one of these blue moons. The old method for Newspaper 2 I posted a bazillion years ago sure won’t work now !
Peace and happy trails.
Is this a joke? You erased the possibility of having a side bar when visual composer is used????
Please tell me how i can do to modify my 1000 pages !!!!! PLEASE TELL
I have never seen such a stupid update. Have you talked to users before doing this ?????
I have bought theme just now and I’m not able to make Infinite load work.
Here is my custom home page link:-
http://dailydoser.com/myhome/
Template Selected – “Homepage – blank”
Added 2 elements via Visual composer:-
1. Big Slide
2. Block 9 -> Selected Use ajax & Pagination – infinite load option
What am I doing wrong? This is brand new theme with no extra plugins but still infinite load is not working.
Any pointers in this regard will be appreciated.
I’m seeing javascript error in console while debugging but not sure why that error is coming.
The screen-reader-text class is used more and more in WordPress. There was already a topic in the Newsmag forum complaining about this (https://forum.tagdiv.com/topic/bug-categories-label/) but nobody from the developers did answer 🙁
Please add the following to the default css and release a new Newspaper version (and BTW you could update VisualComposer as well):
.screen-reader-text {
clip: rect(1px, 1px, 1px, 1px);
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
}
This code is suggested by https://make.wordpress.org/accessibility/2015/02/09/hiding-text-for-screen-readers-with-wordpress-core/ and by http://blog.rrwd.nl/2015/04/04/the-screen-reader-text-class-why-and-how/ and it is used in the TwentyFifteen theme delivered with WordPress (https://core.svn.wordpress.org/trunk/wp-content/themes/twentyfifteen/style.css Section 7).
Thanks!
Hi,
I got the Newspaper 4.4 version and since 2 months I got a big problem with the no-possibility to update my homepage louesfera.com because of the Visual Composer. I’m totally stucked because I did not buy personnaly the Newspaper, it was the IT guy (named “carpeher” in the Envato members) that update my old WordPress theme to that new one). So I can’t do nothing alone.
Today searching how to find a solution in that forum, I found a page on how to update the Visual Composer plug-in and I follow the steps : the problem ? I’ve deleted the plug-in and have no other way to have it all working ! Please help !
Thanx in advance.
Louis-Philippe TRAMIER (founder of Louesfera.com)
(Spain)
Hi team,
I want to divide a row with the size 1/2+1/4+1/4 in one of my pages using visual composer. For 1/2 part, I want a single image to cover entire space using block 3. for 1/4 parts i want to use block 4. I am setting post limit to 1. But when I try to do so, some blank space appears after block 3 , i dont want that..how to do implement this?
thanks,
careongo
Hi,
You have these errors in the console – http://screencast.com/t/aGLY6Hjh2 please check this without any plugins active, leave just Visual Composer active, clear cache and see if you still have this issue with gallery.
Unfortunately this delay usually happens when speed booster is used as the css and js are moved at the bottom of the page structure, so that the page will load faster. That’s why the theme’s default style appears first then changes, because of the cascading property of css. To avoid this you could try to make the changes directly into theme’s style file.
I also checked your page source and those css resources are moved to the bottom, you also can check – http://screencast.com/t/vkHNjMZu only jetpack sharing css is not moved – http://screencast.com/t/YGTYW5v11oxY Try to move also that css and see if you still have this issue when you test pagespeed on mobile.
Thanks!
Hello,
I tried to update visual composer but with no luck. I followed this post https://forum.tagdiv.com/update-the-visual-composer-plugin-wpbakery/. I think i have 4.4.4.
I have more than 7000 posts/pages in the database. You can see the website here http://artic.gr sometimes while browsing you’ll see a blank page (this is an out of memory error).
If you think that you can fix my problem, i can make for you a temporary ftp and backend user. I’ll really appreciate this.
Please let me know asap.
Best Regards
Hi,
You can use shortcodes in theme’s ad spots for example if you wnat to display social icons element from Visual Composer, you need to add social icons block to a page, add your social links in the blocks settings and take the shortcode – http://screencast.com/t/KEkzxO0Por8 – http://screencast.com/t/hWbnNa2emkb and paste it in header ad section – http://screencast.com/t/8k3R3aRII
Result: http://screencast.com/t/vymFVYAbd
Also if you want to edit the theme headers please check parts folder – http://screencast.com/t/Xfk5T4rxc5
Thanks!
Hi,
You can create new page(s), choose page template and add blocks from Visual Composer – http://screencast.com/t/3jYhKlXqHoxI Also if you want to use demo’s pages you have to edit each block and set your filter options, block title, pagination… – http://screencast.com/t/P1STUMvc
Thanks!
Yup. Just take all of that out of your style.css file which is what I do.
All those features you keep asking for need to have the code someplace. And better to have one big file, vs. having 10 different CSS files like some sites. That’s the whole idea behind “combining CSS” so only one file gets loaded/cached.
CSS larger for this theme vs hot topix (I use that also), is all those fancy visual composer modules and layouts; which is why you have 50 layout options vs the 3 or 3 with topix — apples to oranges. Why does a V8 engine use more gas has than a 4-cylinder ? Self explanatory – twice the cylinders.
No way for theme to easily generate different CSS and a nightmare for support (where is my WooCommerce CSS? Un, did you activate that option? Where is the option? In the CSS panel. Where is the CSS panel? Did you see the documentation? What is that?) etc. 😉
Just my two cents if we’re all going to chime in on this topic.
Upshot: tweak your site to remove those elements you don’t use, for best performance.
I did have conversation with Radu about what could safely be removed from the config file, also, such as require loading modules for bbpress if not using that. Never got to finishing that process due to the server CPU issues we had due to stupid VC memory leaks or whatever is up with that.
Personally I would prefer to have a MAGAZINE focused theme without all the bbpress, multisite and woocommerce stuff – but 20-30% of people buying this are “wanting” and perhaps “demanding” those features so they are in there (the Magazine theme got bloated from Oct 2013 to Jan 2015 due to this … annoying to me, personally — but this is a “one for all” theme, not a micro niche focused offering; or it would not sell in these competitive themeforest marketplace).
Happy Sunday. Ranting over (rant!!!!)… 🙂
-
This reply was modified 11 years by
simchris.
Hello there, I purchased both Newsmag and later on Newspaper. Initially, I used Newsmag. The theme is great, however, I was not very happy because there are always lines created in the theme whenever I want to create layout by myself using visual composer and its add-ons. I changed it to Newspaper and here are problems that need to be fixed:
1. The article thumbnails need to be recreated. I used Force Regenerate Thumbnails. I have more than 5000 images hosted and whenever i run the plugin, it always stop at around 200 processed images. I know that we can run this plugin on a single or several images, but I dont want to go through post-by-post and find which articles are already used images. Any other way to speed up this process?
2. Regarding big slide: I have two issues:
a. Not like Newsmag, I can not set category filter to “Featured” with Sort Order is set as “Random Posts”. The big slide will be disappeared with this combination;
b. I have many images with white background, and again, whenever it displayed in a slider, then the arrow navigation will not be visible because the background of the image is white. Please fix this and how to make the slider images just like Newsmag. I know that you put color background to keep the post title visible. But without gradien effect, the arrow of left and right navigation would not be visible.
3. Regarding post template, many articles published in the previous theme (Newsmag) are using full post featured iamge position which is not avialbale in the Newspaper theme. Whenever I changed to Newspaper, the article would not visible until I change the post template. Any other way to make this process simple and efficient? I hv already created many articles.
4. My speed test with google using this theme is zero. How come?
Thanks
my wevsite is: gigisusu.net