Echo get_option displays as text

If you really want to execute code stored in a database, a quick google search reveals that you can use the eval() function to do just that. However, many people do say that Eval is Evil… Instead of storing the entire PHP code of an option in the database, try storing a simple boolean flag … Read more

How to store the_post_thumbnail() value in a variable

With a tiny bit of research, I’m pretty sure you could have created this yourself: $featimage = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), ‘full’ )[0]; $printable_url=”<img src=”” . $featimage . ‘”>’; echo $printable_url; Edit: Since PHP 5 is defunct, you can reference the first node in the array ([0]) directly. No need for intermediate storage of the full array.

How do I link the side images?

I took a look at your site, and are you sure you dont want to make the .wrapper clickable? boxed-layout is your whole site, so if you made that clickable the whole site would be a link. However, if I look at your question, the answer would be to use jQuery. <script> $(“.body.boxed-layout”).click(function(){ window.location = … Read more

Add a “Next Post” & “Previous Post” styled button manually to a post

This is standard WordPress functionality, contained in previous_post_link and next_post_link. You don’t need to edit functions.php. Just add to your template: <div class=”buttons”> <span class=”previous-button”><?php previous_post_link() ?></span> <span class=”next-button”><?php next_post_link() ?></span> </div> Now you can style the buttons with css. Follow the codex links for customizing options to the functions.

New to WordPress & Freelancing [closed]

Unfortunately I’ve heard that comment a couple of times: WordPress was just like Weebly and a drag and drop enthusiast for those who can’t code. Which is undoubtedly wrong. WordPress is a CMS (Content Management System). A CMS is a piece of program that (as its name suggest) manages your content for you, however the … Read more

Adding jquery using php function

Why are you not using the built-in enqueue_script function? Simply put your custom jQuery code into a file called custom.js, save it into your plugin or theme folder, then enqueue it with jQuery as a dependency: <?php function custom_scripts() { if (is_admin()){ wp_enqueue_script( ‘customjs’, get_template_directory_uri() . ‘/js/custom.js’, array(‘jquery’) ); } } add_action(‘wp_enqueue_scripts’, ‘custom_scripts’); You’ll need … Read more

Force array to be a string [closed]

There are a few ways you can make an integer a string. Here are 2 main ways to make that happen Type Cast – $values_x[] = (string) $series[0][‘data’][$i][0] Double Quote – $values_x[] “{$series[0][‘data’][$i][0]}” Also, you might want to check for null first and assign a default $values_x = !empty($values_x) ? $values_x : array(‘2010’); If you … Read more