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
greazeball
Feb 4, 2003



Fixins posted:

I don't use Jetpack. Because of horror stories like that. Sorry it happened to you.


kedo posted:

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.

haha I had no idea both of the products were so bad. They've served her OK so far although I think she's done with Jetpack for sure at this point. Fortuantely, someone else in the non-profit where she works hosed up a quarter million dollar purchase on behalf of the federal agency that provides the majority of their funding just last week so she can probably fly this little hiccup well under the radar.

Adbot
ADBOT LOVES YOU

GRECOROMANGRABASS
May 14, 2020
It's been a while since I've used WordPress, and my googling doesn't seem to involve the right words.

I am trying to restructure an existing site, which contains many pages. Each page has information about a location where you can find a thing. The people that made this site do not have the locations classified in any particular way.

I want to create a URL structure similar to https://example.com/locations/state/city/name-of-a-place-where-thing-is and move the existing pages to the state and city they belong in, with 301 redirects from their existing URL to the new URL.

I imagine this is a common enough problem that someone might be able to nudge me in the right direction? Any help would be greatly appreciated.

fuf
Sep 12, 2004

haha
could you just change the permalinks on the existing pages to match the new structure and then use a redirect plugin to redirect the old URLs to the new ones?

I can't name a good redirect plugin off the top of my head but I know they exist.

kedo
Nov 27, 2007

Redirection is the only redirect plugin that is worth anything.

aperfectcirclefan
Nov 21, 2021

by Hand Knit
"We're getting inundated with spam! Drop everything you're doing and fix this!"

>its literally 3 comments of spam

Small businesses can be annoying sometimes.

aperfectcirclefan
Nov 21, 2021

by Hand Knit
I'm starting to learn the Roots stack of Sage / Bedrock / Trellis. Do any of you use it? I don't know how I feel about it. The templating engine is kinda cool I guess but alot of it sems unnecessarily complex, like having to deal with ACF via code instead of using the UI...

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.

aperfectcirclefan
Nov 21, 2021

by Hand Knit
Seems to be the same things I've experienced so far. You're right it's not php beginner or probably intermediate friendly, it's very devout lol.

aperfectcirclefan
Nov 21, 2021

by Hand Knit
What do you use instead of Trellis btw, Local? It takes me like a half hour to set up a trellis since i'm always dealing with errors.

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.

aperfectcirclefan
Nov 21, 2021

by Hand Knit

kedo posted:

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.

Thank you for this post. The place I have a second interview with next week uses Pantheon, so I should probably quickly learn how to use them and Localdev. I personally use Kinsta but never bothered with DevKinsta; usually what I do is create a install on cloudways and then migrate it over lol. Trellis is making me crazy though with random errors, so maybe i'll try these out. I've done a LAMP stack on Digitalocean and didn't mind the process, I should try that also.

pipebomb
May 12, 2001

Dear God, what is it like in your funny little brains?
It must be so boring.
Nothing to see here.

pipebomb fucked around with this message at 23:41 on Mar 1, 2022

pseudanonymous
Aug 30, 2008

When you make the second entry and the debits and credits balance, and you blow them to hell.
Is this a place I can try to find a goon to pay to help me out with my Wordpress blog site?

fuf
Sep 12, 2004

haha
help out by answering questions or as a job?

questions yes, but I think there's a separate job thread somewhere

jonboy8871
Sep 25, 2003
What the deuce?

Never posted in this forum before, but I can only hope y'all might be more help than the Wordpress forums. My problem is that I'm a small publisher trying to do it all myself, and I have a site with lots of posts and absolutely none of them are displaying anywhere--not on any page I set as the Post Page, and not in any widget that's supposed to import recent posts.

The theme I’m using is The Newspaper, if that makes any difference. At some point, I was “cleaning up” the default content that came with the theme and deleted the default homepage/front page by mistake. Now, I can’t get my posts to display anywhere on the site.

I'm frustrated enough that ordinarily, I might have just deleted my whole site and started over, but I feel like I’m too far along at this point to do that. There are a fair number of posts on there somewhere. And I’ve done enough other initial work on the site that I dread the idea of to having to do it all over again.

I’ve tried toggling the Static Homepage setting to see if that would help, but it didn’t seem to. I’ve created several different kinds of block/widget content that should display my recent posts, but still nothing shows up at all. I tried this with some existing pages first, then I created a new page to see if that would work, but the result was the same with both.

I have the PaidMembershipsPlus plugin as my paywall–the site is for a small weekly newspaper. At one point, and I don’t even know what I did differently, one of the “Latest Posts” blocks I tried one one of my test pages ended up displaying ONLY my custom “Subscribe to keep reading” language that the plugin interrupts paid content with. But there were no post titles, images, excerpts, or links visible.

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?

jonboy8871
Sep 25, 2003
What the deuce?

It currently has my homepage as a static page--the site's login page. And the "Posts Page" is a different page I created, which is still completely blank. It remains blank even if I stick in a "Latest Posts" widget.

I also tried swapping that homepage setting around and making the homepage display latest posts, but that also results in a blank page.

fuf
Sep 12, 2004

haha
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.

aperfectcirclefan
Nov 21, 2021

by Hand Knit
Tbh see if your new host has a site migrator plugin and use that if you can. I know Kinsta offers a free hand migration with their services

fuf
Sep 12, 2004

haha
yeah it's just a standard cPanel account on both sides of the transfer unfortunately

pseudanonymous
Aug 30, 2008

When you make the second entry and the debits and credits balance, and you blow them to hell.
Just wanted to say that apefectcirclefan was very nice and helped me out with my Wordpress blog and I really appreciate it.

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

fuf
Sep 12, 2004

haha
Thanks. The thing is once you get used to something like softaculous where you literally just punch in the ftp details and it does it all for you, including creating the destination DB, then basically you get lazy... so I was hoping to avoid doing it the manual way. I was hoping there was something similar but that would work with a dead source URL.


kedo posted:

3. If you need to change the site's domain, do four find/replace in the downloaded .sql database thusly:

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.

It's generally better to use something like https://interconnectit.com/search-and-replace-for-wordpress-databases/ or wp-cli or one of the database search-replace plugins to handle that data.

Kill All Cops
Apr 11, 2007


Pacheco de Chocobo



Hell Gem
I never used All-In-One Migration, but I usually use Duplicator which should fit the use case. Install on the old WP, download as a zip/installer.php file, upload files to new site, connect it to a db and fill in the new site URL and it does it all for you.

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.

fuf
Sep 12, 2004

haha

kedo posted:

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.

Themes and plugins store data as PHP serialized arrays in the database all the time, so if any of those arrays contains an absolute URL (like a link to an image) then a normal search/replace of old URL / new URL will definitely break those arrays.

Ideally there shouldn't be any references to the site's URL in the DB outside of siteurl and home in wp_options, but it still happens all the time. Usually because page builders love absolute URLs for images and links, but also just because of user error (someone can easily link to a page or post using an absolute instead of relative URL).

Basically if there's any risk that the database might contain references to the old site URL then it's safer to use a proper search/replace tool.

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

fuf
Sep 12, 2004

haha

kedo posted:

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

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!

aperfectcirclefan
Nov 21, 2021

by Hand Knit
Are any of you smart with Gravity Forms? Is there a way to hook into it to create logic to fill out a field? For example I want to apply a discount programarically.

I hate gravity forms.

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.

aperfectcirclefan
Nov 21, 2021

by Hand Knit

kedo posted:

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.

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.

I think this points me in the right direction, thank you. I guess the trouble now is I need to figure out how to get that hook to be able to read the data in a field or to side load javascript I guess. Essentially I need:

if field1.amount >= 500
field2.discount == -500
else
field2.discount = field1.amount

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

aperfectcirclefan
Nov 21, 2021

by Hand Knit
Yeah I figured it could be done that way! Sweet. Thanks Kedo!

aperfectcirclefan
Nov 21, 2021

by Hand Knit

aperfectcirclefan posted:

Yeah I figured it could be done that way! Sweet. Thanks Kedo!

Hey Kedo, wondering if you might have a idea how to solve this GravityForms totalling issue I have :v:

https://stackoverflow.com/questions/71697049/gravityforms-altering-grand-total

Thanks!

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?

aperfectcirclefan
Nov 21, 2021

by Hand Knit
Yep that should be right, and that sounds like the correct action. Thank you, i'll reply back with results!!

GRECOROMANGRABASS
May 14, 2020
So, if a site has a bunch of content made using Visual Composer/WPBakery Page Builder, where all the useful data is embedded into buttons/other elements provided by the plugin, is there any sane way to strip all the VC formatting out of the post and dump the author-provided content it into another, non-VC based template?

I'm trying to help with a site that has over 1,000 posts. Each post has data that needs to go into a new layout.

I've tried pulling all the posts via the WP REST API, parsing the VC tags out, and saving the content that I want to keep without the markup generated by VC, and it occurs to me that I may be doing_it_wrong.

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.

GRECOROMANGRABASS
May 14, 2020
I was afraid of that.

Yeah, it's a lot of extremely messy VC tags with random ids and I've written some cowboy code to parse data from each variation of the layout.

It's really terrible.

GRECOROMANGRABASS fucked around with this message at 20:35 on May 6, 2022

Adbot
ADBOT LOVES YOU

worms butthole guy
Jan 29, 2021

by Fluffdaddy
I inherited a site with Divi and I regret it. It's horrendous. Same with Elementor. :puke:

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