Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #263277

    Bayonle
    Participant

    Ok so i thought it is meant to be straightforward, but it doesnt seem to be so. I want social sharing buttons on all of my post pages i.e when a user clicks a link to a post, there should be sharing buttons on each post page. I’ve searched and searched around for this. Also, My sidebar is showing a brown background with 50×50 written all over it, i want just a white background. Kindly help please

    #263481

    Prasant Rai
    Moderator

    Hello There,

    Implementing social sharing in blog posts will requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released.

    After that kindly add the code bellow in your functions.php.

    add_action('x_before_the_content_end', function() {
      echo do_shortcode('[share title="Share this Post" facebook="true" twitter="true" google_plus="true" linkedin="true" pinterest="true" reddit="true" email="true"]');
    });

    You can modify the Entry Share shortcode inside the do_shortcode function. See http://theme.co/x/demo/integrity/1/shortcodes/entry-share/ for sample setups.

    To remove the 50×50 background image. Go to Appearance > Customize > Layout and Design > BACKGROUND OPTIONS > Background Pattern and choose a new one. It will replace the 50×50 then press remove and it will remove your current and demo background image.

    Hope that helps and kindly Let us know how this goes!

    Thanks.

    #263699

    Bayonle
    Participant

    I setup the child theme by following the video tutorial in the link provided and added the code you wrote into the functions.php of the X-child. the only problem is that i hit save and then a blank page was just displaying. I checked my hosting control panel and used the editor there to edit the functions.php file and i found that the change was actually committed. However i went back to my site and then white page, nothing was displaying. Normally i set up an under construction page which used to show before but now nothing shows at all. before activating the child theme i made sure that i had exported the customizer settings and i imported them back after i activated the child theme. so what could i have done wrong.

    #263704

    Christopher
    Moderator

    Hi there,

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    #263705

    Bayonle
    Participant
    This reply has been marked as private.
    #263712

    Christopher
    Moderator

    HI there,

    I removed the code from functions.php and you site works fine now.

    To add share buttons try this:

    Copy content.php file from framework -> views -> ethos and put it in the same path inside child theme, Now replace existing code with this:

    <?php
    
    // =============================================================================
    // VIEWS/ETHOS/CONTENT.PHP
    // -----------------------------------------------------------------------------
    // Standard post output for Ethos.
    // =============================================================================
    
    $is_index_featured_layout = get_post_meta( get_the_ID(), '_x_ethos_index_featured_post_layout',  true ) == 'on' && ! is_single();
    
    ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
      <?php if ( $is_index_featured_layout ) : ?>
        <?php x_ethos_featured_index(); ?>
      <?php else : ?>
        <?php if ( has_post_thumbnail() ) : ?>
          <div class="entry-featured">
            <?php if ( ! is_single() ) : ?>
              <?php x_ethos_featured_index(); ?>
            <?php else : ?>
              <?php x_featured_image(); ?>
            <?php endif; ?>
          </div>
        <?php endif; ?>
        <div class="entry-wrap">
          <?php x_get_view( 'ethos', '_content', 'post-header' ); ?>
          <?php x_get_view( 'global', '_content' ); ?>
          <?php echo do_shortcode('[share title="Share this Post" facebook="true" twitter="true" google_plus="true" linkedin="true" pinterest="true" reddit="true" email="true"]'); ?>
        </div>
      <?php endif; ?>
    </article>

    Hope it helps.

    #263715

    Bayonle
    Participant

    i tried again and everything seems alright except that anytime i edit the functions.php of the X-child theme and add the code the same thing happens all over again. screen just goes blank, nothing is showing.

    #263719

    Bayonle
    Participant

    ok so site is showing well now. where do i find framework? is this the correct path? /public_html/wp-content/themes/x/framework.

    edit:: all is well now. share buttons shows up. However it is showing up in the index page and the post page. How can i set it to show only in the post page. Also if i want to remove so share buttons that i dont have social profile for, would i have to go to that content.php page and manually remove the code?

    suggestion: i think themeco should make this easier. It should come as one of the extensions.

    #263726

    Thai
    Moderator

    Hi There,
    The /public_html/wp-content/themes/x/framework path is correct.
    The Ethos views path is: /public_html/wp-content/themes/x/framework/views/ethos/
    If you have any questions, don’t hesitate to ask.
    Regards!

    #368468

    Paul
    Participant

    I’ve got a question about this subject, I implemented the code for social shares, but I want it shown only on the single post page, but it shows on all pages. How can I achieve this?

    #368474

    Paul
    Participant

    Ah, I fixed it already, sorry for the bother!

    #368486

    Friech
    Moderator

    Glad you sorted things out, Cheers!

    #632496

    MrK
    Participant

    Hi guys, your code worked just fine for me.
    Can I add more social networks? Like github?

    #632552

    MrK
    Participant

    Also would like the social just for posts not for pages

    #632561

    Jack
    Keymaster

    Hi there @mrk,

    Thanks for writing in, additional social networks would require some customizations.

    As the original here was resolved, can you start a new topic please about modifying the shortcode and having it just for posts and we’ll be right along to assist.

    Thanks for your understanding.