How to return HTML code in PHP?

2 replies
I am using x-theme for my website Gizmoids
I want to remove excerpt content from my homepage and in its place I want to add some icons and links. But I don't know how to do this?

This is the function code I found in themes function file

Code:
if ( ! function_exists( 'x_excerpt_string' ) ) :
  function x_excerpt_string( $more ) {
    
    $stack = x_get_stack();

    if ( $stack == 'integrity' ) {
      return ' ... <div><a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a></div>';
    } else if ( $stack == 'renew' ) {
      return ' ... <a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a>';
    } else if ( $stack == 'icon' ) {
      return ' ...';
    } else if ( $stack == 'ethos' ) {

      return '...';
    }

  }
  add_filter( 'excerpt_more', 'x_excerpt_string' );
endif;
When I remove excerpt by using theme option it shows '...' in the place of content. But I want to add facebook or twitter icons in its place...
Can anyone please tell me how to do this?
#code #html #php #return
  • Profile picture of the author dreucifer
    Well it depends on which x-theme variant you are using: integrity, renew, icon, or ethos. Once you know that just put the html in the return statement that matches the variant, i.e:

    Code:
    if (  == 'integrity' ) {
          return ' HTML for Integrity variant goes here';
        } else if (  == 'renew' ) {
          return ' HTML for Renew variant goes here';
        } else if (  == 'icon' ) {
          return '  HTML for Icon variant goes here';
        } else if (  == 'ethos' ) {
          return ' HTML for Ethos variant goes here';
        }
    {{ DiscussionBoard.errors[9830559].message }}
  • Profile picture of the author sahariaremon
    I thing it is a very easy return to HTML code PHP.I give a example in below:


    So I asked a similar question earlier and I'm only more confused now, so I'll ask it in a different way...
    What I'm trying to do is abstract my php and put the bits of html, used in my validator as error messages, into functions that return the html to the spot where they are needed in the page.
    What I have right now is:
    code:
    section> <?php if($errMsg) { errMsg(); } ?> </section> <?php function errMsg() { ?> <section> <p>O crap! There was an error</p> </section> <?php } ?>
    {{ DiscussionBoard.errors[9843492].message }}

Trending Topics