Home Forums Front-end Issues Insert custom field into title ?


Insert custom field into title ?

  • Hi.

    At the moment we are displaying our articles somewhat like this
    “post title” :: “Custom field event date”, “Custom field location”

    In our loop template that looks like this:

    <div class="post-title"><?php echo $td_mod_single->get_title();?><h1 class="entry-title"><?php if (empty(get_field('datum')) === false): ?><span class='datum'> <?php echo the_field('datum'); ?></span><?php endif; ?></span><?php if (empty(get_field('concertlocatie')) === false): ?><span class='location'> <?php echo the_field('concertlocatie'); ?></span><?php endif; ?></span></h1></div>

    However, this poses an unexpected issue for us.

    If one were to seach for the event location, the articles don’t show up since the date and event locations are standard not searched with the wordpress search engine. (only title and content). Using the plugin relevanssi resolves that issue, but sadly our database is so vast, the sql database explodes in size, taking up so much space it is simply not an option for us.

    Is it possible in any way to “inject” or add the custom fields into the “get_title”, so that it does get picked up by the wp search engine ?

  • There are some great search plugins that you can install that index your custom fields and other data in your post.

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

The topic ‘Insert custom field into title ?’ is closed to new replies.