Permalink doesn’t get displayed in Twitter button (Local WordPress problem?)

After sleeping over the problem I decided to the code and tried this:

<a href="https://twitter.com/share?url=&text=<?php the_title(); ?>: <?php echo urlencode(get_permalink($post->ID)); ?> &via=username&count=horizontal" class="custom-tweet-button">Tweet</a>

All I can say is: it works as it should be. Next thing on my agenda is to incorporate a custom url shortener.

PS: It’s worth a mention that if you use certain themes, they might use a special %permalink% and %post-title% structure. Be sure to replace the default <?php the_title(); ?> and <?php the_permalink(); ?> with it.