Home › Forums › Weaver Xtreme Theme › Weaver 4.3.5 Uploaded
- This topic has 18 replies, 4 voices, and was last updated 2 years, 10 months ago by
Weaver.
-
AuthorPosts
-
July 17, 2020 at 18:41 UTC - Views: 79 #64844
Weaver
KeymasterI’ve just uploaded Weaver 4.3.5. It has a couple of changes to how WooCommerce pages and sidebars are handled.
It also took several code revisions to comply with some new WP theme requirements. I think these may be related to the upcoming release of WP 5.5. The required changes were the first required ones for themes in quite a while. One related to requiring a theme to add a call to the system to possibly add code right after the <body> tag is generated by the theme. Must be for some new or planned new feature for WP. Also some changes in how menus are generated that imply some possible new features to be added to menus. That required some minor changes to the theme’s menu code that has been untouched for probably 5 years or more.
Apparently one of the new features of WP 5.5 will eliminate the need for the “Easy Theme and Plugin Upload” plugin — WP can now use a .zip file directly to update a theme or plugin. Finally!
July 19, 2020 at 01:37 UTC - Views: 86 #64849HFigarella
ParticipantBruce, @weaver
I have a multilanguage site with posts written in 6 languages. That is, the same post written 6 times. Therefore I have 6 frontpages, one for each of the 6 browser languages I use.
On the frontpage when the browser language is english I only want to show posts in english AND certain posts I choose, not the latest one, or anything else.
To select the posts in english I use your theme’s template “Page with posts” and filter custom taxonomy parameters = language=en_us
and I use https://wordpress.org/plugins/wp-hide-post/ to hide most posts on the frontpage of my site and select the few to show.
Everytime there is a new version of your theme I have to change one line of code because it disrupts that functionality.
In …wp-content\themes\weaver-xtreme\paget-posts.php I change the following in order for wp-hide-post to work
Line 106 //query_posts( apply_filters(‘weaverx_pwp_wp_query’,$args) );
Line 106 (replaced with):
$wp_query = new WP_Query(apply_filters(‘weaverx_pwp_wp_query’, $qargs)); // reuse $wp_query to make paging work // Modified by Horacio
By the way, line 106 was changed by you in the latest versions. Originally it was what I am using now.
If there is no need for that line to be the way you changed it to lately, can you revert this change?
Horacio
July 19, 2020 at 01:55 UTC - Views: 77 #64850HFigarella
Participanthttps://developer.wordpress.org/reference/functions/query_posts/ explains it:
“Note: This function will completely override the main query and isn’t intended for use by plugins or themes. Its overly-simplistic approach to modifying the main query can be problematic and should be avoided wherever possible. In most cases, there are better, more performant options for modifying the main query such as via the ‘pre_get_posts’ action within WP_Query.
This must not be used within the WordPress Loop.”
Horacio
July 19, 2020 at 08:46 UTC - Views: 78 #64851HFigarella
ParticipantAnother little change that work for me in your theme:
For pages using template “Page with posts” and there is no sidebars I wanted more columns. So I added 2 more to the selection:
on …\wp-content\themes\weaver-xtreme\admin\admin-core\admin-page-posts-meta-boxes.php after line 897
line 897 array( ‘val’ => ‘5’, ‘desc’ => esc_html__( ‘5 Columns’, ‘weaver-xtreme’ ) ),
I added these 2 lines:
array( ‘val’ => ‘6’, ‘desc’ => esc_html__( ‘6 Columns’, ‘weaver-xtreme’ ) ), // Added by Horacio
array( ‘val’ => ‘7’, ‘desc’ => esc_html__( ‘7 Columns’, ‘weaver-xtreme’ ) ), // Added by Horacio
Why do I need that?
I have pages with posts where the post is a gallery format (a single photo) and I want up to 7 photos (posts) per row.
Horacio
July 19, 2020 at 09:37 UTC - Views: 85 #64852HFigarella
ParticipantOne more thing I changed in your theme to make it work for me:
You can see the photo I attached above by right clicking on the button where the photo is supposed to show. It is a snapshot of a page with posts (6 per row).
The way the code is originally, I can only open each post by clicking on the title. If I click on the image of the post, it reloads the hosting page again.
I fixed it by modifying…\wp-content\themes\weaver-xtreme\templates\content-gallery.php
Line 85 (original):
<a href="<?php esc_url( get_permalink() ); ?>" title="<?php the_title_attribute( 'echo=1' ); ?>" rel="bookmark"><?php echo $the_image; ?></a>
Line 85 modified to:
<a href="<?php echo esc_url( get_permalink($post->ID) ); ?>" title="<?php echo the_title(); ?>" rel="bookmark"><?php echo $the_image; // Modified by Horacio ?></a>
Now it works for me.
I deleted Line 86 because I do not need the word Gallery under the image.
Your theme and plugins are excellent work. I have been using them for years now (and paying for it).
If you do those 3 little changes I mentioned in these 3 posts, I will appreciate it because I will not have to modify your code for every new version.
By the way, as I explained to you some 5 years back, “Page with posts” works fine when the posts are pages. I would call it “Page with posts/pages”
“Page with Posts (and pages)” works fine until membership 2 came along
Horacio
July 19, 2020 at 16:43 UTC - Views: 67 #64853scrambler
Moderator@weaver will have to comment on potential permanent changes.
That said, the method to make PHP changes that survive a theme update is to use a child Theme. The changed PHP template reside in the child theme and always supersede the ones in the updated theme.
To display posts in more than three columns and adapt the number of columns to the device, you can use CSS. The guide article below details how to do it, we can help tune it once you play with it
https://guide.weavertheme.com/display-posts-in-more-than-3-columns/
July 20, 2020 at 13:37 UTC - Views: 58 #64854barbeluk1
ParticipantI have just updated this site:
I now have a white block running down the left edge of the screen. It looks as though it’s a empty list of links.
I’ve managed to remove it for now with this:
.sm, .sm li, .sm ul {display: none; !important}
I’d rather be able to take this out though…
Thanks,
Andy
July 20, 2020 at 17:06 UTC - Views: 53 #64855scrambler
ModeratorUnless we can see it, we cant be sure where it is coming from…
July 20, 2020 at 21:21 UTC - Views: 49 #64858barbeluk1
ParticipantHi Scrambler,
I’ve commented out the extra CSS so you can now see the issue…
Thanks,
Andy
July 20, 2020 at 21:55 UTC - Views: 51 #64859scrambler
ModeratorThis is your secondary menu filled with dozens of empty links
First Hide the secondary menu in the menu options
Second check in Custom Menu if you have a custom menu allocated to secondary
July 20, 2020 at 23:13 UTC - Views: 43 #64860barbeluk1
ParticipantHiding the secondary menu has got rid of the white line.
I only have one menu defined (main_menu) in ‘Menus’. I can’t find Custom Menu anywhere? Is this a Weaver option of do you mean in the WordPress Menus area (Appearance > Menus)?
Many thanks,
Andy
July 20, 2020 at 23:29 UTC - Views: 49 #64861Weaver
KeymasterRE: query_posts() – The WP guide didn’t use to say that, and I’m not sure the alternatives they mention will change how Weaver uses it.
The complication is that the Weaver Page with Posts actually nests a new query inside the original query for the page. This allows one to add whatever content is wanted at the top of the PwP, followed by the posts. The way Weaver does it is (or was) duplicated by some other plugins.
Now, I don’t doubt that your solution works, and it seems you also must be using Weaver Show Posts as well since the code on line 106 isn’t used otherwise.
And I suspect you’ve discovered a bug in that code, and found a way around it. I believe the correct fix would be to change line 106 to be:
query_posts( apply_filters('weaverx_pwp_wp_query',$qargs) );
The bug is that the existing code uses simply $args, which I don’t imagine works, and since you may be the only person using show_posts on a PwP, you may have discovered a bug. I would appreciate it if you could try the above fix instead of yours to see if that fixes your issue. (and I do think you could have your own copy of paget-posts.php in a child theme, but I’m not positive.)
I will try your WP_Query replacement instead since the latest WP query_posts documentation suggests there is a performance penalty for re-using query_posts. I’m pretty sure the filter won’t work because of the need to add a query nested into the original page query.
And about modifying the gallery columns – I would suggest creating a child theme for that. Copy the original /templates/content-gallery.php file to your child theme, and add your changes. That should then be permanent. (Note – the /template directory will be changed in Weaver Xtreme 5, but that is several months away, and fixing the child will just involve changing the directory structure.)
Unfortunately, I’m not sure that adding column 6 and 7 is possible in a child theme, and I’m not ready to add them at this point. (if I do, it would be likely to up to 8).
But please let me know if the $qargs fix works, and I’ll add that to the next release.
July 20, 2020 at 23:34 UTC - Views: 39 #64862scrambler
Moderatorthe WordPress Menus area Appearance > Menus
If you have no custom menu allocated to the secondary menu and you try to display it, it would include every single page you have defined
July 21, 2020 at 01:27 UTC - Views: 40 #64863HFigarella
Participantonly person using show_posts on a PwP
Yes, I understand I may be the only one doing so.
Line 105 $qargs = atw_posts_get_qargs( $fargs, array() ); Line 106 //query_posts( apply_filters('weaverx_pwp_wp_query',$args) ); Line 106 //query_posts( apply_filters('weaverx_pwp_wp_query',$qargs) ); Line 106 $wp_query = new WP_Query(apply_filters('weaverx_pwp_wp_query', $qargs)); // reuse $wp_query to make paging work // Modified by Horacio
Of those 3 Line 106 above that I have tried, only the third one works for me.
The first Line 106 (using $args) and the second one (using $qargs) both call query_posts, and as the guide says, “completely override the main query”. Meaning, I lose all the filters I have used up to that point and the query now show all posts instead, ignoring the Weaver Show Posts filter settings all together and any other filter I am using with other plugins.
Therefore, for now I keep line 106 like this:
$wp_query = new WP_Query(apply_filters('weaverx_pwp_wp_query', $qargs)); // reuse $wp_query to make paging work // Modified by Horacio
Which is the way it was originally in your theme for many, many years and it worked until it was changed lately to use query_posts which does not work per the guide “This must not be used within the WordPress Loop”.
July 21, 2020 at 01:49 UTC - Views: 42 #64864HFigarella
ParticipantWhile I have your attention, I am repeating not answered #64852 and explaining it more,
…\wp-content\themes\weaver-xtreme\templates\content-gallery.php
Line 85 (original):
The way the code is originally, I can only open each post on a page with posts by clicking on the title of the post. If I click on the image of the post, it reloads the hosting page again.
<a href="<?php esc_url( get_permalink() ); ?>" title="<?php the_title_attribute( 'echo=1' ); ?>" rel="bookmark"><?php echo $the_image; ?></a>
I fixed it by modifying …\wp-content\themes\weaver-xtreme\templates\content-gallery.php [adding $post->ID) to get_permalink]
Line 85 modified to:
<a href="<?php echo esc_url( get_permalink($post->ID) ); ?>" title="<?php echo the_title(); ?>" rel="bookmark"><?php echo $the_image; // Modified by Horacio ?></a>
Now it works for me.
I deleted Line 86 because I do not need the word ‘Gallery’ under the image.
By the way, my changes work for me. I understand it may be not necessary for you to change your code to satisfy the “only guy” using it in a certain way. I can easily change 3 lines in your whole theme a couple of time a year. I am just sharing.
July 21, 2020 at 02:46 UTC - Views: 41 #64865HFigarella
ParticipantUnfortunately, I’m not sure that adding column 6 and 7 is possible in a child theme, and I’m not ready to add them at this point. (if I do, it would be likely to up to 8).
I will wait for that. Meanwhile, I will add those to lines to:
…\wp-content\themes\weaver-xtreme\admin\admin-core\admin-page-posts-meta-boxes.php after line 897
array( 'val' => '6', 'desc' => esc_html__( '6 Columns', 'weaver-xtreme' ) ), // Added by Horacio array( 'val' => '7', 'desc' => esc_html__( '7 Columns', 'weaver-xtreme' ) ), // Added by Horacio
Again, I may be the only one showing 7 posts (or pages) per row on page. I understand my request does not even make sense to some.
To display posts in more than three columns and adapt the number of columns to the device, you can use CSS.
@scrambler That is what Weaver theme does by selecting the number of columns from the menu on Page with posts. But only up to 5 for now.My idea is the same as a gallery of 7 photos per row where you click a thumbnail of the photo and it opens the photo to view.
In this case I have a gallery of 7 posts per row where you click a “thumbnail” of the post and it opens the full post to view.
I have a plugin that also do that: Posts with posts.
Of course, that functionality is only good for people who still use desktops with big screens. There is no much use on a cell phone.
-
AuthorPosts
- You must be logged in to reply to this topic.