The "No Dev Question is Stupid" Thread - Basic HTML / CSS / Etc.

@JasonSc, I think defer only defers the execution of the script but not the downloading of it.

I'd try async instead and see if that helps. At least this way the rest of your resources can keep downloading.

Otherwise there's more advanced deferring methods you can use that require more code though.

If this is a script you're inserting into the HTML yourself, you can try to manually defer it by moving it to the footer and "truly" defer it.
 
We migrated to Jotforms (not my choice) and these forms are stupid large and are slowing things down. 300KB and 6 server calls for a simple contact form.

As much as I want to use something else I can't, again not my choice. I would like the form to delay loading until after the dom is complete.

This is the code jotform provides:
Code:
<script type="text/javascript" src="https://form.jotform.com/jsform/1111111111"></script>

I tried this and it doesn't work:
Code:
<script defer src="text/javascript" src="https://form.jotform.com/jsform/1111111111"></script>

This is for Wordpress sites and the form is on every page of the site.
Put the line at the bottom of the page. It'll load after the body is loaded.
 
Any idea on dumping a MySQL table into Google Sheets automatically?
 
Any idea on dumping a MySQL table into Google Sheets automatically?
You could use the JDBC google apps scripts to do it. Try something like this: https://stackoverflow.com/questions/42208721/how-to-connect-google-sheets-to-database

I use Supermetrics which I believe uses the same connection. But it's very straightforward, plug in in the database connection, put in your SQL and go. It will notify you if anything fails. The frequency in which you need to refresh the data on a schedule may determine whether this is the right route for you, pricing goes up for daily and hourly.
 
@ryandiscord Are you happy with Supermetrics and what do you use it for?

I forgot about them, but considering now. I think they could help me with my "battle station" setup to understand what's going on across multiple sites.
 
I'm very happy with it, I've been using it for years doing reporting. I use it to collect unsampled data from Analytics (weekly increments). I primarily use the Google Analytics, Google Ads, Bing Ads, and Database connectors.

I use the MySQL connector to combine internal data with traffic data to create sort of a closed loop reporting system.

For multiple sites you can select several accounts in Analytics and pull them all in on one query, which can save you some time stitching things together in Google Sheets.
 
Not sure if this is the place to ask, but STDDIOT did not seem appropriate.

While writing posts in wordpress, I noticed a difference betweens "Posts" and "Pages".
I kept the time sensitive stuff in Posts, and transferred my Evergreen and pillar content to pages.
Now I noticed that Pages don't have categories. I'm seriously considering adding a plug-in to resolve this.
I'm just wondering how everyone else is handling this. I read everywhere that adding too many plugins is a bad idea, so I figured I'd better get some more insight.

Maybe people just removed the date stamps from their posts, and kept on posting?
 
@WinMore, that's basically a misuse of the intended Wordpress system.

Pages are for or can do:
  • for boilerplate content like About, Contact, Terms & Conditions, etc.
  • can have sub-pages, like .com/gloves/best-winter-gloves/
  • can have publish dates or not, up to you
Posts are for or can do:
  • for non-boilerplate content, like blog posts, news articles, etc.
  • can have categories, like .com/gloves/best-winter-gloves/
  • can have publish dates or not, up to you
I've seen a lot of people use pages and sub-pages to establish a "silo" structure. Everyone I've encountered doing that has come to regret it. It works that way if you want a "parent post" like /gloves/ and you don't know how to customize Wordpress's category templates.

If you're doing it just to separate Evergreen/Pillar content with posts that have time stamps, that's really not the way to do it. If your Pages don't have timestamps but your Posts do, that's unique to your theme and not anything to do with Wordpress itself.

The way I'd do it is create a function that stops the the_date() from firing in those categories that you don't want it in, or I'd create a child theme and customize the templates with "if loops" to make it only fire on certain categories.

Because now you have a compounding issue. I doubt your pages (not posts) are appearing in your category templates or in any "blog roll of posts" at all.

If you don't want to show dates to Google you have some work to do. If you want to hide them from users you could use some simple CSS to hide them without changing anything else.

If your pages and posts are using the permalink structure where it's just .com/slug/ then great. If you're having to do 301 redirects, I'd rewind everything you did and pursue this in a different way.
 
Yes, I also began working with pages, and they rank fine, but as Ryu says, that's working against Wordpress, not with it.
 
Any idea on dumping a MySQL table into Google Sheets automatically?
I think most will require you to expose the MySQL port, so something to think about. You can run a script server-side and connect to the database locally, and write to the google sheet i.e. in PHP or Python.

I'm sure there are other ways too, but I've never dealt with it.

Google Data Studio also has a connection for SQL.
 
Hi, I have a question, for the life of me, I can't crack!
How does a Wordpress site display the IP of a visitor to them?
ONeKGXy.png

Any ideas?
 
How does a Wordpress site display the IP of a visitor to them?

It's done through PHP: https://www.php.net/manual/en/reserved.variables.server.php

Basically:
PHP:
$ip = $_SERVER['REMOTE_ADDR'];
echo $ip;

That's going to get you the IP they're showing to the world, which could be a proxy or VPN, in which case that's their problem. There's several methods to try to get underneath the proxy but in the example that you're showing, there's no need to do that.
 
trying to add this code to my site child theme functions.php


Code:
// CURRENT YEAR SHORTCODE
function currentyear($atts = [], $content = null) {
// always return
return date("Y");
}
add_shortcode('currentyear', 'currentyear');
add_filter( 'single_post_title', 'my_shortcode_title' );
add_filter( 'the_title', 'my_shortcode_title' );
add_filter( 'wp_title', 'my_shortcode_title' );
function my_shortcode_title( $title ){
return do_shortcode( $title );
}
add_filter( 'pre_get_document_title', function( $title ){
// Make any changes here
return do_shortcode( $title );
}, 999, 1 );

But I keep getting the error

Code:
Your PHP code changes were rolled back due to an error on line 21 of file wp-content/themes/generatepress-child/functions.php. Please fix and try saving again.

syntax error, unexpected ';' (T_STRING), expecting ';'

Where line 21 is
Code:
return date("Y");

???
 
@FrankCertain, try deleting that ; and retyping it (especially if you pasted this code from somewhere else. Sometimes they get encoded weird. It might be unicode or whatever and look like an ; but actually be U+003B or &#59; or &semi; as examples.
 
I'm going to do a database of products for a price comparison website, but I'm going to import the database in JSON or XML to Wordpress because my site is in Wordpress.

Would MongoDB be a good choice for such a local, data enriched database?

The goal of the database is to create a json or xml file with all the custom fields and taxonomies to go into Wordpress, while the data enrichment happens off Wordpress in Python. Stuff such as historical prices or color of the product. Scripts running and working on the database, while it gets exported, say once a week into xml.

Is there any need to do SQL database for that?
 
No mongo db is never a good choice.

It’s crap tech pushed by dumb shit hipsters that can’t meet its advertised specs.

Don’t fall for the fake news content marketing hype around it.

@bernard
 
Experienced WP Devs:

You're going to migrate a relatively small content site to a new Digital Ocean droplet. Setup, secure, harden, fail2ban, etc. How many hours would you estimate / budget?
 
Experienced WP Devs:

You're going to migrate a relatively small content site to a new Digital Ocean droplet. Setup, secure, harden, fail2ban, etc. How many hours would you estimate / budget?
Did it many times. 1 hour at most if you use Runcloud or similar
 
Did it many times. 1 hour at most if you use Runcloud or similar
1 hour?

Forgot to mention it will have openlitespeed installed. Also, it's coming from Cloudways, not just another DO droplet. Does this change anything?

Thanks for the response btw.
 

1 hour is not realistic. It literally leave zero room for error. If some developer HAS done migrations from XYZ to Digital Ocean BEFORE and has experience within setting up security that's one thing, but still 1 hour, no.

I assume you are trying to figure out whether a programmer is giving you a decent rate or trying to estimate the cost of movement.

For me if I was to migrate a WordPress install to somewhere else I would think it would be a weekend afternoon project so 5-10 hours. Most likely I will do it in under 2 hours, but something ALWAYS goes wrong, especially if it is a new environment for the programmer that is migrating the install.

I'm familiar with Digital Ocean but I haven't used it extensively where I can quickly work my way around it like Linode, so even for me, knowing the checklist of security hardening, disabling root login, etc - it's still going to take several hours because you have to CHECK the site pages, the SSL setup, image permissions are correct, WordPress's permissions are correct, the apache/nginx server settings, make sure all the server plugins (apache or nginx) are there like mod_rewrite.c for clean URLs like www.example.com/hello-world/ instead of /index.php?id=1.

And then there are the WordPress plugins, maybe you don't have a lot, doesn't mean that the new environment will be an easy plug and play.

And then you have to check that the migration didn't cause a Page Speed problem.

1 hour is way too optimistic and assume the developer knows 100% your old environment (Cloudways) AND 100% your new environment (DigitalOcean droplet). Even then something always goes wrong.

Find a developer that knows both environments and has experience doing that migration, but even you need to account for human error, something you didn't tell the developer since you didn't think it was important, or even server setup errors.

It's like getting an oil change, If the sales guy says 10 mins - that doesn't sound right just based off of experience. CAN it be done in 10 mins? Yes, Jiffy Lubes exist. WILL IT? Doubtful.
 
Well if you are migration between different server setups (litespeed vs apache) it may take longer to check for errors. (but still, LS uses htaccess so I guess it will be fine) But I did it several times and it's not that complex.

Basically you need to migrate the files + the database.

I said 1 hour only if you are using something like runcloud that setups all the security basics for you and has checkboxes for some things Carter mentioned (prevent root login, prevent password login, etc)
 
I assume you are trying to figure out whether a programmer is giving you a decent rate or trying to estimate the cost of movement.
Spot on.

And then you have to check that the migration didn't cause a Page Speed problem.
Lol, it's actually to bring the page speed down.

Thanks so much for the detailed reply as always. Extremely helpful.
 
Anyone have a list of useless elementor .js .css files that are known useless and can be removed sitewide? I'm trying to speed up my site everywhere I can after adding ads and tanking the speed with my 0 coding knowledge
 
Something is adding a nofollow to my links. How do I figure out what is doing it?

So, I'm throwing everything but the kitchen sink at my sinking site, and am validating my HTML at the moment. Running each page via address through the W3 validator (https://validator.w3.org/) is pulling up a bunch of errors for nofollows "not allowed on a element at this point".

The HTML looks like this according to the validator:
<a class="xyz" href="www.xyz.com" target="_blank" rel="noopener nofollow" nofollow>

But when I look at my HTML in Wordpress, I'm not the source of this error.

How do I discover what is adding this to my links?
 
Last edited:
Look at your html in the browser (View Source). If the extra nofollow is not there it is likely a validator problem. If it is, then something in your site and hosting process is creating that - in other words, 'you' are the problem.
 
Back