Wordpress Post Content Get Url - wordpress

quick question I know in wordpress you can get post_content,etc
but let say I input into the content just a url such http://www.google.com and then
i want to get that url inside a div so it would look like something along those lines. do I have to do anything special with the url or can i simply just do get post_content.
My end goal is to incorporate the url in a colorbox so it will just grab the url from the post content and use it with the colorbox??
hope that made some sense...
thank you
-david

You do not have to do anything special in terms of preparing your post on the admin side, but to incorporate this into the Colorbox code, make sure you are putting the 'post_content' in the right place. In the 'Outside HTML (IFrame)' example from the Colorbox site:
http://colorpowered.com/colorbox/core/example1/index.html
You could implement your code as follows:
<?php your wordpress query here?>
<a class="colorboxClass" href="<?php the_content(); ?>">Your Colorbox Link Text</a>
<?php end your query?>

Related

Add shortcode inside another with echo

I try to nest a shortcode to another in my page. Why this isnt working?
[toggle]
<?php echo do_shortcode('[Best_Wordpress_Gallery id="1" gal_title="my"]'); ?>
[/toggle]
There's not enough information in your code sample to say for sure. However, it looks like you are attempting to put PHP code into an actual WordPress page/post. Is that the case? If not, please provide more info on what you're trying to do exactly.
If so, you can't put PHP inside post/page content in WordPress without enabling the ability to do so. The easiest way to do this is with a plugin. There are several in the Plugin Directory: https://wordpress.org/plugins/search.php?q=php+code.
Also, see this answer for a similar question: https://stackoverflow.com/a/18896308/3147332

Search results not showing full post, only excerpt (Wordpress)

this is my first time posting on this site so apologies if the question isn't totally appropriate but I'm building a portfolio site for my brother who is a composer and he needs his music library to be able to be checkbox filter-able. The problem is that when I conduct a search with filters, the results show only the excerpt, and not the audio player like I need.
Library page displaying the full posts with audio player
Search results page showing just the post title and nothing else
Also, excuse the sheer crudeness of the site. I just started it this morning... Thanks in advance!
To show the full content you have to use the_content function, in your search.php file replace the following
<?php the_excerpt(); // partial content ?>
with
<?php the_content(); // full content ?>
Also remember. the_excerpt function strips out all HTML tags so it could be a problem, you can read this article.

Why Facebook like and send button is not getting the correct url - Wordpress

in my website http://youmark.it/ I have in the home page post and in all other single post pages the same number of like, also the send button once you click is showing the Facebook Page url and not the Post url.
I have integrated all stuff for open graph, if you look at the source code it seems to be ok but still doesn't work after few changes I did. Also in the Facebook Debug tool everything shows correct.
Does Facebook need time to get updated or am I doing something wrong?
You have all your like buttons “pointing” to the base URL of your website.
If you want them to like the individual article, then include the URL to that article in the href parameter of the <fb:like> tag.
Try to like this url: <?php the_permalink() ?> instead?
<iframe src="//www.facebook.com/plugins/like.php?href=<?php the_permalink() ?>&send=...
???

Permalink-safe way to link pages inside footer.php

I am currently building a new theme for my site and am kind of stuck not knowing the proper way to link pages together. What is the proper way to direct visitor to another page if I were to write the link straight into footer.php?
Let's consider the following inside footer.php:
?>
A Link
<?php
That would work well up until I were to change my permalink structure to something else.
What is the proper way to do it(without using WP built in menus or anything similar)?
You can use get_permalink assuming your pages are in Wordpress.
See this link: http://codex.wordpress.org/Function_Reference/get_permalink
The above answer is 100% correct, but to save people some time when they stumble upon this question, I took the liberty of writing it out.
<?php echo get_the_title(12); ?>
This covers everything from hover text to dynamic page title, so if you decide to change "Contact" to "Contact Us," you won't have to remember to update the footer.php file.

How to add search box to drupal page contents (404 page)

I have a theme where search box is hard to find.
Before redesigning it, I'd like to add another, bigger search box to 404 page.
The only solution I found is render search block:
<?php
$block = module_invoke('search', 'block_view', 97);
print render($block['content']);
?>
This is not good solution because one have to find block number first.
How to use search_box() function properly?
Maybe you'd want to try using http://drupal.org/project/search404? I'm not sure if you can disable automatic searching on a 404 page but it's very close to what you are needing without custom code.

Resources