Replace & with &

It looks like the function returning an url, And is always good practice to use esc_url(); wordpress function to escape all characters including the – & into & before displaying. Example usage – return esc_url( $incomingLink );

Retrieving next_post_link() and previous_post_link() in functions.php

<?php function get_all_images($post_id=0, $size=”poster”, $attributes=””) { global $post; setup_postdata($post); $post_id = $_POST[‘post_id’]; if ($post_id<1) $postid = get_the_ID(); $post = get_post($post_id); $get_content = $post -> post_content; $content = apply_filters(‘the_content’, $get_content); $content = str_replace(‘]]>’, ‘]]&gt;’, $content); $title = get_the_title($post); $previous_post = get_previous_post(); $next_post = get_next_post(); $previous_link_url = get_permalink(get_previous_post(false,”,true)); $next_link_url = get_permalink(get_next_post(false,”,false)); if (!empty( $previous_post )) $previous_link = … Read more

Directing to functions.php the correct way

If you ‘have’ to do it this way, you should add the following line to the top of your above your include functions line: require(‘/path/to/yourdomain.com/httpdocs/wp-blog-header.php’); global $wpdb; // In case you need DB calls also @milo is correct though and you should think of a better way of doing this… Alternatively, you could look at … Read more

Explode Array from Repeatable Custom Field

This is more of a PHP question than a WordPress question. Try to replace $temp = explode( “|”, $am ); with $temp = explode( “|”, $am[0] ); since $am is an array. You should also consider using isset() to check if the array items exists. Here is one idea: <?php $affman = get_post_meta( $post->ID, ‘affiliatemanager’, … Read more

Custom Post Type Search

Modify the searchform.php, or create one in a child theme (recommended), and you should be able to modify the form all you want. The default HTML is in /wp-includes/general-template.php, to which I have already linked, but don’t edit that. It is a Core file. Copy the markup into your searchform.php if you need a place … Read more

Sessions in word press [duplicate]

Note, Session must start before header is sent. So you should try – <?php if( !session_id() ){ if( headers_sent() ){ die(‘headers already sent, cant start session’); } else{ session_start(); } } // check existence, or not below 1 if( !isset($_SESSION[‘impression’]) || $_SESSION[‘impression’] < 1 ){ $_SESSION[‘impression’] = 100; } // decrease the value by one … Read more

reusing code in function and running it with loop

You would need to set up the function like this in your functions.php function my_function(){ //your function in here include(TEMPLATEPATH . ‘[variable][1].php’); } And then in your loop you would call it like so: $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 4, ); $featured_query = new WP_Query($args); if ($featured_query->have_posts()) { while ($featured_query->have_posts()) { $featured_query->the_post(); … Read more