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

JasonSc

BuSo Pro
Joined
Mar 30, 2016
Messages
86
Likes
123
Degree
0
Assuming Apache since it's Wordpress related.

Beware this is untested and may need slight modification to work.


Code:
.htaccess

RewriteEngine on
RewriteRule ^/(.*)\.shtml$ /$1 [NC]
RewriteRule ^/blog/(\d+)/(\d+)/(.*)\.shtml$ /blog/$1/$2/$3 [NC, L]
Thanks for the help. The above code didn't work, but it got me pointed in the right direction.

I got it fixed sort of... The code below works, but its does create a double hope 301. Which isn't ideal, but will work for the time being.

Code:
RedirectMatch 301 (.*).shtml$ https://www.domain.com$1/
RedirectMatch 301 ^/blog/([0-9]{4})/([0-9]{2})/(?!page/)(.+)$ /blog/$3
 
Last edited:

JasonSc

BuSo Pro
Joined
Mar 30, 2016
Messages
86
Likes
123
Degree
0
If you want to backend manage your 301s you could use a plugin like: https://wordpress.org/plugins/redirection/ there are many others, simple to use and at quick glance easier to manage. (For me anyway)
I thought about going that direction, but I just don’t like plugins. Having had several sites hacked in the past I try to keep plugins to the bare minimum.
 
Joined
Dec 31, 2016
Messages
384
Likes
233
Degree
1
Suggestions for WP plugins to go from feed (xml) to an "amazon style" product slider?

Automatically or semi-automatic.

WP All Import to do the feed processing?

Custom Posts plugin to store products?

Which plugin to present it as a carousel?

^ I want to do an automatic "deals" import from a feed and present it on landing pages and probably some faceted search stand alone page.

Woocommerce?

Custom posts?
 
Last edited:

RomesFall

so po qwo ro
BuSo Pro
Joined
Oct 7, 2014
Messages
467
Likes
678
Degree
2
I've got an issue with background-image on mobile as backdrop for some h2 headings.

At first the image wasn't scaling properly so I did a background-size: 100% which solved the issue.

The second issue which I've still not solved is I can't get the image to add any amount of height which has caused the h2 to overlap the image or go outside of the boundaries of the background image.

I thought ok that's cool I'll just change the color property so it's visible in black instead of white when it's outside of the boundaries of the background image on smaller devices but for whatever reason - don't ask me why - any new media query I add isn't actually working (it's applying to desktop as well).

Done media queries many times, it's just freaking odd.

Could this be because of a caching plugin or anything like that? Usually, CSS updates are visible without clearing the cache on this site.

I'm thinking it's just some kind of bug with my theme or something like that, god knows the number of updates that have gone by since I last added CSS to the site.

Any ideas?
 
Joined
Apr 7, 2016
Messages
266
Likes
169
Degree
1
I've got an issue with background-image on mobile as backdrop for some h2 headings.

At first the image wasn't scaling properly so I did a background-size: 100% which solved the issue.

The second issue which I've still not solved is I can't get the image to add any amount of height which has caused the h2 to overlap the image or go outside of the boundaries of the background image.

I thought ok that's cool I'll just change the color property so it's visible in black instead of white when it's outside of the boundaries of the background image on smaller devices but for whatever reason - don't ask me why - any new media query I add isn't actually working (it's applying to desktop as well).

Done media queries many times, it's just freaking odd.

Could this be because of a caching plugin or anything like that? Usually, CSS updates are visible without clearing the cache on this site.

I'm thinking it's just some kind of bug with my theme or something like that, god knows the number of updates that have gone by since I last added CSS to the site.

Any ideas?
It's possible you jumbled up where your rules lie within the cascade. In the example below, the h2 color is defined for all styles then after it is defined in the media query. If you were to switch the order and put the media query rule above the overall rule, the general rule would override it in the "cascade".

Code:
h2{
  background-image: url("https://images.pexels.com/photos/912110/pexels-photo-912110.jpeg);
  background-size: 100%;
  height:200px;
  color:#000;
  }
  @media (max-width: 768px) {
  h2{color:#fff;}

}
You can resize the window to see the media query in action:
Code:
http://jsfiddle.net/tya6cokn/1/
 
Joined
Oct 14, 2014
Messages
68
Likes
51
Degree
0
I have a pretty dumb question--hopefully this is the thread for it.

The WP editor is made to encapsulate new lines in paragraphs (<p>).

So when you press enter for a new line, it won't show you the <p>, even in the HTML tab, but it'll output it. You can get around this by holding Shift+Enter, in which case it'll produce a <br> instead.

OK, so far so good.

In my listicles, I've setup my formatting in a way that entire "sections" are one big list item (<li>), to get the perfect list setup and get those list snippets in the serps. Like WikiHow et al. (https://www.wikihow.com/Jump)

My problem is, working with paragraphs in this environment is a PITA because WP doesn't appear to be setup for this.

So in a list item, when pressing Enter, it creates a new list item (<li>item1</li><li>item2</li>) and that makes perfect sense, but there doesn't seem to be anything to make my life easier, or at least I can't find it. Maybe I'm not asking the right question.

Is there any trick to being able to easliy make new paragraphs by pressing enter inside the editor? Maybe some js of some sort so that I can hold down a key while pressing enter, or something?

Right now I'm manually adding <p> and </p> to each line.

Man, this sure is lame... sry gais
 
Joined
Dec 5, 2014
Messages
70
Likes
65
Degree
0
I have a pretty dumb question--hopefully this is the thread for it.

The WP editor is made to encapsulate new lines in paragraphs (<p>).

So when you press enter for a new line, it won't show you the <p>, even in the HTML tab, but it'll output it. You can get around this by holding Shift+Enter, in which case it'll produce a <br> instead.

OK, so far so good.

In my listicles, I've setup my formatting in a way that entire "sections" are one big list item (<li>), to get the perfect list setup and get those list snippets in the serps. Like WikiHow et al. (https://www.wikihow.com/Jump)

My problem is, working with paragraphs in this environment is a PITA because WP doesn't appear to be setup for this.

So in a list item, when pressing Enter, it creates a new list item (<li>item1</li><li>item2</li>) and that makes perfect sense, but there doesn't seem to be anything to make my life easier, or at least I can't find it. Maybe I'm not asking the right question.

Is there any trick to being able to easliy make new paragraphs by pressing enter inside the editor? Maybe some js of some sort so that I can hold down a key while pressing enter, or something?

Right now I'm manually adding <p> and </p> to each line.

Man, this sure is lame... sry gais
There is a filter called wp_autop you can use to shut off the feature entirely - I haven't seen the list behavior you described before but I would bet it's caused by the wp_autop filter.

I've got an issue with background-image on mobile as backdrop for some h2 headings.

At first the image wasn't scaling properly so I did a background-size: 100% which solved the issue.

The second issue which I've still not solved is I can't get the image to add any amount of height which has caused the h2 to overlap the image or go outside of the boundaries of the background image.
Not a direct solution but check out background-size: cover; - it will scale the width AND height to ensure the background covers the whole element, albeit with some of the image cut off.

I agree the second issue points to a stylesheet issue - https://jigsaw.w3.org/css-validator/ can help with large stylesheets
 
Joined
Dec 21, 2018
Messages
15
Likes
9
Degree
0
For some reason one of my sites has my VPS IP show up in google webmaster and shows up on google search results if I search the right phrases. Anyone have a suggestion on how I can fix this?

I'm thinking 301 redirect may work but not sure how to set that up exactly.
 

CCarter

If they cease to believe in u, do u even exist?
Staff member
BuSo Pro
Boot Camp
Digital Strategist
Joined
Sep 15, 2014
Messages
2,120
Likes
4,812
Degree
6
For some reason one of my sites has my VPS IP show up in google webmaster and shows up on google search results if I search the right phrases. Anyone have a suggestion on how I can fix this?
Your site is setup as the the "default" in the Apache (or NGINX) directory or website. In the apache case, it's most likely that in your "/apache2/sites-enabled/default" file that's where your site is setup, and therefore the IP address (cause it uses a wildcard "*" instead of the your domain.com) resolves to that instead of a blank page or nothing at all (similar situation in nginx).

What you have to do is copy the "default" file over to "mydomain.com.conf" (within "sites-available" folder). Then make modifications so only your domain shows up in the :80 and :443 server portions of the configuration and not "*:80" and "*:443". Doing those "*" (stars) means a wildcard and that's the situation that's causing your IP address to resolve as your domain name. You want your http server (apache/nginx) to not resolve anything if the domain is not explicit.

Actually another method that might be easier is to simply redirect all "*" wildcard enteries to your mydomain.com (www and non-www versions within SSL (443 port) and non-SSL (80 or 8080 port). But you have to create separate entries for the "mydomain.com" somewhere - don't suggest "default" file - but you can. I prefer creating separate "mydomain.com.conf" files for each site and going from there.

Then enable the mydomain.com.conf within apache ("a2ensite" command - a2dissite disables a site). Enabling the site creates a link from the "sites-available" folder to the "sites-enabled" folder that makes it live.

Afterwards disable the "default" using "a2dissite" command. This will remove the "default" reference from the "sites-enabled" folder and only leave it within the "sites-available" folder. Then reload/restart apache.

It's a similar process for NGINX.

Apache2 enable/disable: https://www.linode.com/community/questions/311/how-do-i-enabledisable-a-website-hosted-with-apache

Nginx enable: https://stackoverflow.com/questions/4891344/how-do-i-add-new-site-server-name-in-nginx

--

Basically your website is being resolved when you go to your VPS's IP address - either block that ability OR redirect it within your Apache/Nginx file and that will fix it. A 301 redirect is "okay", but I recommend to do it within the server level for this particular situation.
 
Joined
Dec 21, 2018
Messages
15
Likes
9
Degree
0
Thank you @CCarter I got it working with modifying the apache file. Now one other question, do I have to do anything to get the IP out of google? Or will that happen naturally after it sees the redirect?
 
Joined
Jun 24, 2015
Messages
23
Likes
16
Degree
0
Is there any good plugin to change dates on my posts? Right now, it shows "Published on" and then the date that is actually an anchor.

I would like to have "Updated on" instead of Published. The main goal is to actually have a modified date instead of published on SERP.

Is there any good plugin I can install or should I just hire someone on Fiver...
 
Joined
Jul 6, 2016
Messages
42
Likes
38
Degree
0
Is there any good plugin to change dates on my posts? Right now, it shows "Published on" and then the date that is actually an anchor.

I would like to have "Updated on" instead of Published. The main goal is to actually have a modified date instead of published on SERP.

Is there any good plugin I can install or should I just hire someone on Fiver...
Ask your theme developer.
If it's a paid theme they should be able to support you.