Tagged: child theme, image overlay, remove date
-
AuthorPosts
-
September 3, 2014 at 3:14 am #312591
I am trying to eliminate the reference to post date that shows up when using the multi-author blog page in Enfold. I turned off the date easily for the single post using the theme options – but all of the support information I can find about removing this seems to indicate that I should be changing the postslider.php file in the parent theme directly.
I am very new to this theme, but have always been told to never, ever make changes like this in the parent theme files or I will lose them every time there is an update. In fact, I have seen others asking the same about using a child theme – but I don’t really understand the answers I am seeing.What I am seeing when I do “inspect element” is in the attached image. Could someone please help me with 2 things:
1. Exactly what needs to be changed to remove any reference to the post date and exactly where to make that change.
2. What is the standard procedure for using a child theme with Enfold? I get that somehow it is called differently than other themes? My experience to date has been that I only need to add the changed code to my functions.php file; but I think I am understanding that is not always the case with Enfold? Is that correct?Thank you for your assistance. I have spent a great deal of time looking at your many videos and reading the forums and have simply not been able to figure this out myself.
September 3, 2014 at 3:30 am #312593Hi siestajoye!
Enfold is just like any other WordPress theme and using a child theme. To replace an element from the layout builder in a child theme however you need to use a function to tell the theme you are doing that.
Cheers!
DevinSeptember 3, 2014 at 3:40 am #312599Thanks for your prompt and understandable reply. Done.
Now, could you please help me with the “what I change” part? Does the image I attached explain clearly what I am trying to rid myself of?
ThanksSeptember 3, 2014 at 3:44 am #312604You would copy the file to your child theme’s shortcode folder and then open it up, search for the slide-meta and delete that div.
September 3, 2014 at 3:52 am #312606Sorry to be so dense. Are you saying that I should have a folder structure in my enfold-child theme folder that looks like this?
enfold-child
config-templatebuilder
avia-shortcodes
postslider.phpSeptember 3, 2014 at 3:54 am #312608Here is an example: https://github.com/DevinVinson/enfold-child-docs
That is the same child theme I used on the documentation site and I’ve edited the magazine element to use the last updated date instead of the published date.
You could also clone or fork this child theme where I have things set up already: https://github.com/DevinVinson/enfold-child-starter
September 3, 2014 at 4:05 am #312611This reply has been marked as private.September 3, 2014 at 2:11 pm #312866The function you add to your child theme functions.php file tells the theme where to look to find replacement theme files. Without editing it, the function points to the shortcodes folder: https://github.com/DevinVinson/enfold-child-starter/blob/master/functions.php#L27
If you don’t want the slide meta to show at all you would delete the entire div. This isn’t a theme usage issue at this point as you are customizing php files. We don’t typically break down this kind of thing into step by step directions because of how many variables there are in what anyone could be or want to do and that its very easy to make a mistake when you are editing a file.
With php if you are missing a single ; or . it can cause the whole site to whitescreen. Even editing the file without a plain text editor could cause issues.
For you, you want to remove the whole meta block output I think so:
$output .= "<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' ); $output .= "<div class='slide-meta-comments'><a href='{$link}{$link_add}'>{$commentCount} {$text_add}</a></div><div class='slide-meta-del'>/</div>"; } $markup = avia_markup_helper(array('context' => 'entry_time','echo'=>false, 'id'=>$the_id, 'custom_markup'=>$custom_markup)); $output .= "<time class='slide-meta-time updated' $markup>" .get_the_time(get_option('date_format'), $the_id)."</time>"; $output .= "</div>";
If not then you would be deleting the specific bit inside of there that you want to remove.
September 3, 2014 at 5:00 pm #313001Yes! Not only did it work, I learned something. I understand the component in the functions.php now and I eliminated all of the content I didn’t want to appear. I read the w3schools php syntax info, compared it with your reply and it worked!
Thank you for the detailed information. Now, off to my next learning experience!
Thank you again.September 3, 2014 at 10:49 pm #313112OK, now I want to use the masonry content element and the image overlay effect. It shows the post date. Based on the information you provided before – could you tell me if this is the correct way to modify the display?
Copy of the masonry_entries.php into the shortcodes folder of my child theme.
In this section of the code:$overlay_img = $custom_url = false; $img_size = 'masonry'; $author = apply_filters('avf_author_name', get_the_author_meta('display_name', $entry->post_author), $entry->post_author); $this->loop[$key]['text_before'] = ""; $this->loop[$key]['text_after'] = ""; $this->loop[$key]['ID'] = $id = $entry->ID; $this->loop[$key]['post_type'] = $entry->post_type; $this->loop[$key]['thumb_ID'] = get_post_thumbnail_id($id); $this->loop[$key]['the_title'] = get_the_title($id); $this->loop[$key]['url'] = get_permalink($id); $this->loop[$key]['date'] = "<span class='av-masonry-date meta-color updated'>".get_the_time($date_format, $id)."</span>"; $this->loop[$key]['author'] = "<span class='av-masonry-author meta-color vcard author'><span class='fn'>". __('by','avia_framework') .' '. $author."</span></span>"; $this->loop[$key]['class'] = get_post_class("av-masonry-entry isotope-item", $id); $this->loop[$key]['content'] = $entry->post_excerpt; $this->loop[$key]['description'] = !empty($entry->post_content) ? $entry->post_content : $entry->post_excerpt; if(empty($this->loop[$key]['content']))
Can I take this:
$this->loop[$key]['date'] = "<span class='av-masonry-date meta-color updated'>".get_the_time($date_format, $id)."</span>";
and change it to this:
$this->loop[$key]['date'] = " ";
I’m hoping this works, because if it does – perhaps I understand what you explained before. A big problem for me is finding out which php file is being used. I looked at inspect element, but just ended up doing a search inside of the various masonry files until I found “masonry-date”.
Thank you again for all of the excellent assistance which is above and beyond what I would expect.
September 3, 2014 at 10:58 pm #313120This reply has been marked as private.September 4, 2014 at 11:08 pm #313642Glad you were able to get things figured out :)
-
AuthorPosts
- The topic ‘If editing postslider.php file do I put a copy in child theme?’ is closed to new replies.