Portfolio - Custom Field Functionality (click to call/email)

Hello,

I have the following item in a portfolio page:
http://ashburton.strongerbranch.com/business/ashburton-meats/

As the numbers referenced in this image:

  1. Is it possible to remove this author identifier?

  2. Is it possible to make this phone number clickable (call-able) from a mobile/cellular phone?

  3. Is it possible to make this url clickable?

  4. Is it possible to remove the line breaks between each displayed custom field?

Below is my content-porfolio.php file from my x-child theme:

<?php

// =============================================================================
// VIEWS/INTEGRITY/CONTENT-PORTFOLIO.PHP
// -----------------------------------------------------------------------------
// Portfolio post output for Integrity.
// =============================================================================

$archive_share = x_get_option( 'x_integrity_portfolio_archive_post_sharing_enable' );

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  <div class="entry-featured">
    <?php x_portfolio_item_featured_content(); ?>
  </div>
  <div class="entry-wrap cf">

    <?php if ( x_is_portfolio_item() ) : ?>

      <div class="entry-info">
        <header class="entry-header">
          <h1 class="entry-title entry-title-portfolio"><?php the_title(); ?></h1>
          <?php x_integrity_entry_meta(); ?>
	  <!-- Add Your Custom Fields here which will show on separate portfolio items -->
	  <p></p>
	  <p><b>Address:</b> <?php the_field('address'); ?><p>
	  <p><b>Phone:</b> <?php the_field('phone_number'); ?></p>
	  <p><b>Website: </b> <?php the_field('website'); ?></p>
        </header>
        <?php x_get_view( 'global', '_content', 'the-content' ); ?>
      </div>
      <div class="entry-extra">
        <?php x_portfolio_item_tags(); ?>
        <?php x_portfolio_item_project_link(); ?>
        <?php x_portfolio_item_social(); ?>
      </div>

    <?php else : ?>

      <header class="entry-header">
        <h2 class="entry-title entry-title-portfolio">
          <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php x_the_alternate_title(); ?></a>
        </h2>
        <?php if ( $archive_share == '1' ) : ?>
          <?php x_portfolio_item_social(); ?>
        <?php endif; ?>
	<!-- Add Your Custom Fields here which will show on the root portfolio page -->
      </header>

    <?php endif; ?>

  </div>
</article>

Hi @dozingquinn,

Thank you for writing in, 1) please navigate to Theme Options > Portfolio and turn Off the Post Meta



  1. Please update that line to this:
<p><b>Phone:</b> <a href="tel:98858118">(03) 9885 8118</a></p>

More information about telephone links here.

  1. Same thing with the #2, but without the tel: protocol.
<p><b>Website: </b> <a href="http://www.ashburtonmeats.com.au" target="_blank">http://www.ashburtonmeats.com.au</a></p>
  1. I am sorry, I am not entirely certain what do you mean custom field, please clarify.

Thanks,

Thanks for your help.

For 2 & 3, given the phone number and website are custom fields, I think they need to be edited in the .php file, rather than via front end html code. The relevant lines of the .php code are:

  <p><b>Phone:</b> <?php the_field('phone_number'); ?></p>
  <p><b>Website: </b> <?php the_field('website'); ?></p>

How would I edit these to the required functionality?

  1. I’m referring to the carriage returns between the custom field lines. So rather than:

Line 1

Line 2

How do I make it:
Line1
Line2

By editing the .php file.

Thanks again.

Hi @dozingquinn,

Sorry for the confusion, you just have to edit the existing template content-portfolio.php as above. And change this part

          <p></p>
	  <p><b>Address:</b> <?php the_field('address'); ?><p>
	  <p><b>Phone:</b> <?php the_field('phone_number'); ?></p>
	  <p><b>Website: </b> <?php the_field('website'); ?></p>

to this

         <p></p>
	  <p><b>Address:</b> <?php the_field('address'); ?><br>
	  <b>Phone:</b> <a href="tel:<?php the_field('phone_number'); ?>"><?php the_field('phone_number'); ?></a><br>
	  <b>Website: </b> <a href="<?php the_field('website'); ?>" target="_blank"><?php the_field('website'); ?></a></p>

Hope this helps.

1 Like

This is perfect. Thanks.

You are most welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.