Viewing 21 posts - 1 through 21 (of 21 total)
  • Author
    Posts
  • #1003161

    Hello all,

    Long time no see, hope everyone is well?

    Background of problem.

    I’m creating a Team page but don’t like the look of the “Team Member” element. I also want some extra functionality so I’m using the “Blog Posts” element to display the a Custom Post Type called “staff”. All works fine and the look and style is in keeping with the rest of the site. Happy days.

    The next step is to remover the meta info and add in some nice social media icons and links. his first achieved by using the following css.

    .slide-meta .slide-meta-comments, .page-id-26616 .slide-meta .slide-meta-time {display:none;}
    .slide-meta .slide-meta-del {overflow:visible!important;text-indent:0!important;border:none!important;font-size:0!important;}
    .slide-meta .slide-meta-del:before {font-family: 'entypo-fontello'!important;font-size: 35px;color: #435664;content: " \e8fd"; visibility: visible;}

    This removed the comment count, the separator and the date. It also added in a linkedin icon.

    Capture1

    The question is how to add a link to it. I know you can’t use html in a pseudo class as they don’t appear in the DOM.
    Has someone else ever requested something similar or does anyone have some code laying around that will do the job? Or is there an easier way before I start javascripting?

    I could use separate elements to create the same look but then I lose functionality so that’s not an option. The “blog post” element means I can make use of the category link, excerpt and only have to add anew item to the CPT for it to appear everywhere.

    This seems like the only solution to keep the functionality and look. Can’t post a link to page as currently site lives on internal server.

    Many thanks

    TJ

    #1003175

    Don’t know why I didn’t think of this before…. I could use a Custom Field.
    How would I get the info in the Custom Field to replace the meta info in the Blog Post element on a specific page?

    I’ll have a play about but if someone comes up with an answer please post it :()

    Thanks

    TJ

    #1003750

    Hi,

    You would need to modify the template and load it from the child theme.
    IT does require to hire someone so you can get somewhere with that work…

    Best regards,
    Basilis

    #1004068

    Hi,
    Which php template is responsible for the blog post element? More specifically where is the php loop that controls the meta info? Currently it looks for post count and date of a post. I can tweak that to show a Custom field instead once I know where it is.

    Thanks

    TJ

    EDIT.

    I have found that loop-index.php can be tweaked to replace meta info on a single post page.
    Still can’t find which php file outputs the blog post element.

    • This reply was modified 6 years, 3 months ago by tjswarbs78.
    #1004452

    Hi,
    Sorry for the late reply, I believe you are looking for:
    \enfold\config-templatebuilder\avia-shortcodes\blog\blog.php

    Best regards,
    Mike

    #1005668

    Hi Mike.

    Does that create the look on the live page or just the look and function of the element on the AviaBuilder canvas?

    For example in the loop-index.php you can change the code

    echo $title;
    				
                    echo "<span class='post-meta-infos'>";
                    
                    echo "<time class='date-container minor-meta updated' >".get_the_time(get_option('date_format'))."</time>";
                    echo "<span class='text-sep text-sep-date'>/</span>";
    
                        if ( get_comments_number() != "0" || comments_open() ){
    
                        echo "<span class='comment-container minor-meta'>";
                        comments_popup_link(  "0 ".__('Comments','avia_framework'),
                                              "1 ".__('Comment' ,'avia_framework'),
                                              "% ".__('Comments','avia_framework'),'comments-link',
                                              "".__('Comments Disabled','avia_framework'));
                        echo "</span>";
                        echo "<span class='text-sep text-sep-comment'>/</span>";
                        }

    to remove or add things to the meta info. That only seems to work on the single post page though. I can’t find anything similar in the blog.php mentioned.

    Thanks

    TJ

    #1005789

    Hi,

    Why not use CSS to hide it, why that not works?

    Best regards,
    Basilis

    #1005967

    Hi,

    I’m currently using css to hide the meta info (see first post).
    What I then want to do is add in some info from a custom field, hence wanting to get at the php.

    I’m using the blog post element, rather than the team member section as I prefer the functionality. In the backend staff is a custom post type that the blog post element then pulls to the live page and displays in the grid layout. I have added a custom field to each “staff” which I then want to display in place of the meta info.

    Thanks

    TJ

    #1006131

    Hi,

    The blog grid layout uses the avia post slider class to display the posts. If you want to customize the meta data output please copy the enfold/config-templatebuilder/avia-shortcodes/postslider.php to your child theme folder and modify the meta data code starting at line 532

    
    if($show_meta)
    

    Best regards,
    Dude

    #1006136

    Boom!! Exactly what I needed :)

    Thanks

    TJ

    (can be closed)

    #1006325

    Hi,

    Glad we could help!

    Please take a moment to review our theme and show your support https://themeforest.net/downloads
    Don’t forget to bookmark Enfold Documentation for future reference.

    Thank you for using Enfold :)

    Best regards,
    Basilis

    #1116039

    Hi all,

    I’ve only just got back to this after 7 months and I need some help.

    I know from Dude’s reply I’m in the right place and I’ve found the code that I need to tweak. This has been confirmed by sticking some text in there that does show in blog grid meta.

    Code to tweak

    if($show_meta && !empty($excerpt))
    					{
    						$meta  = "<div class='slide-meta'>";
    						if ( $commentCount != "0" || comments_open($the_id) && $entry->post_type != 'portfolio')
    						{
    							$link_add = $commentCount === "0" ? "#respond" : "#comments";
    							$text_add = $commentCount === "1" ? __('Comment', 'avia_framework' ) : __('Comments', 'avia_framework' );
    							$meta .= "<div class='slide-meta-comments'><a href='{$link}{$link_add}'>{$commentCount} {$text_add}</a><p>TEST</p></div><div class='slide-meta-del'>/</div>";
    						}
                            $markup = avia_markup_helper(array('context' => 'entry_time','echo'=>false, 'id'=>$the_id, 'custom_markup'=>$custom_markup));
    						$meta .= "<time class='slide-meta-time updated' $markup>" .get_the_time(get_option('date_format'), $the_id)."</time>";
    						$meta .= "</div>";
    						
    						if( strpos($blogstyle, 'elegant-blog') === false )
    						{
    							$output .= $meta;
    							$meta = "";
    						}

    Result

    Capture4587

    Nice one, stage one complete.

    Stage two is to get the custom field data to show where TEST is and this is where I’m coming unstuck.
    No matter which code I use the custom field data doens’t show. I’ve tried various formats of the code and none work.
    See examples below….

      if($show_meta && !empty($excerpt))
    					{
    						$meta  = "<div class='slide-meta'>";
    						if ( $commentCount != "0" || comments_open($the_id) && $entry->post_type != 'portfolio')
    						{
    							$link_add = $commentCount === "0" ? "#respond" : "#comments";
    							$text_add = $commentCount === "1" ? __('Comment', 'avia_framework' ) : __('Comments', 'avia_framework' );
    							$cptlink = get_post_meta( get_the_ID(), 'linkedinurl', true);
    							$meta .= "<div class='slide-meta-comments'><a href='{$link}{$link_add}'>{$commentCount} {$text_add} {$cptlink}</a></div><div class='slide-meta-del'>/</div>";
    						}
     if($show_meta && !empty($excerpt))
    					{
    						$meta  = "<div class='slide-meta'>";
    						if ( $commentCount != "0" || comments_open($the_id) && $entry->post_type != 'portfolio')
    						{
    							$link_add = $commentCount === "0" ? "#respond" : "#comments";
    							$text_add = $commentCount === "1" ? __('Comment', 'avia_framework' ) : __('Comments', 'avia_framework' );
    							$cptlink = get_post_meta($post->ID, 'linkedinurl', true);
    							$meta .= "<div class='slide-meta-comments'><a href='{$link}{$link_add}'>{$commentCount} {$text_add} {$cptlink}</a></div><div class='slide-meta-del'>/</div>";
    						}
     if($show_meta && !empty($excerpt))
    					{
    						$meta  = "<div class='slide-meta'>";
    						if ( $commentCount != "0" || comments_open($the_id) && $entry->post_type != 'portfolio')
    						{
    							$link_add = $commentCount === "0" ? "#respond" : "#comments";
    							$text_add = $commentCount === "1" ? __('Comment', 'avia_framework' ) : __('Comments', 'avia_framework' );
    							$meta .= "<div class='slide-meta-comments'><a href='{$link}{$link_add}'>{$commentCount} {$text_add} </a><?php echo get_post_meta($post->ID, 'linkedinurl', true); ?></div><div class='slide-meta-del'>/</div>";
    						}

    So the question is how can I get data from the custom field called ‘linkedinurl’ to show?
    The custom field is on a custom post type does that matter? A little help pointing me in the right direction would be super :)

    Thanks

    Tim

    #1117072

    Hi,

    That section will only display if the meta info is enabled and if the post has an excerpt. Do the posts have excerpts or content?

    Have you tried replacing $post->ID with $the_id? They are the same but it’s worth a try.

    Best regards,
    Ismael

    #1117806

    Hi,

    The post has both an excerpt and content, I just removed it for the purpose of the image. I can change the code and get some plain text showing but any php changes just echo the code to the page rather than pulling the customer field info. I’ll try $the_id and see what happens with that.

    The info is against a customer post type called staff rather than a standard post / page does that matter?

    Thanks

    TJ

    #1118007

    Hi,

    The post has both an excerpt and content, I just removed it for the purpose of the image.

    What do you mean by that? How did you remove the text or the content? Again, the meta info will only display if the excerpt exists.

    Best regards,
    Ismael

    #1118124

    I photoshopped it out so no one on here could read it. The issue isn’t because of the excerpt or content. I know what i want is possible because like i said i can get plain text to appear where i want. The problem is if i paste various pieces of code the out put breaks, so I must not be using the correct code.

    To add a CF in standard wordpress theme you use
    <?php echo get_post_meta($post->ID, 'Mood', true); ?>

    Pasting that into the postslider.php just returns errors

    Notice: Undefined variable: post in /config-templatebuilder/avia-shortcodes/postslider.php on line 575

    Notice: Trying to get property of non-object in config-templatebuilder/avia-shortcodes/postslider.php on line 575

    I’m not sure how to translate that first bit of code so it outputs the CF.

    Thanks

    TJ

    #1118645

    Hi,

    Thanks for the update.

    You don’t have to add the echo function because you’re supposed to concatenate the value of the field to the $meta string or text.

    
    $linkedin = get_post_meta($post->ID, 'linkedinurl', true);
    $meta .= "<div class='slide-meta-comments'><a href='{$link}{$link_add}'>{$commentCount} {$text_add} </a>{$linkedin}</div><div class='slide-meta-del'>/</div>";
    

    Best regards,
    Ismael

    #1118726

    Hi Ismael,

    That’s the same code i originally tried but didn’t work…

    $cptlink = get_post_meta($post->ID, 'linkedinurl', true);
    $meta .= "<div class='slide-meta-comments'><a href='{$link}{$link_add}'>{$commentCount} {$text_add} {$cptlink}</a></div><div class='slide-meta-del'>/</div>";

    The code you supplied does work but they look identical to me! The CF pulls through correctly.
    As always you’ve done first class support. 5 stars mate

    Thanks

    TJ

    #1118845

    Hi,

    Did you need additional help or shall we close this topic?

    Best regards,
    Jordan Shannon

    #1144983

    Hi,

    One more quesion and then it can be closed.

    Can /config-templatebuilder/avia-shortcodes/postslider.php be placed inside the child theme rather than editing the main theme file?

    Thanks

    Tim

    #1145016

    Hi,

    Yes. You just have to recreate the path within the child theme.

    Best regards,
    Jordan Shannon

Viewing 21 posts - 1 through 21 (of 21 total)
  • You must be logged in to reply to this topic.