Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1058780

    Hello,
    I’m using the ALB for my plog posts. To display the post’s meta infos I created a file named post_meta_infos.php and loaded it into the avia-shortcodes folder. So I can use the shortcode to display meta infos and it works fine. I found the code for the post_meta_infos.php in the forums here. Unfortunately the code does not contain any commands to display the last modified date of the post entry. Therefore I need some additions for The code. I tried by myself, but couldn’t get it work for I have no real php-programming-skills. Could you help?
    Here is the code (without last modified date) I use.

    <?php
    /**
     * Comments Element
     * Adds a comment form to the page
     */
     
    // Don't load directly
    if ( !defined('ABSPATH') ) { die('-1'); }
    
    if ( !class_exists( 'avia_post_meta_info' ) )
    {
    	class avia_post_meta_info extends aviaShortcodeTemplate{
    			
    			/**
    			 * Create the config array for the shortcode button
    			 */
    			function shortcode_insert_button()
    			{
    				$this->config['name']		= __('Post Meta', 'avia_framework' );
    				$this->config['tab']		= __('Content Elements', 'avia_framework' );
    				$this->config['icon']		= AviaBuilder::$path['imagesURL']."sc-comments.png";
    				$this->config['order']		= 28;
    				$this->config['target']		= 'avia-target-insert';
    				$this->config['shortcode'] 	= 'av_post_meta';
                    $this->config['tinyMCE'] 	= array('disable' => "true");
    				$this->config['tooltip'] 	= __('Add the post meta infos', 'avia_framework' );
                    //$this->config['drag-level'] = 1;
    			}
    			
    
    			 
    			/**
    			 * Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas
    			 * Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container
    			 * Less often used: $params['data'] to add data attributes, $params['class'] to modify the className
    			 *
    			 *
    			 * @param array $params this array holds the default values for $content and $args. 
    			 * @return $params the return array usually holds an innerHtml key that holds item specific markup.
    			 */
                function editor_element($params)
                {
                    $params['innerHtml'] = "<img src='".$this->config['icon']."' title='".$this->config['name']."' />";
                    $params['innerHtml'].= "<div class='avia-element-label'>".$this->config['name']."</div>";
                    $params['content'] 	 = NULL; //remove to allow content elements
                    return $params;
                }
    			
    			/**
    			 * Frontend Shortcode Handler
    			 *
    			 * @param array $atts array of attributes
    			 * @param string $content text within enclosing form of shortcode element 
    			 * @param string $shortcodename the shortcode found, when == callback name
    			 * @return string $output returns the modified html string 
    			 */
    			function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "")
    			{
    				$the_id = get_the_ID();
    				
    				$output  = '<header class="entry-content-header">';
                    $output .= "<span class='post-meta-infos'>";
                    $markup  = avia_markup_helper(array('context' => 'entry_time','echo'=>false));
                    $output .= '<time class="date-container minor-meta updated" {$markup}>'.get_the_time(get_option('date_format'))."</time>";
                    $output .= "<span class='text-sep text-sep-date'>/</span>";
    
                        if ( get_comments_number() != "0" || comments_open() ){
    
                        $output .= "<span class='comment-container minor-meta'>";
    					ob_start();
    					comments_popup_link(  "0 ".__('Comments','avia_framework'),
                                              "1 ".__('Comment' ,'avia_framework'),
                                              "% ".__('Comments','avia_framework'),'comments-link',
                                              "".__('Comments Disabled','avia_framework'));
    										  $comment = ob_get_clean(); 
    										  $output .= $comment;
                        $output .= "</span>";
                        $output .= "<span class='text-sep text-sep-comment'>/</span>";
                        }
    
                        $taxonomies  = get_object_taxonomies(get_post_type($the_id));
                        $cats = '';
                        $excluded_taxonomies =  apply_filters('avf_exclude_taxonomies', array('post_tag','post_format'), get_post_type($the_id), $the_id);
    
                        if(!empty($taxonomies))
                        {
                            foreach($taxonomies as $taxonomy)
                            {
                                if(!in_array($taxonomy, $excluded_taxonomies))
                                {
                                    $cats .= get_the_term_list($the_id, $taxonomy, '', ', ','').' ';
                                }
                            }
                        }
    
                        if(!empty($cats))
                        {
                            $output .= '<span class="blog-categories minor-meta">'.__('in','avia_framework')." ";
                            $output .= $cats;
                            $output .= '</span><span class="text-sep text-sep-cat">/</span>';
                        }
    
                        $output .= '<span class="blog-author minor-meta">'.__('by','avia_framework')." ";
    					$markup  = avia_markup_helper(array('context' => 'author_name', 'echo'=>false));
                        $output .= '<span class="entry-author-link" $markup>';
                        $output .= '<span class="vcard author"><span class="fn">';
    					ob_start();
    					the_author_posts_link();
    					$author  = ob_get_clean(); 
                        $output .= $author;
                        $output .= '</span></span>';
                        $output .= '</span>';
                        $output .= '</span>';
                    $output .= '</span>';
    				$output .= '</header>';
    				
    				
            		return $output;
            	}		
    			
    	}
    }

    I tried this: …

     $output .= '<time class="date-container minor-meta updated" {$markup}>'.get_the_time(get_option('date_format'))."</time>";
                    $output .= "<span class='text-sep text-sep-date'>/</span>";
    				
    				
    				
    					if (the_modified_date('d.m.Y') != the_date('d.m.Y')) {
    					
    					$output .= '<time class="date-container minor-meta updated">'.the_modified_date('d.m.Y')."</time>";
    					$output .= "<span class='text-sep text-sep-date'>/</span>";					
    					}
    						
    		
    				
                        if ( get_comments_number() != "0" || comments_open() ){
    
                        $output .= "<span class='comment-container minor-meta'>";
    					ob_start();

    Didn’t work.

    Best regards,
    lebenspraxis

    #1059431

    Hey lebenspraxis,

    Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)

    Best regards,
    Basilis

    #1059758

    Hey support team,
    sorry Basilis, but your answer in my opinion is not satisfactory. I waited two and a half days to get this answer! I understand that there are so many questions in the forums every day… Maybe you haven’t read all I wrote and misunderstood? Maybe I better shouldn’t post the whole code for the shortcode I use, makes it seem a great thing. Indeed it is an easy question. You can see here that your colleague Ismael linked to the shortcode I found and use:
    Ismael’s link
    What I asked for is only a few lines of code to add in so that I can display the time when a blog post was last modified. “Hire a freelancer” for something that is easy to give and that many users see as a basic functionality of a wordpress blog can’t be taken as serious. Sorry. I think that there are feature requests for having an ALB element for displaying blog meta infos and I can’t understand why having this isn’t already the case.
    Besides that I by myself without significant programming-skills found a solution!

    if (get_the_modified_date() != get_the_time()) {
    						
    					$output .= '<span class="minor-meta">Aktualisiert am </span>';
    					$output .= '<time class="date-container minor-meta updated" {$markup}>'.get_the_modified_date(get_option('date_format'))."</time>";					
    					$output .= "<span class='text-sep text-sep-date'>/</span>";					
    					}

    It works! Most of this lines was just copying some code that gets the publication date and change it, so that it does the same for the modified date.

    Regards,
    lebenspraxis

    • This reply was modified 5 years, 11 months ago by lebenspraxis.
    #1061422

    Hi,

    I would like to apologize for the confusion. It’s true that we are swamp with inquiries at the this moment, so we can’t comply with every customization requests.
    I’m glad that you’ve found the solution yourself. Thanks for sharing it. Let us know if we can help you with anything else.

    Best regards,
    Ismael`

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