Forum Replies Created

Viewing 15 replies - 1 through 15 (of 35 total)
  • ecohostingservices

    (@ecohostingservices)

    Hi
    Since I didn’t get a response straightaway, I decided to develop my own Portfolio using Custom Post Types, Custom Fields and a custom template.

    The layout on the single Portfolio pages are what I wanted but I couldn’t change it in your plugin. Although I think it will look better with out the sidebar i.e. full screen width.

    https://towywebdesigns.uk/my-portfolio/

    Thanks anyway for replying.

    Colin

    OK thanks Michael.

    ecohostingservices

    (@ecohostingservices)

    Hi Michael
    What about just Full Screen for the moment?

    Colin

    Hi
    I found this tutorial that was easy to follow:
    ADD ACF FIELDS TO ADMIN COLUMNS

    I added the code to my Theme’s functions file.

    I now wanted the Grave No. column moving next to the ‘Title’ so it was easily seen so I used a plugin called ‘Admin Columns’, opened up the Setting page from the Installed Plugins page. Then opened the CPT of Grave then reordered the columns to what I wanted.

    I hope that helps others.

    Colin

    Hi
    You need to add the Custom Fields code to your template files or a custom template.

    <?php
        if(get_field('your_field_name')) {
    	 echo '<p>' . get_field('your_field_name') . '</p>';
        } else {
             echo '<p>Nothing Entered</p>';
        }?>

    I hope that helps

    Colin

    Hi
    How have you setup your ACF’s? Have you selected the Post Type to be used?

    Colin

    Thanks for clarifying that, just tried it and it worked. So now 2 ways of using it in the template file.

    Your plugin is great on maps and grave headstones, a project I am working on at the moment.

    Cheers

    Colin

    ecohostingservices

    (@ecohostingservices)

    This is the pagination code that comes with Mesmerize and it can be found in the template-functions.php file.

    function mesmerize_print_pagination($args = array(), $class = 'pagination')
    {
        if ($GLOBALS['wp_query']->max_num_pages <= 1) {
            return;
        }
        
        $args = wp_parse_args($args, array(
            'mid_size'           => 2,
            'before_page_number' => '<span class="meta-nav screen-reader-text">' . __('Page', 'mesmerize') . ' </span>',
            'prev_text'          => __('<i class="fa fa-angle-left" aria-hidden="true"></i>', 'mesmerize'),
            'next_text'          => __('<i class="fa fa-angle-right" aria-hidden="true"></i>', 'mesmerize'),
            'screen_reader_text' => __('Posts navigation', 'mesmerize'),
        ));
        
        $links = paginate_links($args);
        
        $next_link = get_previous_posts_link(__('<i class="fa fa-angle-left" aria-hidden="true"></i>', 'mesmerize'));
        $prev_link = get_next_posts_link(__('<i class="fa fa-angle-right" aria-hidden="true"></i>', 'mesmerize'));
        
        $template = apply_filters('mesmerize_pagination_navigation_markup_template', '
        <div class="navigation %1$s" role="navigation">
            <h2 class="screen-reader-text">%2$s</h2>
            <div class="nav-links"><div class="prev-navigation">%3$s</div><div class="numbers-navigation">%4$s</div><div class="next-navigation">%5$s</div></div>
        </div>', $args, $class);
        
        echo sprintf($template, esc_attr($class), $args['screen_reader_text'], $next_link, $links, $prev_link);
    }

    For this to work I am sure I need to pass my query into it but I don’t know how. I would love to know especially if I need to use it again.

    Colin

    ecohostingservices

    (@ecohostingservices)

    Thanks for your reply bcworkz, I looked into it further and still couldn’t get it to work.

    However, I did another search and found some code and used that. It now works for my custom query. I placed the code below into my themes functions file.

    function pagination_bar() {
        global $my_query;
     
        $total_pages = $my_query->max_num_pages;
     
        if ($total_pages > 1){
            $current_page = max(1, get_query_var('paged'));
     
            echo paginate_links(array(
                'base' => get_pagenum_link(1) . '%_%',
                'format' => '/page/%#%',
                'current' => $current_page,
                'total' => $total_pages,
            ));
        }
    }

    I then added this code below to where I wanted the pagination to be:

    <?php
        if (have_posts()):
           pagination_bar();
        endif; 
     ?>

    It does the job but it would have been better if the built in pagination worked. Anyhow it is a solution.

    Colin

    ecohostingservices

    (@ecohostingservices)

    Tried all kinds now but found some code that does work. I added this code to my themes functions file.

    function pagination_bar() {
        global $my_query;
     
        $total_pages = $my_query->max_num_pages;
     
        if ($total_pages > 1){
            $current_page = max(1, get_query_var('paged'));
     
            echo paginate_links(array(
                'base' => get_pagenum_link(1) . '%_%',
                'format' => '/page/%#%',
                'current' => $current_page,
                'total' => $total_pages,
            ));
        }
    }

    Then this code was added to the template file where I wanted the pagination.

    <?php
        if (have_posts()):
           pagination_bar();
        endif; 
     ?>

    Does the trick.

    Colin

    ecohostingservices

    (@ecohostingservices)

    Hi Jarret
    No that code is working but it only gives me 2 pages only so not really practical. The code below that is the themes pagination code which doesn’t work with my template files.

    I have used a plugin called Custom Post Type UI and set up the following:
    CPT = grave
    Custom Taxonomy = servant

    I hope this makes more sense.

    Colin

    ecohostingservices

    (@ecohostingservices)

    Hi
    I have just signed up with pastebin and added the code for two files.

    My Pastebin

    Colin

    ecohostingservices

    (@ecohostingservices)

    Hi
    I used List Custom Taxonomy and it does the job.

    I have 3 Custom Taxomonies and it allows you to add 3 of them to the widget area. Just select the taxonomy and you are good to go.

    Colin

    ecohostingservices

    (@ecohostingservices)

    Hi Jarret
    I have just set up a fresh install on Localhost and only installed the required plugins and it works.

    Therefore it must be the way I have it setup with the extra template files. I wanted the archive of the CPT’s to appear on a normal Page Template in WordPress so that I could add written content first then output the archive underneath.

    Thanks

    Colin

    ecohostingservices

    (@ecohostingservices)

    Hi
    Thanks for replying. Not the homepage but on an archives pages or an actual page template.

    My Query sets the amount of posts per page as I have several Custom Post Types with their own Template file.

    When you say it works for you, what is actually displayed?

    Thanks

    Colin

Viewing 15 replies - 1 through 15 (of 35 total)