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

Notifications Bar on home page only

Using the very example from the Codex in the Settings API section. Put it in the theme’s functions.php: add_action(‘admin_init’, ‘eg_settings_api_init’); function eg_settings_api_init() { add_settings_section( ‘eg_setting_section’, ‘Example settings section in reading’, ‘eg_setting_section_callback_function’, ‘reading’ ); add_settings_field( ‘eg_setting_name’, ‘Example setting Name’, ‘eg_setting_callback_function’, ‘reading’, ‘eg_setting_section’ ); register_setting(‘reading’,’eg_setting_name’); } function eg_setting_section_callback_function() { echo ‘<p>Intro text for our settings section</p>’; } … 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