SJW
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Creating a CPT search form with results on the same pageThanks, Turns out GET doesn’t work either – it was working to a different page. I can’t submit a form to my search page – no action, action = /find-a-service/, GET, POST all result in 404.
I changed the action to another page and it works fine – It just appears to be this page for some reason.
Change the template file to page-{id}.php – same result.
I changed
s
tokeyword
I removed the hidden input
post_type
and now it is working. So passing a “post_type” breaks the search? I guess I’ll just have to hardcode the post type into the query args.I have now been able to print the $query->request and it looks odd.
With no keyword it’s checking if 0 = 1 resulting in 0 rows?
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND ( 0 = 1 AND 0 = 1 ) AND ((wp_posts.post_type = 'service-provider' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled' OR wp_posts.post_status = 'private'))) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10
But, when I actually enter a keyword (“temp”), it adds a unique random string – is this normal? (still results in 0 rows when there should be 3)
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND ( 0 = 1 AND 0 = 1 ) AND (((wp_posts.post_title LIKE '{2ba466468b9acc648ae20214b766881cae6d618232a794a7f096d20c5b38194c}temp{2ba466468b9acc648ae20214b766881cae6d618232a794a7f096d20c5b38194c}') OR (wp_posts.post_excerpt LIKE '{2ba466468b9acc648ae20214b766881cae6d618232a794a7f096d20c5b38194c}temp{2ba466468b9acc648ae20214b766881cae6d618232a794a7f096d20c5b38194c}') OR (wp_posts.post_content LIKE '{2ba466468b9acc648ae20214b766881cae6d618232a794a7f096d20c5b38194c}temp{2ba466468b9acc648ae20214b766881cae6d618232a794a7f096d20c5b38194c}'))) AND ((wp_posts.post_type = 'service-provider' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled' OR wp_posts.post_status = 'private'))) GROUP BY wp_posts.ID ORDER BY wp_posts.post_title LIKE '{2ba466468b9acc648ae20214b766881cae6d618232a794a7f096d20c5b38194c}temp{2ba466468b9acc648ae20214b766881cae6d618232a794a7f096d20c5b38194c}' DESC, wp_posts.post_date DESC LIMIT 0, 10
It appears to be this part of the SQL that is producing 0 results – not sure how it is added or how to remove it
AND ( 0 = 1 AND 0 = 1 )
Ok, It’s the tax_query – if no region or cat is selected it passes empty which somehow creates the 0=1.
Forum: Developing with WordPress
In reply to: Creating a CPT search form with results on the same pageDrop the template redirect code, the following will make it unnecessary.
Have your form make a POST request method instead of GET. You’d thus get form data from $_POST or $_REQUEST instead of $_GET.
Originally I was trying to redirect the search results to the already existing archive page and filter there but now I have opted for this solution I will remove this.
I removed the action so it POSTs to same page but it now gives me a 404 error. I can see in the network tab in developer tools it is going to the exact same page but it is now giving a 404. POSTing to the page gives a 404 but if I highlight the address bar and hit enter it displays s expected… More debugging required here.
Forum: Themes and Templates
In reply to: [Quark] Archive template not workingScratch that – looks like the template file is now showing. After adding the code to functions.php the layout changed. This has baffled me but I guess I just accept it works now…
archive-service-provider.php
appears to be the working file…- This reply was modified 8 months, 1 week ago by SJW.
Forum: Themes and Templates
In reply to: [Quark] Archive template not workingI can access
/providers/
which shows all my posts within the CPTservice-providers
.This would indicate to me that:
- CPT permalink is working (I can see all posts via the
/providers/
permalink) - has_archive is true (posts are being displayed on
/providers/
) - public is true (it is showing publicly on
/providers/
) - rewrite is
providers
(CPT isservice-providers
but permalink isproviders
)
When I add the code to functions, it says the template is using
quark/index.php
even though I have the following files in the child theme directory (all the same file just copied):
archive-provider.php
archive-providers.php
archive-service-provider.php
archive-service-providers.php
I have saved permalinks at least 5-10 times now.
Forum: Developing with WordPress
In reply to: Authors for Custom roles with custom capabilitiesHere is where the Author dropdown is displayed in the edit post screen: https://rainastudio.com/wp-content/uploads/2018/12/WordPress-Gutenberg-Post-Editor-1024×436.png – On the right side of every single post in the Dashboard
The CPT has its own capabilities:
'edit_providers', 'edit_others_providers', 'delete_providers', 'publish_providers', 'read_private_providers', 'delete_private_providers', 'delete_published_providers', 'delete_others_providers', 'edit_private_providers', 'edit_published_providers'
- This reply was modified 9 months ago by SJW.
Forum: Everything else WordPress
In reply to: Debugging styling issues on specific platformsFigured it out (sort of). I was using the fontawesome css direct from the github: https://github.com/FortAwesome/Font-Awesome/tree/6.x/css
Clearly that doesn’r work all the time.
Simply created a Kit and installed the kit and it appears to work now
Yep. That’s what I was originally trying to do. That makes sense now – but I couldn’t any help or doco which explained how to restrict a capability to a CPT so I used contributor and just blocked post access.
Probably not ideal. I might keep looking for CPT capability managament
thanks
@bcworkz Thanks. That makes sense and I have it working now as follows but I don’t think I need to do all this.
- When a user registers, I copy the
contributor
role, rename tousername_role
and then set_role() to the new role - Contributors can post to my CPT and posts in a status of ‘Pending’ which is perfect – must be reviewed by an admin.
- I created a
login_redirect
filter for non-admin users on login to go straight to the the CPT page with author as filter/wp-admin/edit.php?post_type=service-provider&author=".$user_id
– This just shows their CPT post. They can view others posts but cant edit – perfect - For all non-admin users, I added
admin_init
action if NOT admin,remove_menu_page()
– edit.php (posts) and edit-comments.php (comments) so they canno see posts and comments.
Question: Do I need to copy and set the new role? It is effectively just contributor with another name and the actual CPT filtering is done based on the Author (not the role) anyway?
Forum: Reviews
In reply to: [Sensei LMS - Online Courses, Quizzes, & Learning] You better like green@midipedalboards?“changing the default colours” is something that can be very, very easily achieved with a basic knowledge of CSS. Frankly, if changing colours is beyond your skillset, you probably shouldn’t be rating the product – the problem isn’t with the product, it’s with you!
- This reply was modified 1 year ago by SJW.
Forum: Developing with WordPress
In reply to: Change text-color on various places on homepageCould be a number of ways. Either in the theme settings, in the css, in the page editor… First, find the styling that’s being applied using the Chrome Inspector and work back from there.
Forum: Developing with WordPress
In reply to: Removing white space after headerUse Element Inspector to debug the css and you’ll see where there is excess padding: https://developer.chrome.com/docs/devtools/css/
@wfpeter – email has been sent with version 6.6.14
Hi Peter,
I’ve definitely installed the latest version (twice now). I’ve marked the issue as “fixed” in wordfence and run another scan 3-4 times now.
it’s a premium plugin so definitely not downloaded from www.remarpro.com repository.
Forum: Fixing WordPress
In reply to: Embedding Vimeo Block in Gutenberg not Full Widththanks but.
- This does not work. I tried css before posting. While the outer iframe expands to 100%, the inner content/video does not in my tests.
- That is a solution that i tried BUT it is basically bypassing the vimeo embed and therefore is not a solution to the vimeo embed problem.
- This reply was modified 1 year, 5 months ago by SJW.
License registration just never works anymore.
Just spins for 30 seconds then fails. Try again with multiple email addresses with the same result (message never arrives):
We can’t determine if the message has been received by your mail server, but it might already be delivered. Delivery often occurs in less than a minute, but some mail servers may cause long delays. Please check your email for a registration message from Wordfence. If it has not arrived, you can try again with another address below.
You’ve certainly succeeded in making the product unusable…