Richard Sweeney
Forum Replies Created
-
Forum: Requests and Feedback
In reply to: Why are images linked by default?Found quite a nice solution to open the linked images in a modal dialogue – I use colorbox as it’s easily the best (jQuery modal dialogue) and very easy to customize.
I added the following to functions.php:
add_filter('the_content', 'addColorbox'); function addColorbox ($content) { global $post; $pattern = "/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i"; $replacement = '<a$1href=$2$3.$4$5 rel="colorbox"$6>'; $content = preg_replace($pattern, $replacement, $content); $content = str_replace($pattern, $post->ID, $content); return $content; }
Which adds a
rel="colorbox"
to hyperlinked images.Obviously you have to link to jQuery and colorbox in the <head> section of your page, but the following simple call will sort you out:
$('a[rel="colorbox"]').colorbox();
Colorbox – and WordPress of course – both allow you to specify a max width / height to stop the linked image taking over the entire screen!
Of course you could use any modal dialogue – there’s even a plugin that will let you do this without getting your hands dirty!
Forum: Requests and Feedback
In reply to: Why are images linked by default?I agree. Seems totally daft.
The hyperlinks aren’t even given a class by default so my idea to put the linked image in a modal dialogue doesn’t even work!
Gotta be a workaround for this somewhere…
Forum: Plugins
In reply to: [Plugin: Audio Player] Specify pages to load scriptsI figured out a way to get around this if anyone’s interested…
I commented out line 141 of audio-player.php (the function to add the scripts to wp_head) and manually inserted this code into the header of the pages I need it for. The footer scripts are generated only for the pages where the audio player appears so there are no weird errors.
The easiest way to do this is to (before you comment out the line in audio-player.php) view the source and just copy and paste the scripts to the header of the relevant page(s).
Phew – that had been bugging me for ages! I HATE calling to 20 scripts on every page, and I guess now goggle will start to hate me for it too!
Forum: Fixing WordPress
In reply to: Individual post pages custom contentNow I’m just flaunting my inexperience! I didn’t have a single.php page for the site, I do now and all is as it should be!
Many thanks equalmark, most helpful!
Forum: Fixing WordPress
In reply to: Individual post pages custom contentthanks for this, I guess I’m not explaining myself very well!
I don’t want the hyperlink to appear on the ‘news’ page, but I want it to appear on any child pages.
For example: the page:
shouldn’t have the link, but the page:
https://www.mysite.com/news/some-news-post-or-other/
should have the link. Know what I mean?
Cheers
Forum: Fixing WordPress
In reply to: Individual post pages custom contentHi,
Yeah exactly. My page called ‘news’ displays the posts.
Forum: Fixing WordPress
In reply to: Change permalinks = 404 Local Mamp InstallationWell, I messed around with permissions a bit (nearly went badly for a while!) and managed finally to make it work!
I also made a .htaccess file for the enclosing folder. Not really sure what made it all work, but it seems to be working fine now.
Thanks for all the friendly help and advice. Very much appreciated.
If anyone’s reading this thread let me re-confirm my current settings in the hope that they might help! I’ve created 2 .htaccess files, one at the site root and the other at the root of the enclosing folder (my Sites folder). Both have the following code:
<IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} ^wp-content.* RewriteCond %{REQUEST_FILENAME} ^wp-admin.* RewriteCond %{REQUEST_FILENAME} ^wp-include.* RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
I didn’t have to change my
httpd.conf
file with MAMP.Forum: Fixing WordPress
In reply to: Change permalinks = 404 Local Mamp InstallationYeah, it does. I’m very puzzled!
Forum: Fixing WordPress
In reply to: Change permalinks = 404 Local Mamp InstallationThanks for the tips!
Although I failed to mention it in my post, I have already tried both of your suggestions… to no avail I’m sorry to say.
Cheers anyway!
Forum: Fixing WordPress
In reply to: WP navigationFantastic, been scratching my head about this one for ages! Good old WordPress, it really is a thing most awesome.
Many thanks esmi!
Forum: Fixing WordPress
In reply to: WP navigationThe site is at: