Forum Replies Created

Viewing 30 posts - 91 through 120 (of 251 total)
  • Author
    Posts
  • Ok in the private section I am going to add all the information you need to access my files

    • This reply was modified 5 years, 4 months ago by elenapoliti.

    Yes I removed the archive-projects.php but nothing happened. Give me one hour to upload the web site to a temporary domain so that you can access. I will give you the access details and specify the pages. Thanks

    Hi Ismael, unfortunately your code didn’t work. I still see my projects listed as a list instead of a blog grid. It seems that notwithstanding the filter avf_blog_style, the settings in the theme options overwrite everything

    Hi Ismael, sorry for the late reply but I was ways the whole week.
    I did two attempts following your suggestions, but didn’t work. Here the code for each one.
    First of all I created a blog page where the standard post should be visible, and I set the child theme options for blog layout as a list (that’s how I want to see my standard post). Now the idea is that if I select a specific term taxonomy from the custom type posts (projects) I want them shown in a grid format.
    Here my two attempts to do it.

    ATTEMPT 1
    I used the is_post_type_archive function within the archive-project.php, simplifying it for my purposes:

     //above there's the code for handling the header, which I didn't change
    		<div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>
    			<div class='container template-blog '>
    				<main class='content <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content','post_type'=>'post'));?>>
    					<?php 
    						$tds =  term_description(); 
    						if($tds)
    						{
    							echo "<div class='category-term-description'>{$tds}</div>";
    						}
    					?>
                        <?php
                        if ( is_post_type_archive( 'projects' ) ) {
              				global $posts;
                            $post_ids = array();
                            foreach($posts as $post) $post_ids[] = $post->ID;
                            if(!empty($post_ids))
                            {
                                $atts   = array(
                                    'type' => 'grid',
                                    'items' => get_option('posts_per_page'),
                                    'columns' => 5,
                                    'class' => 'avia-builder-el-no-sibling',
                                    'paginate' => 'yes',
                                    'use_main_query_pagination' => 'yes',
                                    'custom_query' => array( 'post__in'=>$post_ids, 'post_type'=>get_post_types() )
                                );
    							/**
    							 * @since 4.5.5
    							 * @return array
    							 */
    							$atts = apply_filters( 'avf_post_slider_args', $atts, 'archive' );
                                $blog = new avia_post_slider( $atts );
                                $blog->query_entries();
                                echo "<div class='entry-content-wrapper'>".$blog->html()."</div>";
        					}
                       
                        ?>
    				<!--end content-->
    				</main>

    ATTEMPT 2
    I still have an archive-projects.php which is the exact copy of archive.php
    I added to my functions.php the following code:

    add_filter('avf_blog_style','avia_change_category_blog_layout_2', 10, 2); 
    function avia_change_category_blog_layout_2($layout, $context){
    if($context == 'archive-projects') $layout = 'blog-grid';
    return $layout;
    }

    In all 2 attempts, the blog layout (list) set in the child theme options overwrites the codes for the archive-projects.php. So if I click on a term taxonomy of the custom type posts, they appear as a list, like the blog page instead of appearing as a grid.
    Could you help me please?

    • This reply was modified 5 years, 4 months ago by elenapoliti.
    in reply to: How to set a calculated date to filter blog posts #1246215

    Thanks it worked! I included the condition if(is_archive()) as follows, and everything is back to normal

    add_filter('avia_post_slide_query', 'avia_post_slide_query_mod',10, 2);
    function avia_post_slide_query_mod($query, $params) {
    	$posts = get_posts($query);
    	$today_year = date('yy');
    	$two_years_ago = $today_year - 2;
    	$current = array();
    
    		foreach( $posts as $post ) {
    			$meta = get_post_meta($post->ID);
    			$acf_year = $meta['anno'][0];
    			
    			if (is_page(112)){
    				if($acf_year >= $two_years_ago & $acf_year <= $today_year) {
    				$current[] = $post->ID;
    				}	
    			}
    			else if (is_page(204))	{
    				if($acf_year < $two_years_ago) {
    				$current[] = $post->ID;
    				}	
    			}
    			else if (is_archive()) {
    				return $query;
    			}
    		}
    
    	$query['post__in'] = $current;
    
    	return $query;
    }

    You can close the ticket. Thanks

    in reply to: How to set a calculated date to filter blog posts #1245782

    Hi Ismael, I got it. The code I used is as follows (I put it in the functions.php). However I got into a new problem:

    My two pages, have the content element ‘blog posts’ where I show all the categories. Programatically by the below code the two pages show different posts according to the acf field = year (anno)

    If however I click on the category link (hence filter by category) the category archive is mess up. I checked and something in the function below enters in conflict with the category archive. Do you have any suggestion?

    I copy in the private section the link to the test page

    add_filter('avia_post_slide_query', 'avia_post_slide_query_mod',10, 2);
    function avia_post_slide_query_mod($query, $params) {
    	$posts = get_posts($query);
    	$today_year = date('yy');
    	$two_years_ago = $today_year - 2;
    	$current = array();
    		foreach( $posts as $post ) {
    			$meta = get_post_meta($post->ID); //acf fields are saved in post meta
    			$acf_year = $meta['anno'][0]; //get the value of the field needed (anno=year)
    			if (is_page(112)){
    				if($acf_year >= $two_years_ago & $acf_year <= $today_year) {
    				$current[] = $post->ID;
    				}	
    			}
    			else if (is_page(204))	{
    				 if($acf_year < $two_years_ago) {
    				$current[] = $post->ID;
    				}	
    			}
    		}
    	$query['post__in'] = $current;
    	return $query;
    }
    • This reply was modified 5 years, 5 months ago by elenapoliti.
    in reply to: How to set a calculated date to filter blog posts #1245704

    Thanks Ismael, but I am still a bit confused. My custom field is a simple year, which appears on each post (ex. 2018, 2020 etc.). I should organize my blog posts on the two pages according to that field. On one page there should be automatically all posts that have a year comprised between the present (hence getting a timestamp like $today = getdate(); to allow a calculation) and maximum 2 years past , and the other page should contain all the posts up to 2 years ago (always according to the custom field and not the post date publication).
    Something like the following

    $today= getdate();
    $today_year = $today['year'];
    $two_years_ago = $today_year - 2;
    if (is_page (204)) {
      if ($today_year >=$custom_field_value >= ($today_year  - $two_years_ago)) 
      {show the posts}
    }
    else if (is_page (304)) {
     if ($custom_field_value <($today_year  - $two_years_ago) {show the posts}
    }

    My difficulty is:
    1) how to filter custom field value
    2) how to show the posts that satisfy the request

    • This reply was modified 5 years, 6 months ago by elenapoliti.
    in reply to: How to set a calculated date to filter blog posts #1244967

    Thanks Ismael. Just one question: in order to pass the new array as a WP query where the array is built as you suggest $date_query = your_array();
    should I use $date_query = AviaHelper::add_date_query( $date_query);
    or should I use $query = new WP_Query( $date_query ); ?

    And, if I have a custom field named “year” in which I actually write the year of the post (not the year when the post is published) can I still use the
    $query = new WP_Query( $args ); within the postslider.php? Because maybe I can simply use the custom field to filter the posts

    Thanks

    in reply to: How to set a calculated date to filter blog posts #1244600

    Hi, have you any suggestion for the question above? Thanks very much

    in reply to: How to deregister enfold scripts in a specific page #1225456

    Thanks Ismael. usually I manually disable the template builder elements as in the past the “Load only used elements” options was crashing some pages. However I tried it now and its works. Still there are a few css / scripts that I don’t need on this specific page, but thanks for pointing out where I can find those!

    in reply to: How to deregister enfold scripts in a specific page #1224078

    Hi do you have any suggestion for the above topic? Thanks a lot

    Great @guenni007, it’s a good compromise! I just put it in the functions.php with a conditional setting on which page the function should be triggered and it works.

    Thanks @Guenni007, I have read about codes to limit excerpt content. I could work it out with a custom ACF field, but I wanted to render everything in the advanced layout builder. The specific page, where I need it, is made by 3 flex columns simply containing title + textblock + image. In order to have everything nicely ordered at the same height, the idea was to, somehow, limit the amount of text the client can add to the textblock. I wonder however (I am not an expert of ACF) if I can use a multiple ACF just on a single page .

    in reply to: Use of Search&Filter Pro with blog posts #1218707

    Thanks Ismael, I am sorry for having left this ticket open. I solved the problem with Search&Filter.

    For future reference, I created a filtering form with S&F. Then I added the form to a widget (with the plugin in the widget area it appears the S&F). In the 1/5 column I added the widget just created. The trick was adding a further shortcode just after that, simply as text :
    [searchandfilter id=”243″ action=”filter_next_query”]

    In this way the plugin can filter the blog grid with an ajax request, in a similar way to what happens with the masonry filter.

    You can close the ticket. Thanks

    in reply to: image container forced at the bottom of a flex column #1218159

    Hi Guenni007 your solution worked as charm!! I am not so familiar with flexbox, hence thanks also for the guide you posted in your link. I will study it.
    Problem solved!

    Maybe it’s better that I open a new ticket for my question above

    I got it. File postslider.php in shortcodes. Changed the lines 765-789 in the following code

    
    if( $show_meta )
    {
    	$taxonomies  = get_object_taxonomies( get_post_type( $the_id ) );
    	$cats = '';
    	$categories = get_the_category($the_id);
    	//$excluded_taxonomies = array_merge( get_taxonomies( array( 'public' => false ) ), array( 'post_tag', 'post_format' ) );
    	//$excluded_taxonomies = apply_filters( 'avf_exclude_taxonomies', $excluded_taxonomies, get_post_type( $the_id ), $the_id );
    	if( ! empty( $categories ) )
    		{
    			foreach( $categories as $category )
    			{
    				$cats .= '<a href="'.get_category_link($category->cat_ID).'">'. $category->name . '</a>';
    			}
    		}
    	if( ! empty( $cats ) )
    		{
    			$meta_out .= '<span class="blog-categories minor-meta">';
    			$meta_out .=	$cats;
    			$meta_out .= '</span>';
    		}
    }
    

    You can close the ticket

    • This reply was modified 5 years, 9 months ago by elenapoliti.

    As an update, I actually found that I should work on the loop-index.php that seems to be responsible of the minor-meta .

    I changed line 291 from
    $cats .= get_the_term_list( $the_id, $taxonomy, '', ', ', '' ) . ' ';
    to
    $tax .= get_the_term_list( $the_id, $taxonomy, '', ', ', '' ) . ' ';

    and added just after line 308 and before line 309 the following

    $cat_output .= '<span class="blog-taxonomy minor-meta">';
    $cat_output .= $tax;
    $cat_output .='</span>';

    Still no success. Any suggestion?

    • This reply was modified 5 years, 9 months ago by elenapoliti.

    Excuse me Victoria but you don’t answer my question. I did the search and the only file that must be responsible for the output is the avia-shortcodes/blog/blog.php
    The output in blog grid is as follows

    <span class="blog-categories minor-meta">
       <a href="http://localhost:8888/adrianovenudo/category/tipo-2/" rel="tag">Tipo 2</a> 
       <a href="http://localhost:8888/adrianovenudo/luoghi/trentino/" rel="tag">Trentino</a> 
       <a href="http://localhost:8888/adrianovenudo/tipologie/progetto/" rel="tag">Progetto</a> 
    </span>

    The first is a Category, the second and third are taxonomies. So please can you help me in changing the blog.php code so that the output maybe somethings like

    <span class="blog-categories minor-meta">
       <a href="http://localhost:8888/adrianovenudo/category/tipo-2/" rel="tag">Tipo 2</a>
    </span>
    <span class="blog-taxonomies minor-meta"> 
       <a href="http://localhost:8888/adrianovenudo/luoghi/trentino/" rel="tag">Trentino</a> 
       <a href="http://localhost:8888/adrianovenudo/tipologie/progetto/" rel="tag">Progetto</a> 
    </span>

    Thank you

    in reply to: Theme has broken suddenly on mobile #1216644

    Sorry for the inconvenience, but I found the problem. It was a cache issue. So everything is fixed.
    Thanks

    Hi Victoria thanks for clearing that: I knew that it was impossible to manage the issue via css. I come so to my first question: where should I add my conditional php? Consider that the page is built with ALB and it show a blog post grid. I can add some condition such as get_taxonomies or get_terms and filter them, but I would like to know where I can add my code. In the functions.php with some hook or in a template?
    Thanks for clarifying

    Thanks I am going to add the link in the private page.

    Thanks Victoria I see your point. In the meanwhile I tried to use Search and Filter Pro. However I have some problems in setting it with Enfold. I created a simple form with taxonomy and sorting, and set the display results as follows :
    display results = custom
    template option = http://localhost:8888/mydomain/archivio-tematico/ (which is the blog page where I added my blog grid)
    ajax container = .ava-griglia-archivio-tematico (which is the class given to the flex column containing the blog grid)

    I then added the form to the widget area as [searchandfilter id=”224″]. It is visible and it works (I inspected the response that is ok), but the page doesn’t update the results.

    Am I doing something wrong? Thanks

    Sorry I realize now that my question was misleading. No problem in showing the list of post based on the selected taxonomy (in this case all categories). What I need to do is to set to display:none the custom taxonomies and just keep the categories visible. See image example (https://drive.google.com/file/d/1dYed9TNbvjM_GA20O9Cp26W9k5DXEsC1/view?usp=sharing)

    I need hence to understand which function I can add to my functions.php to accomplish it, when on page xxx.
    Thanks

    No need to answer. I have found which was the problem. When generating a new tag in GTM I had to click on “publish” (right top corner). Consider the topic closed

    in reply to: tracking wth google analytics pdf download #1209461

    Thanks Mike, in the meanwhile I found what I needed. For other users’ reference it refers to the use of Google Tag Manager, which is what is needed.
    I found very good articles at the following links:

    https://www.analyticsmania.com/post/track-outbound-links-with-google-tag-manager/
    https://www.analyticsmania.com/post/track-pdf-downloads-with-google-tag-manager-ga/

    You can close the ticket thanks

    in reply to: Custom Post Type and single.php template #1194064

    Sorry, just tried to disable the ALB for the custom post type but still didn’t work..

    in reply to: Custom Post Type and single.php template #1194058

    Thanks, so I have 2 possibilities: disabling ALB from the custom post-types; or using the filter you suggest.

    How can I use the avf_template_builder_content filter? I am not sure.

    Thanks a lot for the support

    in reply to: Custom Post Type and single.php template #1193447

    Hi I just uploaded it on a test server. Below the access. Consider that it is a trial. Hence I created just 1 over 3 Custom Post types and added just very few custom fields with ACF.
    The CPT I created is called “Appartamenti”

    in reply to: Custom Post Type and single.php template #1192920

    I am sorry but I probably miss something about the whole thing.

    I created a custom post type named ‘appartamenti’
    I added to my child them a file single-appartamenti.php and the loop-index.php which was renamed in includes/loop-appartamenti.php

    I tried to add a new post, leaving the content empty, while I added some strings in the single-appartamenti.php to see if they appear in front-end, but nothing happened. I thought I did something wrong, so I deleted the previous files and simply added a single-appartamenti.php in which I wrote a basic code with loop (as by wp examples) like the following:

    <?php
    	if ( !defined('ABSPATH') ){ die(); }
    	global $avia_config;
            get_header();
    ?>
    <div id="content">
        <div id="inner-content" class="wrap test">
            <main id="main" class="test" role="main" itemscope itemprop="mainContentOfPage" itemtype="http://schema.org/Blog">
                <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                        <article id="post-<?php the_ID(); ?>" <?php post_class('test'); ?> role="article">
                        	<p>THIS IS A TEST</p>
                        </article>
                       <?php endwhile; ?>
                       <?php else : ?>
                          <article id="post-not-found" class="hentry cf">
                           <h1>Oops, Post Not Found!'</h1>
                          </article>
                <?php endif; ?>
            </main>
        </div>
    </div>
    <?php 
    	get_footer();
    

    Still nothing happened. I mean in the front-end I see my article completely empty! Am I doing something completely wrong?
    Thanks

Viewing 30 posts - 91 through 120 (of 251 total)