.Htaccess rewrite URL - Only specific string - wordpress

We have a current issue with a theme and until the developers of this theme fix the issue we need a quick workaround.
What the theme is doing is outputting the wrong URL for images via Amazon
What it is outputting is:
//images-eu.ssl-images-amazon.com/images/I/51heut5jiDL.jpg
What it should be is:
https://images-eu.ssl-images-amazon.com/images/I/51heut5jiDL.jpg
What we need to do is change all images outputting
What we don't want is the output already duplicating i.e. https://https:// etc etc as we already have images in place that are using the correct output.
Thanks in advance - hopefully the owners of the theme fix this quickly we just need a workaround and think .htaccess is the best bet.
This is on the wordpress platform - theme is kadence / virtue
Thanks

Related

Wordpress: how to know which page is requesting a specific css file

I am helping out a friend with a slow WP. I installed hummingbird and it's telling me that some css files are slow to load (for example: https://cdnjs.cloudflare.com/ajax/libs/gsap/1.11.2/TweenMax.min.js - it takes 390ms to load). I would like to store this file locally and see if the performance improves. The problems is that I'm not sure about how to locate the file that is actually requesting this css file. Any help is appreciated.
I suggest a sweet plugin I use called String locator. It will search the whole site for a string like TweenMax.min.js. It will also search by plugin. When it find it it gives options to edit straight to the file. Hope this helps.

Views Drupal Clone

I've purchased a theme which turned out to not being well documented or supported and after almost completing my website I came across a problem that I can't solve :(
I should start saying that I'm a newbie and this is probably really easy but I can't seem to find the answer.
I created a clone of a view which has a really nice style to it:
http://www.calaverastattoo.com/portfolio/category/
and my clone looks like this:
http://www.calaverastattoo.com/portfolio/category/angel
If someone has an idea of how to fix this I'd really appreciate your help.
Thank you
It is probably because of missing CSS styling. Make sure to copy the required CSS code in the new theme.
You need to duplicate the following files and put them in the same folder location as the originals.
So for example /sites/all/themes/YOURTHEME/templates (This is a guess) will contain the following files. I think angel is the name of your new view?
original - views-view-fields--portfolio--page.tpl.php
duplicate - views-view-fields--angel--page.tpl.php
original - views-view-fields--portfolio--items-summary.tpl.php
duplicate - views-view-fields--angel--items-summary.tpl.php
original - views-view-fields--portfolio--items-summary.tpl.php
duplicate - views-view-fields--angel--items-summary.tpl.php
original - views-view-unformatted--portfolio--items-summary.tpl.php
duplicate - views-view-unformatted--angel--items-summary.tpl.php
original - views-view-unformatted--portfolio--page.tpl.php
duplicate - views-view-unformatted--angel--page.tpl.php
original - views-view-unformatted--portfolio--page.tpl.php
duplicate - views-view-unformatted--angel--page.tpl.php
As this is a custom theme you have bought I'm not 100% of how it loads the template files the above example would work with most drupal base themes.
Cheers Dan
I'm guessing that the view that comes with template you have bought has it's own template which will be a file in the theme directory called something like this (possibly in a directory called tempaltes)
views-view-page--portfolio--portfolio.tpl.php
If you edit the original view look in the bottom right hand corner of the page there is an option called theme with a link called information. Click Information and it shows you which templates files will affect that view.
Thanks

How to make sure changes to a Wordpress plugin won't be lost on plugin update?

I'm pretty sure I've read somewhere that you can actually move the main plugin *.php file to somewhere else (I assume under your theme directory) to have it safe in case you made changes to it and your plugin updates. I tried Google but I can't find anything. Google page with good results will suffice.
I've just experienced a situation where my 2 plugins which had its layout changed and accommodated my needs and I want to make sure it doesn't happen again. Apart from having the main file in another location, is there a way to move along any CSS and JS files as well?
In Concrete5 CMS there is a nice way of doing this, by creating a new folder inside a block of an addon (may be regarded as a WP plugin), inside of which you can create copies of main file, any CSS and JS files and then you can simply edit them and choose that template for a page location you are using that block in.
I assume there is no such thing in Wordpress but how close can I get?
UPDATE: I found where I applied that advice on creating a new instance of the file then moving it to the theme directory.
The plugin in question was HL-Twitter. These are the plugin files:
admin.php
archive.php
functions.php
hl_twitter.php
hl_twitter_archive.php
hl_twitter_widget.php
import.php
widget.php
Now, this is the top contents (commented out) of the hl_twitter_widget.php:
Widget Theme for HL Twitter
To change this theme, copy hl_twitter_widget.php
to your current theme folder, do not edit this
file directly.
Available Properties:
$before_widget
$after_widget
$before_title
$after_title
$widget_title
$show_avatars
$show_powered_by
$num_tweets: how many tweets to show
$tweets: array of $tweet
$tweet: object representing a tweet
$tweet->twitter_tweet_id
$tweet->tweet
$tweet->lat
$tweet->lon
$tweet->created
$tweet->reply_tweet_id
$tweet->reply_screen_name
$tweet->source
$tweet->screen_name
$tweet->name
$tweet->avatar
$user: represents the Twitter user (ONLY SET IF SHOWING A SINGLE USERS TWEETS!)
$user->twitter_user_id
$user->screen_name
$user->name
$user->num_friends
$user->num_followers
$user->num_tweets
$user->registered
$user->url
$user->description
$user->location
$user->avatar
So I was wrong about copying the main file (in this case hl_twitter.php), but still - this enabled me to edit the file outside the plugin directory and the system somehow checks for its existence and picks it up if exists.
If this behavior something that is natively supported by Wordpress or it has been integrated in the plugin itself?
With themes, Wordpress has a concept of "child themes" which allows exactly that: to keep changes separate from main theme, in case it changes.
I haven't yet found a way to do this with plugins.
I'm using a few tactics myself:
I bump plugin version to a very high number like 99.9. This way Wordpress won't ever update the plugin.
Store my plugins in version control (i use git, but it doesnt matter), this allows you to update the plugin, run the 'diff' tool and see what changes happend. If you don't like you just revert like it would be a bad code you've written. But this approach requires a bit of skill.
Are you talking about running parts of a modified 3rd party plugin, and an updated version, at the same time?
That's not going to be possible. There is no magical method of "preserve my changes and transfer them into the new version automatically". The way to go here is doing a diff between the edited version and the update, and integrating the changes in the actual source files.
The bottom line is, if you manually edit a third party plugin, you're in for manual review (and possibly rework) once an update takes place. That's why it's usually not a good idea to extensively modify third party plugins.
Well in fact, yes! There is some kind of way.
You have to remove the to be modificated plugin's original actions/filters and then add your altereted actions/filters.
If the desired plugin is even coded in OOP you can just inherit the whole class and rewrite the wanted functions (oh sorry: "methods". we're talking about OOP ;) ). Instantiate your inherited class and rest as above.
Maybe there are better ways! I already search for a method so that the original class won't even get loaded but our altered one instead but I'm no John Carmack.

Wordpress Custom Post Type CSS & JS 404

I'm having a weird problem on a Wordpress site that I've built. I set up custom post types for a portfolio site, circa Wordpress 2.8. Everything worked out great and it was on auto pilot. Somewhere between Wordpress 3.0 and 3.1, the style.css file started throwing out a 404, but only on the single post pages.
EDIT - It's actually every included file. CSS & JS. The plot thickens...
I'm baffled, and I don't even know where to start. I changed the permalinks, re-did the .htaccessfile. Has anyone else ran into this problem?
Here's the link to the site if you want to FireBug it - http://artifexmakeup.com
Sorry, I would post some code, but I have no idea where the problem even begins... but let me know what you need to see, and I'll post it.
You're not linking to the style sheet somehow. I'll look at it in detail when I get off work. I would check the names of your classes in the CSS and make sure that the body class for the single post is named correctly. It appears that the reference to the stylesheet is in the head; I think that's ok. Nice photos!
Your problem is that your files are specified with relative path, so you get wrong url.
http://artifexmakeup.com/patty-boring/wp-content/themes/ArtifexMakeup/html5-boilerplate/css/style.css?v=1301356717
Here patty-boring/ messes up your urls.
I don't know how you specify urls in theme so I can't tell you where you're doing wrong.
Turns out it's something with mod_pagespeed screwing with the custom post types. Thanks for your help!

Template files not being discovered

I was experiencing an odd problem where blocks were not showing up on a site. After a lot of spelunking I have found that block.tpl.php is not getting called/discovered.
Looking at the suggestions that the theme engine is trying to find it looks like the most general template it will look for is block-MODULE.tpl.php - ie if I set up symlinks for block-block.tpl.php, block-views.tpl.php etc then the content will show.
It just won't find block.tpl.php
So I can kind of make the problem go away, but I'd feel a lot better if I could fix it properly.
Anyone know why (or where) this would happen?
This is drupal 6, with a zen subtheme. zen is in sites/all/themes/ the subtheme is in sites/example.com/themes/.
(it does seem to be finding page.tpl)
PHPTemplate will find the more general templates (e.g. block.tpl.php): you can confirm this behavior by looking in the themes/garland folder which has its own block.tpl.php.
The most common reason for the template engine ignoring your template overrides is because the theme registry has not been reset. You can reset it by going to Site Configuration -> Performance and clicking Clear cached data at the bottom of the page.
Also make sure you've gone through and followed the instructions for sub-theming exactly: missing a step can produce unexpected results:
How to build your own sub-theme (6.x-2.x)
How to build your own sub-theme (6.x-1.x)
Turns out I had added a to the hook_theme() function in template.php for blocks that was pointing to a different location and confusing everyone.
Why I did that is lost to history, but it seems to server no useful purpose.
there should be a version of block.tpl.php in both the theme and subtheme directories.

Resources