A shorter way to set up links in Wordpress posts?

It bugs me that every time I add a link in the content area of a Wordpress page or post, I have to type the entire <a href="http://mywebsite.com/images/myimage.jpg"> text as opposed to quick formats available in php or the css file, such as <a href="url(images/myimage.jpg)">.

Is writing out the entire domain every time the only way to set the link up, or am I missing out on a shortcut?


Besides using the "Add Media" button above the text entry, there is no default way to enter that little info. You can register some short code so you could write it like [img src="myimage.jpg"] in your text editor.


function img_func( $atts ) {
    extract( shortcode_atts( array(
        'src' => 'something'
    ), $atts ) );
    $route = 'http://mywebsite.com/images/'.$src;
    return $route;
add_shortcode( 'img', 'img_func' );
Tags: Html / Css / Wordpress

Similar questions

How to find and modify a string inside the content in WordPress that is shorter than n characters and that is preceded and followed by a newline?
Like the title, I need a simple php code in WordPress that will search the content of every post and if it finds a string shorter than n or 60 characters inside the post and that is prededed and followed by a newline it will modify that string and it will add h2 tags around it. Example: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aene...
Better and shorter solution of PHP code (wordpress, woocommerce)
I wrote PHP code(I am trying to display woocommerce notice - free shipping for $40 & under only once on shop page and once on cart page, but also in cart should not be more than 40$), the code works, but i am not sure that it is the best way to do it: I am new to Programming and I am interested if there is a better and shorter solution of this ...
buddypress: how do i make the group description excerpt shorter?
I set up a theme in buddypress and i want to have a teaser section for my groups on there. It works fine but i have a problem to shorten the group description... I'm using it like this: If thereĀ“s a very long group-description it crashes my layout. Is it possible (like in wordpress) to make the excerpt shorter (with a function or something)? Like "...
Remove 'read more' link when post is shorter than excerpt
How can I remove the 'read more' link from a post excerpt on a blog/archive page when there is nothing more to read...when the length of the post is shorter than the excerpt?
How to display shorter version of wp_editor?
You can use wp_editor to display the wordpress rich editor. How can I display the shorter version (Please see the screenshot, I need that) of wp_editor?
Shorter admin url for options page
Is it possible to create a short admin url for options page? The default admin url is: domain.com/wp-admin/admin.php?page=options-page-slug And i want it to be: domain/wp-admin/options-page-slug

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.