Home User profile
tagDiv Member
This user did not write anything. So we are just showing here some random text to make the profile page look nice :)
aleister
tagDiv Member

Hi,

Sorry for messy code, tried code tag but will use pastebin from now on.

I copy pasted the part you gave and recieved a new error: IMGur Error Image

And here is how I pasted it to wp_booster_functions, the entire code: http://pastebin.com/v9XFKkV8

aleister
tagDiv Member

This is the error I get:

Parse error: syntax error, unexpected 'and' (T_LOGICAL_AND) in /home/sitename/public_html/wp-content/themes/Newsmag/includes/wp_booster/td_wp_booster_functions.php on line 1656

and the code I use is

/* —————————————————————————-
* modify the main query for category pages
*/
add_action(‘pre_get_posts’, ‘td_modify_main_query_for_category_page’);
function td_modify_main_query_for_category_page($query) {

//checking for category page and main query
if(!is_admin() and is_category() and $query->is_main_query()) and (is_front_page() and is_home() )){

// get the category object – with or without permalinks
if (empty($query->query_vars[‘cat’])) {
td_global::$current_category_obj = get_category_by_path(get_query_var(‘category_name’), false); // when we have permalinks, we have to get the category object like this.
} else {
td_global::$current_category_obj = get_category($query->query_vars[‘cat’]);
}

// we are on a category page with an ID that doesn’t exists – wp will show a 404 and we do nothing
if (is_null(td_global::$current_category_obj)) {
return;
}

//get the number of page where on
$paged = get_query_var(‘paged’);

//get the filter_by` URL($_GET) variable
$filter_by = get_query_var('filter_by');

//get the limit of posts on the category page
$limit = get_option('posts_per_page');

//echo $filter_by;
switch ($filter_by) {
case 'featured':
//get the category object
$query->set('category_name', td_global::$current_category_obj->slug);
$query->set('cat', get_cat_ID(TD_FEATURED_CAT)); //add the fetured cat
break;

case 'popular':
$query->set('meta_key', td_page_views::$post_view_counter_key);
$query->set('orderby', 'meta_value_num');
$query->set('order', 'DESC');
break;

case 'popular7':
$query->set('meta_key', td_page_views::$post_view_counter_7_day_total);
$query->set('orderby', 'meta_value_num');
$query->set('order', 'DESC');
break;

case 'review_high':
$query->set('meta_key', td_review::$td_review_key);
$query->set('orderby', 'meta_value_num');
$query->set('order', 'DESC');
break;

case 'random_posts':
$query->set('orderby', 'rand');
break;
}//end switch

// how many posts are we showing in the big grid for this category
$offset = 5;

// offset + custom pagination - if we have offset, WordPress overwrites the pagination and works with offset + limit
if(empty($query->is_feed)) {
if ( ! empty( $offset ) and $paged > 1 ) {
$query->set( 'offset', $offset + ( ( $paged - 1 ) * $limit ) );
} else {
$query->set( 'offset', $offset );
}
}
//print_r($query);
}//end if main query
} `

it was

/* ----------------------------------------------------------------------------
* modify the main query for category pages
*/
add_action('pre_get_posts', 'td_modify_main_query_for_category_page');
function td_modify_main_query_for_category_page($query) {

//checking for category page and main query
if(!is_admin() and is_category() and $query->is_main_query()) {

// get the category object - with or without permalinks
if (empty($query->query_vars['cat'])) {
td_global::$current_category_obj = get_category_by_path(get_query_var('category_name'), false); // when we have permalinks, we have to get the category object like this.
} else {
td_global::$current_category_obj = get_category($query->query_vars['cat']);
}

// we are on a category page with an ID that doesn't exists - wp will show a 404 and we do nothing
if (is_null(td_global::$current_category_obj)) {
return;
}

//get the number of page where on
$paged = get_query_var('paged');

//get the filter_by` URL($_GET) variable
$filter_by = get_query_var('filter_by');

//get the limit of posts on the category page
$limit = get_option('posts_per_page');

//echo $filter_by;
switch ($filter_by) {
case 'featured':
//get the category object
$query->set('category_name', td_global::$current_category_obj->slug);
$query->set('cat', get_cat_ID(TD_FEATURED_CAT)); //add the fetured cat
break;

case 'popular':
$query->set('meta_key', td_page_views::$post_view_counter_key);
$query->set('orderby', 'meta_value_num');
$query->set('order', 'DESC');
break;

case 'popular7':
$query->set('meta_key', td_page_views::$post_view_counter_7_day_total);
$query->set('orderby', 'meta_value_num');
$query->set('order', 'DESC');
break;

case 'review_high':
$query->set('meta_key', td_review::$td_review_key);
$query->set('orderby', 'meta_value_num');
$query->set('order', 'DESC');
break;

case 'random_posts':
$query->set('orderby', 'rand');
break;
}//end switch

// how many posts are we showing in the big grid for this category
$offset = td_api_category_top_posts_style::_helper_get_posts_shown_in_the_loop();

// offset + custom pagination - if we have offset, WordPress overwrites the pagination and works with offset + limit
if(empty($query->is_feed)) {
if ( ! empty( $offset ) and $paged > 1 ) {
$query->set( 'offset', $offset + ( ( $paged - 1 ) * $limit ) );
} else {
$query->set( 'offset', $offset );
}
}
//print_r($query);
}//end if main query
}`

I believe this part is the error


<code>        // how many posts are we showing in the big grid for this category
        $offset = td_api_category_top_posts_style::_helper_get_posts_shown_in_the_loop();

Any directions would be very welcome,
Site is http://www.technopat.net

Thank you

  • This reply was modified 10 years by aleister.
  • This reply was modified 10 years by aleister.
aleister
tagDiv Member

Well with newest update I wasn’t able to place your code correctly in wp_booster_functions.php. Do you have any ideas Emil?

Kind Regards

aleister
tagDiv Member

Number 6, I mean having different click links for different category backgrounds is also very important to us. Looking forward to seeing this option. Because when I link an ad in homepage and a different ad in subsection background, they forward to same link. Problem is, these different ads are from direct competitors and they don’t like it.

Best Regards,

aleister
tagDiv Member

Yep I tried older versions too, your staff kindly provided older versions. Yet it only seemed to work for a shot time then I realised it was a momentary thing.

And the code you provided worked like charm. You can see it at https://www.technopat.net It’s without visual composer or any of the plugins provided, just Newsmag.

Thank you,

  • This reply was modified 11 years by aleister.
aleister
tagDiv Member

Hi Floda,

As far as I know they have to create a new theme from stratch for that. A theme is designed for certain size or sizes at the beginning and that’s pretty much it. Newsmag only has 1021px width.

Regards,

aleister
tagDiv Member

Well we tried all the suggestions, but in the end VC and Newsmag combination is broken in our system no matter which combination we try. I have already invested too much time to trying these theme-plugin version combinations and disabling other plugins, trying with different themes.

Also in these changes our ad serving got problematic with theme changes deleting ad zone codes and I had to replace them all. Calculate lost impressions and delivery time of campaigns.

In the end CPU spike was too much pain so we have rolled back to Newsmag 1.6, uninstalled Visual Composer and changed homepage into blogroll.

Theme is great, VC is great but they don’t scale well with lots of traffic. But I still like it, it’s foundations are strong, support staff is working. I hope these problems will be solved in a month, next update etc. and we will be able to use a different homepage design and also keep it fast and bug free.

Thank you again, I’ll be waiting for an update.

  • This reply was modified 11 years by aleister.
aleister
tagDiv Member

I have the same problem, using Visual Composer 4.3.5 with Newsmag 1.7 and I can’t edit Homepage anymore. Recent versions of VC are problematic too, they increase server CPU usage too much. Thankfully tagdiv staff sent me VC 4.3.5 and it worked very well until Newsmag 1.7.

Now even if I return to Newsmag 1.6 or 1.5, VC doesn’t show up in editing pages anymore. I have tried deleting it and reinstalling it. Visual Composer works with WP default 2015 theme but now with Newsmag anymore.

Any idea about this? It renders homepage but can’t edit anymore, same problem with the thread.

aleister
tagDiv Member

Thank you for your fast reply,

We are using latest available WordPress 4.1.1 version. We have been keeping our site updated very quickly in last 4 years.

No we don’t use drag and drop image upload, we choose images from local computer and upload. There is no problem uploading images to site. However, when we open the media library in the post to choose images to add inside the post, media library is empty.

Then sometimes media library images show, then we choose one or more picture and click on add to post, nothing happens. Thats the main problem here.

I have found out some posts concerning empty media library or being unable to place images from library to the posts. They all focused on functions.php. However I have no idea which part is responsible for this problem. There is some random conflict with theme that we can’t pinpoint.

How do you suggest we change the default update time in functions.php? If there is a link or guide you can provide it would be very helpful.

Regards,

aleister
tagDiv Member

Thank you for your reply,

Sorry for my late reply, I was ill for a few days. We love your theme and work, I have sent a mail to the adress requesting an older version. We will try that and if it doesn’t work, just wait for the next release.

Regards,

aleister
tagDiv Member

Thank you for your reply. Unfortunately it’s not a matter of file size, but a matter of server resource usage. An minimal load of 3% jumps to 90% with this new version.

As for returning to previous version of Visual Composer, I can only download latest Newsmag from Themeforest and included Visual Composer package. Is there a resource for downloading older versions?

I believe a better course of action for you would be checking the CPU usage of Visual Composer and warning the developers. Perhaps your test load is too low, because when 500 to 1000 concurrent online users visit your homepage, it’s load on server becomes too big. We are using your theme on our site which recieves millions of pageviews per month, not a small personal blog.

I can’t warn developers because I have no license, as I’m using the bundled version that comes with the theme. I’m aware that this is not a directly Newsmag or tagdiv caused problem but you are responsible for your choice of bundled software and it’s nearly an integral part of creating a nice homepage for your theme. Since you have a deal of distributing it with your theme to increase user experience, it should be your duty to keep it positive.

Thanks,

  • This reply was modified 11 years by aleister. Reason: Added more information
aleister
tagDiv Member

After the latest update to visual composer our server CPU usage skyrocketed so we had to disable it. Have you tested it’s resource usage before including it in the latest package? We can’t use it in its current load. We are on dedicated hosting with very little usual load and tested it in different hours -loads of the day. Even the service provider sent us a mail regarding system resource usage of the bundled plugin. We had no such problem before the Theme update to 1.5 and bundled Visual Composer plugin.

Kind regards,

Viewing 12 posts - 26 through 37 (of 37 total)