Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #543807

    I have started using Custom Post Types UI as per Andy’s suggestion in this post:
    https://kriesi.at/support/topic/custom-post-types-in-enfold/

    I have got to the part in the tutorial where I need to set up a template by copying the page.php template. Due to the Enfold theme this is very different from the basic page used in the tut.
    page.php from video
    This is the tutorial, the new page is at 3:07: https://www.youtube.com/watch?v=6URWfMTsWPo
    Please can you let me know where to add the php from the tutorial within this code? Or do I need another template?

    <?php /* Template Name: Stories */ ?>
    <?php
    global $avia_config;
    
    	/*
    	 * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
    	 */
    	 get_header();
    
     	 if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title();
     	 
     	 do_action( 'ava_after_main_title' );
    	 ?>
    
    		<div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>
    
    			<div class='container'>
    
    				<main class='template-page content  <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content','post_type'=>'page'));?>>
    
                        <?php
                        /* 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', 'page' );
                        ?>
    
    				<!--end content-->
    				</main>
    
    				<?php
    
    				//get the sidebar
    				$avia_config['currently_viewing'] = 'page';
    				get_sidebar();
    
    				?>
    
    			</div><!--end container-->
    
    		</div><!-- close default .container_wrap element -->
    
    <?php get_footer(); ?>

    This is just to get me started. I will need to pay you guys to do some customization once I have it working.

    Thanks
    Rob

    #543850

    Hi fanlokbun!

    can you please explain us a bit more? which part of the code you want to use, what you aim to do and what results you want to show.
    Duplicating the page.php and naming it properly should work for basic stuff.

    Thanks.

    Best regards,
    Basilis

    #543872

    Hi Basilis

    In the video at 3:25 mins the guy adds code for a container into to the basic page template (see grab) to display the custom post type content.

    I would like to know where to put that container code in the Enfold page template code above. His is a copy of page.php from the template folder but the Enfold page.php that I have copied is totally different.

    Thanks
    Rob

    #546209

    Hi!

    If you set up the custom post type and its taxonomies correctly, you don’t need to modify any template because it is going to available in the list of taxonomies when you use the blog posts element in the advance layout builder.

    Best regards,
    Ismael

    #547017

    Nice one Ismael.
    That is so much easier than I thought it was going to be.
    Thanks a million.
    Rob

    #547346

    Hi Rob,

    Glad we could help, let us know if you should need any more help on the topic.

    Regards,
    Rikard

    #548222

    Yes I do need some more help.
    1. When I add the blog posts element it only gives me the option to display blog posts or entries from a custom taxonomy? It doesn’t allow me to choose my new custom post type ‘Stories’. If I select ‘from a custom taxonomy’ I can choose from my new custom taxonomy ‘Service’ but I need all Story entries.
    2. When the entries are displayed from my new custom post type ‘Stories’ (using Service Taxonomy) it doesn’t show any of the new custom fields created for it. (Just featured image and title which I left switched on)
    Any help would be most appreciated. This is the page I am using: http://goldhillmuseum.org.uk/stories/
    Many thanks
    Rob

    #548535

    Hey!

    1,) The actual custom post type cannot be selected but its taxonomies, in this case “Service”, should be available as an option. I don’t see the problem there unless you didn’t apply any terms/categories to the post items.

    2.) You have to modify the includes > loop-index.php file in order to display those custom fields or the config-templatebuilder > avia-shortcodes > postslider.php if you set the blog style to “grid”. Use the get_post_meta() function in order to retrieve the custom fields. These documentation should help:

    https://developer.wordpress.org/reference/functions/get_post_meta/
    https://codex.wordpress.org/Custom_Fields

    Best regards,
    Ismael

    #549724

    Hi Ismael,
    Thanks again. I am trying to get my head around this but I am not very confident in PHP and can’t work out where in the loop-index.php to add the get_post_meta() functions.
    Please see private content below.
    Thanks
    Rob

    #552999

    Hey!

    here you will find a freelance developer for this job: http://kriesi.at/contact/customization

    Best regards,
    Andy

    • This reply was modified 9 years ago by Andy.
    #564602

    As per you advice I hired a codeable freelance developer and modified the includes > loop-index.php to contain the custom fields. It worked great on individual ‘stories’. e.g: http://goldhillmuseum.org.uk/story/305/
    I now need to create the Stories home page but when I select Single Author Excerpt in the Blog Posts Content Element I get all the fields showing. How do I omit the custom fields and just show headings in the same way the blog works?

    #565706

    Hey!

    The job you are trying to do require custom coding which is out of our support scope however we tried to help you as much as possible simply because we love our customers. It is hard for us to teach you code these things. we recommend you hire a freelancer for this job.

    If you have any questions related to enfold theme we are glad to help you :)

    Cheers!
    Vinay

    #566251

    I realise that this job is out of the scope of your support. I didn’t expect you to do anything except point me to documents that will help me to do it like Ismael did earlier in this thread. I am willing to hire a freelancer again but I wanted to try myself first. You guys have always been very helpful that is why I have bought your theme 9 times ($640).

    #567016

    Hey!

    We are always here to help you :) If you need any info to try out some changes on your own we can definitely help you with useful resources.

    Best regards,
    Vinay

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