Versipellis
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Correct Hook/Filter to amend Categories on post edit pageSorry, updated the above, as I re-read your suggestion to edit the query vars. See below:
$current_user = get_current_user_id(); $user_field = "user_".$current_user; $user_categories = get_field('post_categories', $user_field); if(in_array('category',$terms->query_vars['taxonomy'])){ $terms->query_vars['include'] = $user_categories; } return $terms;
And this works
- This reply was modified 5 years, 5 months ago by Versipellis.
Forum: Developing with WordPress
In reply to: Correct Hook/Filter to amend Categories on post edit pageBit confused here as the documentation on
WP_Term_Query
doesn’t seem very solid. I can usepre_get_terms
and var_dump my users categories out, that’s fine, although it loops a few times.However if I try and make a new
WP_Term_Query
and filter with the below, I just get stuck in a loop.public function filter_user_categories(){ if( !current_user_can('administrator') ) { $current_user = get_current_user_id(); $user_field = "user_".$current_user; $user_categories = get_field('post_categories', $user_field); //var_dump($user_categories); $args = [ 'taxonomy' => 'category', 'include' => $user_categories ]; //var_dump($args); $terms = new \WP_Term_Query($args); return $terms; } }
So how do you manipulate
WP_Term_Query
inside apre_get_terms
?Forum: Developing with WordPress
In reply to: Correct Hook/Filter to amend Categories on post edit pageThanks for the reply, sorry did not have time to respond last week. Will have a review and see how I get on.
Forum: Fixing WordPress
In reply to: All pages are returning 301 after visitingSo once you go to any page, and click through the pagination etc, after 10-15 clicks it just starts reloading the homepage. We can’t find a direct ‘this page will always break’ it seems incredibly random. At first I thought it was the cv page being the trigger but oddly it will work for one person for a long time then in general break.
The 301 is only visible within the network tab on dev tools.
Forum: Fixing WordPress
In reply to: All pages are returning 301 after visitingSo it’s website – basically moving around the pagination or any of the links below the header (header links are all external) causes the issue. tested on a few browser and a few different machines.
Forum: Plugins
In reply to: [rtMedia for WordPress, BuddyPress and bbPress] Lightbox issueThank you this code worked. However it didn’t help with my second question regarding images.
How do I make my max image size larger than 800px wide?Regards,
Versipellis
Forum: Plugins
In reply to: [CubePoints] Error after updateAnyone still having this issue (I was and its still not fixed as I downloaded this yesterday) >
Replace
'somethingWentWrongText' => _('Oops, something went wrong! Please try again later.', 'cp')
With
'somethingWentWrongText' => __('Oops, something went wrong! Please try again later.', 'cp')
Forum: Themes and Templates
In reply to: Theme install inactivate widgetsWell how come when I install wordpress I automatically get these and more WIDGETS in my sidebar, and I have to go into the dashboard > appearance > widgets and they are sat there in the first of 5 sidebars. So I don’t see how you can say it is the default sidebar content when I have installed a vanilla wordpress today and there are plenty of WIDGETS in my BACKEND sidebar options.
So what you’ve said is completely wrong, if you change theme those WIDGETS stay I have tested this already today, and the WIDGETS are there on install of wordpress and the twenty eleven them. Tested today.
Forum: Themes and Templates
In reply to: Theme install inactivate widgetsEvery time I install wordpress, it puts the twenty eleven theme in. With those widgets.
If I change theme, the widgets stay. This has happened on every single wordpress I have worked with, and I have several installs locally and several live websites.
Plus I cannot guarantee a user does not already have widgets activated, I cannot guarantee that they are using a fresh install.
Every new theme I install has the same widgets in that are put in prior to install. On any wordpress I have from 3.0 to the latest.
Forum: Themes and Templates
In reply to: Theme install inactivate widgets<?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?>
Thats stating, if Does Not Have Dynamic Sidebar ‘sidebar-1’ Display Following.
Thats what shows if you Do Not have any widgets in your sidebar in the backend.
Removing that will not do anything as, when the theme installs, there are already widgets active…
I want to force wordpress to inactivate all active widgets on install of my theme.
Forum: Themes and Templates
In reply to: Theme install inactivate widgetsWell I’ve looked there, which just says it loads ‘sidebar-1’ if Dynamic.
Sidebar 1 in my functions.php is as follows:
register_sidebar( array( 'name' => __( 'Sidebar', 'twentyeleven' ), 'id' => 'sidebar-1', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => "</aside>", 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) );
As far as I can see that is not automatically putting in search, pages and meta widgets into the back end?
Also you stated:
Widgets are stored on a per-theme basis, so your newly installed theme won’t have any active widgets to move anywhere.
But I always find that installing wordpress puts in those same three widgets with twenty eleven, then if I change theme they always stay no matter how many themes I test with.
I know code to completely unregister a widget, but thats not what I want.
Forum: Themes and Templates
In reply to: Theme install inactivate widgetsWhen I started making this theme, I took a copy of twenty eleven as I usually do and started editing.
Three widgets, search, pages and meta, were automatically put in.
Forum: Plugins
In reply to: [User Locker] [Plugin: User Locker] Locked details stored?Thanks for the reply but I already got it sorted without the need to a hook.
Forum: Fixing WordPress
In reply to: javascript plugin locationIm not really very good at getting my js to work with php – the JS in question is in an external javascript file not in a php one
As some people say to use a .php and then a javascript header but I can’t get this to work at all
header("content-type: application/x-javascript");
but my javascript then doesnt work at all.
Hah no worries about missing it, agreed it would be nice if that option can be put in as a perminant option since its clear people want it ??