0

I have this php code that is in one of my page templates events-template.php I want to show it in on my homepage but have been unsuccessful. Any ideas on how this can be implemented. Thanks!

<?php 
JAMSESSION_SWP_put_the_title("div", get_the_title(), "post_title", "");

while (have_posts()) 
{
    the_post();

    $args = array(
        'numberposts'   => 100,
        'posts_per_page'   => 100,
        'offset'           => 0,
        'category'         => '',
        'orderby'          => array('event_date' => 'DESC', 'event_time' => 'DESC'),
        'include'          => '',
        'exclude'          => '',
        'meta_key'         => 'event_date',
        'meta_value'       => '',
        'post_type'        => 'js_events',
        'post_mime_type'   => '',
        'post_parent'      => '',
        'post_status'      => 'publish',
        'meta_query' => array(
            'relation' => 'AND',
            'event_date' => array(
               'key' => 'event_date'
            ),
            'event_time' => array(
               'key' => 'event_time'
            )               
        ),          
        'suppress_filters' => true
    );

    $myposts = get_posts( $args);

    echo '<div id="postmeta_custom">';
    echo ' <span class="post_cat">';  JAMSESSION_SWP_list_custom_terms_with_links('event_category', '', 'all'); echo "</span>";
    echo '</div>';

    /*events_content using $myposts var*/
    if ('masonry' == JAMSESSION_SWP_get_events_view()) {
        require_once(get_template_directory().'/views/events_content_masonry.php');
    } else {
        require_once(get_template_directory().'/views/events_content_list.php');
    }
}
?>
2

1 Answer 1

0

What have you tried so far? Looking at the WordPress template hierarchy, a WordPress homepage could be using either front-page.php or home.php.

Sign up to request clarification or add additional context in comments.

2 Comments

So I'm trying to add it to my page text editor with a shortcode, don't really want to add it directly to my front-page.php etc. because I wont be able to position it in the spot I would like it to show.
You probably want to read up on creating custom shortcodes then codex.wordpress.org/Shortcode_API

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.