Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
kedo
Nov 27, 2007

Oof, no ty.

Adbot
ADBOT LOVES YOU

kedo
Nov 27, 2007

I haven't used it personally, but I tend to keep a WordPress instance running in my local dev environment and on a dev server so I can test things like this out, might be worth looking into. With MAMP, getting WP running locally is pretty quick and easy.

Also, Gutenberg has a Gallery block.

kedo
Nov 27, 2007

CSS classes are CSS 101. I'd imagine the assumption is that if you're capable of styling an element using CSS, you're going to know what a class is and how to find it. I've hardly ever seen class names specified in documentation, inside or outside of WordPress, usually because there are dozens or hundreds of them on a page, they get added/removed dynamically by JS, etc.

The tricky thing about WP in general is that it caters to a non-developer crowd, but if you want to do any customization outside of what a theme/plugin allows with their GUI, you're in developer-land and the amount of required knowledge to do so goes through the roof.

kedo
Nov 27, 2007

Check out Gravity Forms addons section on their site, I’m 99% sure they have a quiz addon.

kedo
Nov 27, 2007

If you're already using ACF: https://www.advancedcustomfields.com/resources/blocks/

Also, you can use ACF to generate PHP code for your fields and either include it in your theme or save it as a plugin which allows it to be version controlled.

kedo
Nov 27, 2007

Siguy posted:

1. Where should I be looking for themes that aren’t so ecommerce focused?

https://themeforest.net/ is pretty much the go-to for pre-made themes. Many of the really good ones charge an annual fee for updates, though. That's just the way things are today.

Siguy posted:

2. Am I right to be suspicious of the themes with built in page builders or am I just making life harder for myself?

I hate to say, "it depends," but it depends. I've built dozens of sites with and without page builders, and there are plenty of pros and cons I could list in a 5000 word post, but the short version is:

PROS:
  • Gives your users a ton of control over the layout and structure of pages, which makes clients very happy
  • Requires less time spent in PHPland

CONS:
  • Gives your users a ton of control over the layout and structure of pages, which results in fugly pages designed by Marsha From Marketing who "has an eye for that kind of thing" and likes all the text to be rendered in Curlz MT in pink on a red background.
  • Pages get saved as sort of mini-applications that use HTML, CSS and JS that's specific to each page. This makes them fragile and easily broken by plugin updates. It also makes it virtually impossible to move the content out of the page builder, so if you ever need to migrate content at some distant point in the future it will be a manual copy/paste job.
  • Many are very bloated, as LifeLynx said. The one I've used most is Elementor and it's not too bad when it comes to bloat and it's very developer friendly which is nice, but again you're basically making each page a JS app which has a lot of overhead.

Siguy posted:

3. If I do give up and build from mostly scratch, is there a template or theme you recommend starting with?

Sage is definitely the go-to modern blank slate theme, but as you've learned it leans heavily into modern front-end practices and is extremely opinionated about where and how you write your code. I personally really like it because it helps keep things clean and organized and it's incredibly well documented so I feel great about handing projects off to other devs (as opposed to, say, using a blank theme I coded completely from scratch and "forgot" to document), but it has a steep learning curve.



My two cents: unless you want to be on the hook for support for the rest of the site's life, you should just have them buy a theme and do the basic install/setup for them. In all honesty, I wouldn't even accept this gig. Cheap or free clients are the worst clients 100% of the time because since they're not paying for your time, they don't value your time. Better yet, tell them to use Squarespace (which any idiot can set up), and bow out, imo.

kedo
Nov 27, 2007

I'm pretty sure I talked about this previously in this thread, but ACF allows you to create custom blocks. I've used this on all of my recent Gutenberg projects and it's just as easy as everything else ACF does.

Writing a Gutenburg block from scratch is about as easy as writing a complex React app from scratch. I have no idea why they made it so incredibly difficult. It feels very un-WordPress.

kedo
Nov 27, 2007

If you're more comfortable JS, you could consider going headless WP and create a JS app that queries the WP REST API. GatsbyJS is commonly used for this purpose.

Otherwise your question is so general I'm not sure what advice to give you. Is your plan to link the app more closely with WordPress, or to continue keeping them separate?

kedo
Nov 27, 2007

Writing code in a text editor is what I do as well for 99% of my WordPress work, so you're just fine there. A lot of articles written about WordPress target non-developer users, so it's easy to go down the rabbit hole of "everything you make on WordPress must be created in the WP GUI and live within the WP ecosystem," but that's not entirely the case. At the end of the day WP is just a big PHP application, and you can do anything with it you might be able to do with any other PHP application.

Will your app be written in PHP? If so, it seems like an integration should be pretty simple. If it were me, I'd probably have the application live in its own directory at the web root (or as a WP plugin for that matter, which would probably be the "correct" way to do it), I'd create a single page template with the WP header and footer (this is required for WP pages to function), and then I'd require/include the application between the two. I've done something similar before with a React app – basically WP just acted like a wrapper for the application and allowed users to create additional pages surrounding the application, but the app itself was all executed in code that was untouchable by my client and completely disconnected from WP in almost every way.

Composer would be helpful if you need to manage PHP dependencies for your app, but I don't find it terribly helpful for traditional WP sites. Whether or not it's usable on the live site will also depend on who hosts the thing as there are many hosts who still don't support Composer.

As an aside: it's entirely possible to connect to a second database within WP, so if you wanted to have your application live within the WP ecosystem, it's technically possible. See wpdb, and this basic example. The more that I think about it, creating your app as a WP plugin is probably the way to go unless you can foresee a future where it would need to exist outside of WP. As a plugin, you'd have the ability to expose various controls to admin users via the WP interface (creating an options page in the WP admin dashboard is trivial, especially if you use the ACF plugin which I would highly recommend), and you'd gain all the benefits of WP without having your code tied to a theme or template that a non-developer can easily gently caress up.

ChickenWing posted:

I've read that it's way easier to gently caress up and delete template pages than it is to delete standalone pages in the web root.

Administrative users can delete themes (which is where template pages would live), and the theme editor provides a GUI that allows them to muck with the actual code of template files. A non-technical user could unintentionally delete important stuff, but it's a rare occurance. Usually I hide those admin menus from users so they can't accidentally break things. Creating your app as a plugin would avoid this issue because WP doesn't allow users to edit plugin code via a GUI. The worst they could do would be to disable/delete the plugin, but all you'd need to do would be to re-install/enable it again.

kedo
Nov 27, 2007

Are you only migrating content, or moving the full site from one server to another? A content migration means the content leaves one site/WP theme and enters a completely new site/WP theme, wheras a site move means moving all of the site (web files, database, etc.) and dropping it on a new server.

I've done a few very hefty content migrations lately (>30,000 posts each, with complicated field structures and mapping), and honestly all of the sever to server plugins I tried sucked. WPMU's migration tool is okay if you're running a mostly vanilla WP instance w/ few or no custom fields, but if your migration is large or in any way complex your best bet is WP All Import (and the affiliated export/custom fields add ons). If your field mapping from site A to site B isn't 1:1, you may need to look into custom bulk actions as well to update the content on each post after they're imported.

If you're simply moving a WP site from one server to the other and not actually migrating content, it's usually as easy as downloading all of the web files, creating a database dump, and then uploading everything to the new server. All-in-One WP Migration does this well, if you don't feel like mucking around in SQL-PHP-land yourself.

kedo
Nov 27, 2007

greazeball posted:

I haven't been following this thread since you all gave me a bunch of advice earlier (thanks again!) and don't know how relevant this will be but...

Jetpack sent a notice to my wife today that there was an issue with Divi, click here to resolve it. And it loving DELETED DIVI without a confirmation check and certainly no indication that it was deleting instead of deactivating poo poo. She's restoring from backup now. Maybe you guys are used to this from Jetpack or you never get it but I thought I'd raise the alarm just in case it helps someone avoid this particular bullshit.

That sounds like a pain in the rear end, but tbh it sounds like Jetpack is doing the lord's work because Divi is a huge piece of poo poo theme that deserves deletion! I totally get how painful it probably was to deal with, but this still gave me a nice, sensible chuckle over my morning coffee.

kedo
Nov 27, 2007

Redirection is the only redirect plugin that is worth anything.

kedo
Nov 27, 2007

I use Sage, but not Bedrock or Trellis. My opinion in a nutshell: It Is Good But It Has Flaws. I still prefer it over every other blank slate theme I've tried.

Pros:
  • Code organization. This is the main benefit. It drops the classic WP theme format for a more modern MVC paradigm. If used properly, all of your logic is included in controller files, and all of your markup is included in view files, and there's little to no overlap. The JS organization is also real nice, but in my experience most WP devs are lovely JS devs, so this may or may not be of value to most folks.
  • The Blade template engine is helpful, but not really necessary imo. You can entirely ignore it if you want, and just write straight PHP in your views. But it's handy if you want to avoid filling your markup with <?php ?>
  • Cache busting built in by default. When you yarn build:production your files, it automatically hashes filenames for your dist directory, so you never run into the whole, "I'm not seeing the change," / "omg clear your cache" dilemma with clients.
  • Webpack/browser sync built in, real nice for dev.
  • Easy to add in NPM packages as necessary since the project is built with the Yarn package manager as its backbone.
  • Third party documentation. This is a huge plus if someone besides you will ever touch the code. I've dealt with way too many entirely bespoke themes in my life (including those that I've made), so when it comes time for me to exit a project it's wonderful to be able to put this in the readme.md: "This project is built on Sage[link], please refer to their documentation if you have any questions."



Cons:
  • Lots of bugs in the most recent versions. Version 10 is not production ready (despite what the Roots forums say), and has a lot of really obnoxious bugs. Even the latest version 9 branch has some pretty huge problems (for example, if you reference an image in your SASS the compiler won't be able to find and will refuse to compile due to dependency conflicts), so I'm still using 9.0.9 on all of my projects.
  • Reliant on a lot of NPM dependencies that are now significantly out of date. Version 10 in theory solves this, but again, it's not ready for prime time.
  • It is very opinionated, which is really both a pro and a con. JS/SASS linting is enabled by default with some very strict rules. Function names must follow a very particular format (camel-casing) in your controllers, otherwise they just plain won't work. This helps keep things organized, but especially when you first start working with it there will be times when you just need something to work and instead you end up banging your head against a wall for an hour before you realize you needed to use $my_var instead of $myVar.
  • Not at all newbie / junior dev friendly. It's really tailored for hardcore PHP devs.

kedo
Nov 27, 2007

It depends on the project tbh, but I usually budget 1-2 hours for local dev environment setup.

If I'm coding a site for a client and they already have a (good) host or I can recommend a host, I'll usually put them on a host with a dev tool that's easy to work with (ie. Kinsta/DevKinsta, Pantheon/Localdev, Flywheel/Local). That way I don't have to think too much about the development environment, can easily push/pull code and databases every which way between various local and dev/test/prod environments, and when it's time for launch I don't have to deal with moving everything from server A to B. Local is my favorite of the three tools, but Kinsta is my favorite of the three hosts, so it's a mixed bag. :shrug:

Otherwise, if I need to spin up something locally for whatever reason, I use MAMP and then try to get the project into something closer to the final environment as quickly as possible. MAMP is dead simple, and WordPress isn't a terribly finicky application that's suddenly going to break on different hardware, so Trellis just seems like overkill. It sounds great if it works, but nothing ever works the first (few) times. The deployment component is the only piece that really sticks out to me as valuable, but there are other tools that can be used for that.

For weird one-offs or cheap clients, I tend to develop locally in MAMP and then deploy to a Digital Ocean droplet running a basic LAMP stack (which requires about 20 mins to set up [once you've done it a few times]) when the site is ready for client review/approval. Once they're happy with everything, I either move the database and web files to their host if I'm handling launch, or just download and zip the public_html directory and dump the SQL database and hand it off to them if they're handling launch.

kedo
Nov 27, 2007

If you deleted the page WordPress thought was the "homepage" or "posts" page, it can get a little confused. If you go to Settings > Reading on the WP dashboard, what do you see selected for the "Homepage" and "Posts page" fields?

kedo
Nov 27, 2007

fuf posted:

Does anyone have a really solid procedure for migrating WordPress sites around? Assuming you only have cpanel or ftp access.

And especially something that works if the source domain is no longer accessible.

Most cpanel installs have "softaculous" included which has a pretty solid WordPress importer, but for some reason it needs the source domain to be active and readable, even if you give it a direct FTP login. It's annoying because often the whole point is that you're moving a site from cpanel account to another but keeping the same domain.

Quoting myself from a few pages ago:

kedo posted:

Are you only migrating content, or moving the full site from one server to another? A content migration means the content leaves one site/WP theme and enters a completely new site/WP theme, wheras a site move means moving all of the site (web files, database, etc.) and dropping it on a new server.

I've done a few very hefty content migrations lately (>30,000 posts each, with complicated field structures and mapping), and honestly all of the sever to server plugins I tried sucked. WPMU's migration tool is okay if you're running a mostly vanilla WP instance w/ few or no custom fields, but if your migration is large or in any way complex your best bet is WP All Import (and the affiliated export/custom fields add ons). If your field mapping from site A to site B isn't 1:1, you may need to look into custom bulk actions as well to update the content on each post after they're imported.

If you're simply moving a WP site from one server to the other and not actually migrating content, it's usually as easy as downloading all of the web files, creating a database dump, and then uploading everything to the new server. All-in-One WP Migration does this well, if you don't feel like mucking around in SQL-PHP-land yourself.

It sounds like the last paragraph is applicable to you. If you are truly just moving from server A to B my process is literally just this:

1. Download everything in your public HTML directory via S/FTP
2. Dump the database and download it.
3. If you need to change the site's domain, do four find/replace in the downloaded .sql database thusly:

code:
https://oldurl.com/  ==>  https://newurl.com/
then
https://oldurl.com ==> https://newurl.com
then
oldurl.com/ ==> newurl.com/
then
oldurl.com ==> newurl.com
e: You need four find and replaces because WP stores the URL in different formats in various places, and you can't trust users to use a consistent format, so this covers all the bases.

4. Upload all the web files to your new host. Update wp-config.php with your new database info.
5. Import the .sql into your new database.

That's it. I've probably migrated a hundred sites this way over my career (mostly before auto-migration tools existed), so it's tried and tested. The All-In-One Migration tool basically just does all of this for you.

kedo fucked around with this message at 18:24 on Mar 23, 2022

kedo
Nov 27, 2007

fuf posted:

You've never been caught out by PHP serialized data just doing a standard find/replace like this? That really surprises me.

If the URLs have different character counts then there's a high chance you'll break something.

I've literally never once had an issue. The find/replace doesn't impact PHP, it only touches SQL, and WordPress only ever stores URLs in plain text. You'll notice I'm only finding/replacing the base URL and completely ignoring everything else, so as long as the permalink structure doesn't change, this works just fine.

A simple A to B WP migration is one of those things that sounds scary, and developers have engineered a lot of plugins that obfuscate the process, but in reality it's just "I put all my stuff from A onto B, and now it just works," (thank goodness).


e: Of course I haven't actually performed a migration like that for awhile. All of my migrations these days are, "we have a WP site we built back in 2006 that's been running ever since, and now we have 100,000+ posts that need to migrate and all of them need a bunch of content transformations, and half the content needs to be put into custom fields, etc." so the process is a lot more complicated and requires a lot of custom scripting.

kedo
Nov 27, 2007

Yeah, but even if data is serialized that doesn't mean URLs get mutated.

PHP code:
$array = array(
    'url' => 'https://www.example.com',
    'something_else' => 'foobar'
);
echo serialize( $array ); // a:2:{s:3:"url";s:23:"https://www.example.com";s:14:"something_else";s:6:"foobar";}
So I'm not really sure what your concern is here...? If you open an SQL doc in a text editor and find/replace for "https://www.example.com" the text editor doesn't care if the data is serialized or not, it's just searching for an exact match anywhere in a string.

e: Oh, I understand what you're talking about – never mind! Again, I get what you're saying, but I have yet to have an issue with this. :shrug: Maybe I'm just not using plugins that serialize data (my default position on plugins is, "does it really need a plugin?"), and I'm definitely not using themes that do because I code all my own themes and generally turn down any project that looks like a mess of pre-built themes and plugins, so maybe I've just somehow accidentally avoided this issue my entire career? :D

Deleted the rest of this post as it is no longer applicable, but leaving the amusing story I included for laughs:

oof, let me tell you all about a client I had using an old version of Firefox that, if you dragged and dropped an image from your desktop into a TinyMCE editor, it would automatically encode the image as base64 and stick it into the post – his WP database was 10 gigs before we realized the problem :doh:

kedo fucked around with this message at 16:03 on Mar 25, 2022

kedo
Nov 27, 2007

https://docs.gravityforms.com/using-dynamic-population/

Is this what you're looking for?

I use Gravity Forms mostly because I had to buy a developer license for a project many, many years ago so now I can license it for free on every single site I make. The new version isn't half bad, but it's still a pain in the rear end to deal with. I have yet to find a form plugin that doesn't suck massively in some way.

fuf posted:

yeah I have the exact opposite issue where I often get asked to host or migrate sites that are an absolute mess of page builders and plugins!

Oh I hear you. This was me at my last job (except replace "migrate" with "fix"), and is how I got so deep into WordPress – fixing other people's messes. When I finally quit and went freelance I made a promise to myself that if a client came to me with a project that looked absolutely miserable, I wouldn't accept it. My life is incalculably better, and this is one of the big reasons why I'm incredibly hesitant to accept a position for a firm where I don't have final say over which projects I do or do not accept.

kedo
Nov 27, 2007

Like, you want it so that if someone puts >= 500 in one field, the form auto-updates on the fly (without a page reload) to set field 2 to -500?

JavaScript code:
let val = parseInt( $('.field1').val() );
if ( val >= 500 ) {
	$('.field2').val( 500 );
} else {
	$('.field2').val( val );
}
If you're passing values to field1 when the form is rendered, just run that JS on document ready, and then again whenever field1's value changes.

kedo fucked around with this message at 15:44 on Mar 28, 2022

kedo
Nov 27, 2007

Hmm, so I wonder if I'm following you correctly – your goal is for a user to submit a form, and upon submission you want a specific field to be modified and then you want to save the modified value in the entry (ie. the original unmodified value gets completely replaced)?

My understanding is that gform_calculation_result doesn't actually update the entry, but just returns a value based on your math. I think you might need gform_pre_submission to actually update the value in the entry?

kedo
Nov 27, 2007

Basically no (this is one of the big reasons why I absolutely loath page builders).

Depending on what the actual page content looks like, I'm assuming you see a whole bunch of HTML content and shortcodes in your posts? The best I've been able to do with stuff like this in the past was to write a custom Node script that would either use various DOM manipulation tools and/or regular expressions to strip out all of the unnecessary VC crap, but it is a slow, tedious process.

I charge an arm and a leg for work like this because I hate it.

kedo
Nov 27, 2007

worms butthole guy posted:

also if any WordPress developers are looking for work, I am looking for someone to take over my old clients who are annoying as gently caress small businesses. It pays lovely, probably $35 or $40 a hour and its self employed so it's not consistant but if anyone wants some WordPress work send me a PM and I can put you in touch

Way to sell it. :P

kedo
Nov 27, 2007

Yeah, I have mostly stopped working with small businesses for exactly this reason. I got tired of every invoice being nitpicked and every email subject line saying something along the lines of "URGENT/BUSINESS CRITICAL!!!! my pink text isn't showing up as pink"

kedo
Nov 27, 2007

worms butthole guy posted:

yeah i remade it for them :suicide:

You are too nice. My response to this sort of thing is "Sure, I'd be happy to help you with this! Here's an hourly work contract with my rush rate. I estimate this work will take X hours, so the invoice requires a deposit of Y to cover initial expenses. I look forward to helping you with your project!"

The only person in my life who I'll do work for for free is my wife because she's the person who has to listen to me bitch and moan about doing free work (so she pays for it in a way, I guess). No one else gets free work, period.

kedo
Nov 27, 2007

Are you contracted to do maintenance work? Because if so and if you're not doing it, then it doesn't just "feel" like a scam. ;)

kedo
Nov 27, 2007

fuf posted:

Another issue caused by the same dev who decided to roll his own contact form design... This time it's an ACF thing.

The error is
code:
[04-Oct-2022 08:29:10 UTC] PHP Fatal error:  Uncaught TypeError: Cannot access offset of type string on string in room.php:121
line 121 of room.php is:
code:
 <?php if ( get_sub_field( 'booking_button' )['title'] ) { ?>
Apparently this was just a warning in php7 but is now a fatal error in php8.

Any suggestions on how to fix greatly appreciated...

It looks like that line expects 'booking_button' to return an array, but instead it's returning a string. I'd check to see what it's actually returning and then adjust your code accordingly.

kedo
Nov 27, 2007

Yeah, the pre-made theme market is a poo poo show these days because everyone is trying to compete with the likes of Squarespace and Wix, so if your theme doesn't come with a site builder built in, it is bEhInD tHe TiMeS. Elementor isn't terrible, but it isn't great either. I had to make a site with it once (due to a client's request) and it was an absolutely massive pain in the rear end. I won't touch Divi.

kedo
Nov 27, 2007

zmcnulty posted:

My contact form seems to have died sometime around August 2nd. I only noticed about a week ago. It collects data but no longer emails me the form results. So I have to go into the dashboard -> Feedback -> Form Responses to see what I received. Luckily I didn't miss anything hugely important, but it is how I receive most inquiries via my site.

Does this sound like a WP issue or something else? I'm running 6.0. Because it wasn't working, I tried converting the page from old-school block editor to Gutenberg, and change my email, but appears to have done nothing. If I could somehow identify what happened around August 2nd, like if I did a WP upgrade or plugin upgrade or something, it might help. Does WP keep a log like that somewhere? I may or may not have removed some plugin, but in that case, the form wouldn't work at all, correct?

If it matters, I still get other emails from WP, like the email subscription confirmation.

WordPress is notoriously terrible at sending email. Try WP Mail SMTP paired with your SMTP provider of choice and just use someone else who specializes in email instead. This is the silver bullet for 99.99% of WP email problems.

kedo
Nov 27, 2007

My company is going to be hiring a WP dev in the near future. We'll be looking for someone who is up to date with modern best practices, has familiarity working with a fairly standard toolset (ACF, Gutenberg, Sage 10), and strong skills with S/CSS, JS, and PHP. Experience with modern JS libraries (eg. React, Svelt, etc.) is a plus, and attention to detail an absolute requisite.

The company itself is stellar to work for – competitive pay, outstanding benefits, great client list, wonderful coworkers, etc.

If this sounds like a good fit for you, shoot me a PM!

kedo
Nov 27, 2007

Unless you have a WP caching plugin enabled, I'd imagine the caching is taking place within your plugin. WordPress has extremely limited native caching abilities, and what you've described doesn't sound like something it would do on its own.

kedo
Nov 27, 2007

Basically no. You'll have PHP error logs and access logs on your server, but those probably won't contain the type of data you're looking for.

Adbot
ADBOT LOVES YOU

kedo
Nov 27, 2007

What’s the plugin, and what version are you starting with?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply