Wordpress questions - presets

Status
Not open for further replies.

emp

New member
Jun 29, 2006
7,467
211
0
Hi all.

In the spirit of "work smarter - not harder" I have a few questions.

Can anyone point me to the place where I can preset soem settings for links and images?

For examples, I would like my images to have a spacing of 4px and 4px, and a border of 0. It'd be great if that was pre set in the dialog.

The links should point to a new window per default.

Any hints?

Thanks,
::emp::
 


Hi emp,

I hope I understand you right. For images in Wordpress I like to use Inline CSS to make certain images look cool, so I add an image as normal and then I add code like this;

Code:
style="border: 1px solid silver; padding: 4px; float: left; margin-right: 10px"
I add the above in the <img src=""> part of the code, so the whole thing will look like;

Code:
<img src="Image.jpg" style="border: 1px solid silver; padding: 4px; float: left; margin-right: 10px" />
To adapt this across an entire Wordpress blog you can put the following anywhere in the theme style.css file;

Code:
.entry img{
        border: 1px solid silver; 
        padding: 4px; 
        float: left; 
        margin-right: 10px;
       }
As regards all links pointing to a new window by default, I'm not too sure how to do that site-wide, but to do it to a chosen link is easy enough by using;
Code:
<a href="link" target="_blank">Title</a>
have fun, :)
 
For having all external links open in a new page you can use this javascript:

Code:
if (! document.getElementsByTagName ) return;
var anchors = document.getElementsByTagName("a");
for(var i = 0; i < anchors.length; i++) {
	var anchor = anchors[i];
	if( anchor.getAttribute("href") && anchor.getAttribute("href").indexOf('yoursitewithoutwww.com') == -1) {
		anchor.target = "_blank";
	}
}

(Untested)
 
Status
Not open for further replies.