0
votes

I'm trying to create a simple shortcode function that would work in a link like this:

href="http://www.website.com">[short_code]

Please note, I had to remove the a tag because it wouldn't show. I want to be able to change the anchor text of a link with a single edit across multiple pages/posts.

to accomplish this, this is what I've done:

I've added include 'myshortcodes.php'; to functions.php file and created a file called myshortcodes.php

within that file I have the following code:

<?php
add_shortcode('hw', 'hello');
function hello() {
return 'Click Here For More Info';
}

Now when I put [hw] in href="http://www.website.com">[hw] it does work on my local wp install, however, when I do the same on my live server, it doesn't work, no matter what I do. It returns [hw] instead of 'Click Here For More Info'. Any ideas why? Thanks!

1

1 Answers

0
votes

Maybe problems with php interpreter on server side.

Check if your server side doing include right.

Below and above your shortcode function place echo with something, and if it will echoes on your site, then we need to dig deeper.

And if it will not echoes, than the problem is in include function.