malcolmdixon
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Centering Accordion/Toggle Content TextHi,
Lots of align options here: https://www.w3schools.com/csS/css_align.asp
Forum: Fixing WordPress
In reply to: Stop cursor from changing to hand when hoevering over iconsHi,
Use CSS on the offending element, see https://www.w3schools.com/csSref/pr_class_cursor.asp for options.
Forum: Fixing WordPress
In reply to: Centered button in reusable block aligning leftHi,
It needs to be like this:
<div class="wp-block-buttons aligncenter"> <div class="wp-block-button aligncenter is-style-fill"> <a class="wp-block-button__link has-black-color has-text-color has-background" href="https://chillisimo.com/booking/" style="background-color:#d0cfb7">Inquiry & availability</a> </div> </div>
It seems you’ve deleted a “buttons” block and just have the button on its own.
I hope that helps.
Malcolm.
Forum: Fixing WordPress
In reply to: Looking for a reservation plugin not working like any otherHave you tried Booknetic?
Forum: Fixing WordPress
In reply to: Marks a location Google mapsHi,
Have you tried WP Google Maps plug-in?
Forum: Fixing WordPress
In reply to: Logo area becomes a small grey square before it loads the logoHi John,
I’m unsure if this will help but try setting the background-color to transparent for that element.
Best regards,
Malcolm.
Forum: Fixing WordPress
In reply to: Footer menu not appearing at bottom for short pagesHi,
I’m fairly new to CSS but I hope this helps:
On your DIV id=”content” set the following CSS:
min-height: calc(100vh – 190px);
Remove the other CSS you added as it’s not necessary.
- This reply was modified 3 years, 6 months ago by malcolmdixon.
Forum: Fixing WordPress
In reply to: Customer accounts, forms, and questionnairesHi,
I’m new to WordPress but I know of two recommended plug-ins that may help. I cannot confirm whether the features fulfill your requirements as I haven’t used them, they are:
Amelia Events & Appointments
BookneticForum: Developing with WordPress
In reply to: Ajax best approachOh I see, thought there might be more to it. When I get time I’ll definitely look into it, as I’m beginning to enjoy this web development malarkey a lot different to Cobol and RPG II lol.
Forum: Developing with WordPress
In reply to: Ajax best approachHi,
I tried admin-ajax.php and admin-post.php instead of index.php but they didn’t work so I just changed it back! Thanks anyway. I guess being admin*.php it’s something to do with lack of permission, although I was logged in at the time!
Best regards,
Malcolm.
- This reply was modified 3 years, 6 months ago by malcolmdixon.
Forum: Developing with WordPress
In reply to: Ajax best approachThanks yet again for replying.
Firstly, glad you had a little fun at my expense, no problem gotta have a laugh ??
Like I’ve said PHP and WordPress development is all very new so it would be stupid of me not to get confirmation, so thanks to you and Joy for sharing your wisdom.
The reason for creating my own API was due to the YouTube video by WPCasts that showed that the Rewrite Rules API was fastest and that the Rest API can become slower in time due to the amount of plugins that hook into it etc.
When I discovered that WordPress had a Rest API, I thought great I’ll use that but my acquaintance that I’m helping out with this seemed to be against the idea too, can’t remember why though, so I didn’t explore this avenue further. I did learn that it returns lots of unnecessary data but I know you can filter to a certain extent. Based on your advice I should probably investigate this further even though I have the code more or less working using the Rewrite API.
Don’t worry you’ve got a convert here, I won’t use require_once(‘wp-load.php’); ever. It’s drummed in now lol.
Best regards,
Malcolm.Forum: Developing with WordPress
In reply to: Ajax best approachHi bcworkz,
Thanks again for your reply.
Yes, essentially that’s what I’m doing as it’s supposed to be the “best” method as “confirmed” by the 10up article.
The plan is to route the calls to the appropriate controller to retrieve the required data.
So, by hooking into template_redirect will affect performance of other front end pages for probably slight gains in performance for the one page that will use the custom endpoints.
By using an URL structure without a query string you can leverage any caching that might be in place
I was going to be using 2 query parameters as a way to filter some results, but from your statement I assume these would not be cached? So, instead of using say api/v1/models?make=id, I should create an endpoint api/v1/makes/id/models to retrieve all models of a particular make in order to make it cacheable?LOL, I don’t believe anything on the Internet, I’d rather test things myself but there’s a lot of much cleverer people than me out there that I hoped would guide me. You’re one of them, so thanks ??
Best regards, Malcolm.
Forum: Localhost Installs
In reply to: Cannot launch Wp using DuckDNS urlHi Chris,
As I’m new to WordPress myself I may not be that helpful but I use DuckDNS too.
What I noticed was that the Site URL had to be the DuckDNS address, it initially was the local server IP address, see https://www.ads-software.com/support/article/changing-the-site-url/.
HTH.
Malcolm
Forum: Developing with WordPress
In reply to: Ajax best approachHi,
Just read this article on https://10up.github.io/Engineering-Best-Practices/php/#performance
AJAX Endpoints
AJAX stands for Asynchronous JavaScript and XML. Often, we use JavaScript on the client-side to ping endpoints for things like infinite scroll.
WordPress provides an API to register AJAX endpoints on wp-admin/admin-ajax.php. However, WordPress does not cache queries within the administration panel for obvious reasons. Therefore, if you send requests to an admin-ajax.php endpoint, you are bootstrapping WordPress and running un-cached queries. Used properly, this is totally fine. However, this can take down a website if used on the frontend.
For this reason, front-facing endpoints should be written by using the Rewrite Rules API and hooking early into the WordPress request process.
Here is a simple example of how to structure your endpoints:
<?php /** * Register a rewrite endpoint for the API. */ function prefix_add_api_endpoints() { add_rewrite_tag( '%api_item_id%', '([0-9]+)' ); add_rewrite_rule( 'api/items/([0-9]+)/?', 'index.php?api_item_id=$matches[1]', 'top' ); } add_action( 'init', 'prefix_add_api_endpoints' ); /** * Handle data (maybe) passed to the API endpoint. */ function prefix_do_api() { global $wp_query; $item_id = $wp_query->get( 'api_item_id' ); if ( ! empty( $item_id ) ) { $response = array(); // Do stuff with $item_id wp_send_json( $response ); } } add_action( 'template_redirect', 'prefix_do_api' ); ?>
This seems to go against using admin-ajax.php and favour the Rewrite API which is what I’ve done.
Any comments?
Forum: Developing with WordPress
In reply to: Ajax best approachHi bcworkz, thanks for your input.
Considering I need access to the WP_Query object since Joy recommends avoiding the use of SQL via $wpdb, I take it that I must use admin-ajax.php since it is a WP resource and you have both confirmed not to use require wp-load.php (which I have seen on a couple of YouTube channels).
One purpose for using the Rewrite API as I understand it is that you can create your own endpoints and return only the data you require unlike the REST API.
What are better ways to invoke the WP environment? Can you point me in a direction for further research? Thank you.