This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • in reply to: Results not clickable #3077
    mashwebdesignmashwebdesign
    Participant

    Cheers!

    in reply to: Help #3072
    mashwebdesignmashwebdesign
    Participant

    Cheers mate, should be able to get this to work. May i quickly pick your brains.

    Okay so i understand these are preset filters that i can hook into. And that they are in a object that i can access. But where in the files are they actually declared, looped through and echo’d out.

    Out of curiosity?

    in reply to: Help #3069
    mashwebdesignmashwebdesign
    Participant

    Alright mate, starting to understand a little bit more now.

    I am trying to concatenate the custom fields onto $pageposts->content see below:

    add_filter( ‘asp_pagepost_results’, ‘asp_show_the_post_type’, 1, 1 );

    function asp_show_the_post_type( $pageposts ) {
    foreach ($pageposts as $k=>$v) {

    // Get the post categories
    $html .= ‘<div class=”further-info”>’;

    if(get_field(‘from-to-or-at’) == ‘from-to’):

    $html .= ‘<p class=”fromto”><i class=”fa fa-road”></i>From: ‘ . get_field(‘from’) . ‘ To: ‘. get_field(‘to’) .'</p>’;

    elseif(get_field(‘from-to-or-at’) == ‘at’):

    $html .= ‘<p class=”fromto”><i class=”fa fa-road”></i> AT:’ .get_field(‘at’) . ‘</p>’;

    endif;

    $html .= ‘<p class=”delay-type”><i class=”fa fa-car”></i> ‘ . get_field(‘delay_type’) . ‘</p>’;

    $countin = 0;

    foreach($incidenttype as $value):

    $countin++;

    if($countin == 1):

    $html .= ‘<p><i class=”fa fa-cogs”></i> Incident Type: ‘ . $value . ‘</p>’;

    else:

    $html .= ‘<p>’ . $value . ‘</p>’;

    endif;

    endforeach;

    $html .= ‘<p><i class=”fa fa-clock-o”></i> ‘ . get_the_time() . ‘</p>’;

    if(get_field(‘avoid’)):

    $html .= ‘<p class=”avoid-p”><i class=”fa fa-warning”></i> Avoid</p>’;

    endif;

    $html .= ‘</div>’;

    $cats = “”;

    // Modify the post title
    $pageposts[$k]->content = $pageposts[$k]->content . $html;

    }
    var_dump($pageposts);
    return $pageposts;
    }

    It works however it doesn’t get the custom fields? Any idea why it doesn’t?

    Cheers

    in reply to: Help #3068
    mashwebdesignmashwebdesign
    Participant

    Cheers mate, thought it would var_dump() it on the page. TBH the code i need to add the $pageposts is something along the lines below. I have a whole host of different custom fields that need to be brought out into the results, do you think it is possibly:

    echo ‘<div class=”further-info”>’;

    if(get_field(‘from-to-or-at’) == ‘from-to’):

    echo ‘<p class=”fromto”><i class=”fa fa-road”></i>From: ‘ . get_field(‘from’) . ‘ To: ‘. get_field(‘to’) .'</p>’;

    elseif(get_field(‘from-to-or-at’) == ‘at’):

    echo ‘<p class=”fromto”><i class=”fa fa-road”></i> AT:’ .get_field(‘at’) . ‘</p>’;

    endif;

    echo ‘<p class=”delay-type”><i class=”fa fa-car”></i> ‘ . get_field(‘delay_type’) . ‘</p>’;

    $countin = 0;

    foreach($incidenttype as $value):

    $countin++;

    if($countin == 1):

    echo ‘<p><i class=”fa fa-cogs”></i> Incident Type: ‘ . $value . ‘</p>’;

    else:

    echo ‘<p>’ . $value . ‘</p>’;

    endif;

    endforeach;

    echo ‘<p><i class=”fa fa-clock-o”></i> ‘ . get_the_time() . ‘</p>’;

    if(get_field(‘avoid’)):

    echo ‘<p class=”avoid-p”><i class=”fa fa-warning”></i> Avoid</p>’;

    endif;

    echo ‘</div>’;

    if(get_field(‘avoid’)):

    echo ‘<i class=”fa fa-warning-large fa-warning”></i>’;

    endif;

    in reply to: Help #3066
    mashwebdesignmashwebdesign
    Participant

    Hi mate,

    Cheers my php is average so may need some assistance. I have put the code you wrote, into my themes functions.php but it isn’t changing the search results at all like nothing is taking affect? Any ideas?

    add_filter( ‘asp_pagepost_results’, ‘asp_add_category_titles’, 1, 1 );

    function asp_add_category_titles( $pageposts ) {

    var_dump($pageposts);
    return $pageposts;

    }

Viewing 5 posts - 1 through 5 (of 5 total)