Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
  • #1194454

    Is it possible to create a template page for my portfolio items only using shortcodes?


    Hey paoluccimarketing,

    Could you please attach a mockup of what you’re trying to achieve?

    Best regards,


    Hi Victoria, this is the code I’m testing now. It works but I don’t know if it can crash for some element like color section etc.

    	Template Name: Hotel Template
    	if ( ! defined('ABSPATH') ){ die(); }
    	global $avia_config;
    	 * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
     	 if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title();
     	 do_action( 'ava_after_main_title' );
    			global $wpdb;
    			$title_name = $wp_query->queried_object->post_name;
    			$customers = $wpdb->get_results("SELECT * FROM wp_misano_place WHERE name_control='$title_name'");
    			<div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>
    			<div class='container'>
    				<main class='template-page template-portfolio content  <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content','post_type'=>'portfolio'));?>>
    				<div class='test'>
    				<?php foreach($customers as $customer){ ?>
    				<center><?php echo $customer->name; ?></center>
    				<center><?php echo $customer->telephone; ?></center>
    					<center><?php echo $customer->email; ?></center>
    				<center><?php echo $customer->address; ?></center>
    				<center><?php echo $customer->image_link; ?></center>
    				<?php } ?>
    				<?php echo do_shortcode('[av_textblock size="" font_color="" color="" av-medium-font-size="" av-small-font-size="" av-mini-font-size="" av_uid="av-k7yxfp65" custom_class="" admin_preview_bg=""]'.$title_name.'[/av_textblock]'); 
                        /* Run the loop to output the posts.
                        * If you want to overload this in a child theme then include a file
                        * called loop-page.php and that will be used instead.
                        $avia_config['size'] = avia_layout_class( 'main' , false) == 'entry_without_sidebar' ? '' : 'entry_with_sidebar';
                        get_template_part( 'includes/loop', 'portfolio-single' );
                    <!--end content-->
    				//get the sidebar
    				$avia_config['currently_viewing'] = 'page';
    			</div><!--end container-->
    		</div><!-- close default .container_wrap element -->

    I also have another question. If my code works for my purpose, is it possible create different template for portfolio items and set the template for each portfolio item?


    Hi paoluccimarketing,

    We apologize for the delayed response.
    Based on the code you have posted, I don’t see it causing any issues or conflict with other elements such as Color Section.
    As for your last question, if you’re looking for something like choosing a Page Template then, unfortunately, I don’t think that’s possible at least from what I know based on the WP Codex: (if this is possible I’ll be glad to know as well).
    For now, I think the solution is to use single-{post-type}.php file as your single template and the workaround for the different templates is to use Conditional Tags to identify which portfolio items should use this layout and for the rest use this layout, etc.
    Hope this is helpful.

    Best regards,


    Tranks Nikko for your answer.I’m using the Conditional Tags as you said but now I have two problems.
    Mansory Gallery doesn’t accept link to images but works with ids and I think that every image has an id but I can’t found it. I must store any information about a place in a custom database. Is there a way to do it?
    [av_masonry_gallery ids="25810,25805,25800,25795,25790,25785" caption_elements="none" caption_styling="" caption_display="always" size="fixed" orientation="" gap="1px" columns="3" av-medium-columns="" av-small-columns="" av-mini-columns="" items="24" paginate="none" color="" custom_bg="" overlay_fx="" animation="active" container_links="active" id="gallery" custom_class="" av_uid="av-k6w4d39r"]

    Color section can’t get the url from $link_image_cs. echo $link_image_cs; print the correct url. Here is the code:
    echo do_shortcode('[av_section min_height="50" min_height_pc="25" min_height_px="500px" padding="default" custom_margin="0px" custom_margin_sync="true" color="main_color" background="bg_color" custom_bg="" background_gradient_color1="" background_gradient_color2="" background_gradient_direction="vertical" src="'.$info->image_cs.'" attachment="25785" attachment_size="full" attach="scroll" position="center center" repeat="stretch" video="" video_ratio="16:9" overlay_enable="aviaTBoverlay_enable" overlay_opacity="0.3" overlay_color="#000000" overlay_pattern="" overlay_custom_pattern="" shadow="no-border-styling" bottom_border="no-border-styling" bottom_border_diagonal_color="#333333" bottom_border_diagonal_direction="" bottom_border_style="" custom_arrow_bg="" id="" custom_class="" aria_label="" av_element_hidden_in_editor="0" av_uid="av-jgp3h75a"]');


    I understood the problem and it’s the same for both. I found the id for each image. For color section I passed in the attachment the id of the image. But now there is another problem: the page I’ve created with the enfold layout is different using only shortcodes.
    How is it possible?


    Hi paoluccimarketing,

    Thanks for giving us access.
    I can’t really give an answer why it’s different but can you try to wrap the Masonry instead inside a Content Layout element.
    Maybe that could fix it since it seems to be wrapping inside the same section as those 1/3 columns.

    Best regards,


    Hi nikko,
    Thanks for your answer. I tried what you said but nothing is changed.


    Hi nikko,
    Thanks for your answer. I tried what you said but nothing changed.


    Hi paoluccimarketing,

    Thanks for giving us admin access.
    I was able to check the backend however if I go to Appearance > Editor > single-portfolio.php it’s empty.
    Can you give us ftp access? so we can try to do some modification, it seems like the color section breaks the layout in the footer.

    Best regards,


    Hi nikko.
    Thanks for your answer.
    Here the ftp access.


    Is there anyone who can help me?


    Hi paoluccimarketing,

    We apologize for the delay, some shortcodes doesn’t work properly when it’s outside of the template builder.
    I have modified the single-portfolio.php file but you will need to modify the dynamic values.
    Here are some things that’s not working when using a shortcode:
    – [av_postcontent]
    – Equal height columns does not work well outside the template builder
    Also you have 4 foreach loops and they are on top of each other that’s why it’s repeating multiple times, you’ll need to store those values and keep the shortcode outside of the loops unless you want them to be repeated.

    Best regards,


    Hi nikko,
    Thank you very much for everything you’ve done. It’s awesome now. These days I’ll try to modify informations of the page.
    – How can I store those values? I found only foreach loops method to print all values.
    – I don’t want repeated elements on the page but how I wrote here (“”) I can’t use the word “AND” to select only one element.
    – Seems not works on mobile phone. Is it a problem of shortcodes, isn’t?


    Hi paoluccimarketing,

    I think you can run those loops and just store those values you need in some variable (make sure you initialize those variables outside the loop)
    Then you can use the shortcode and replace the contents with the correct variables.
    Hope this helps.

    Best regards,

Viewing 16 posts - 1 through 16 (of 16 total)

You must be logged in to reply to this topic.