WordPress.org

Forums

Customizr
Posts in Pages (11 posts)

  1. dominic_ks
    Member
    Posted 11 months ago #

    Hi folks,

    Hoping someone can help. I'm attempting to use plugin - https://wordpress.org/plugins/posts-in-page/ - when setting it up normally, it just effectively dumps all the post info onto the page with not a lot of styling. What I'm after is the posts on the page to look at they do on the front page of my site with all the nice formatting, circular featured images etc.

    According to the installation instructions for this plugin it says I can add the following to the short code:

    "[ic_add_posts template='template-in-theme-dir.php'] - In case you want to style your markup, add meta data, etc. Each shortcode can reference a different template. These templates must exist in the theme directory."

    Reading the Customizr documentation I'm understanding that the theme doesn't use individual page templates and so I'm unsure which file to point to (to replace "template-in-theme-dir.php") in the above example.

    Can anyone point me in the right direction? Alternatively if anyone has other suggestions on how to achieve this then I'm all ears.

    Thanks.

  2. rdellconsulting
    Member
    Posted 11 months ago #

    Not sure why you need to use a plugin?

    If you set up 2 blank pages (eg Home, Blog), then go to Customize>Front Page and set:

    Front page displays=A static page
    Front page = Home
    Posts page = Blog

    And I hope that solves your problem!

  3. dominic_ks
    Member
    Posted 11 months ago #

    Hey,

    Thanks for getting back to me, the reason I was looking to use this is that I want to set my (music) site up like this:

    - Home page - displays a list of all recent posts regardless of topic
    - A band's page - displays the band's info page with bio, photos etc and at the bottom is a list of posts that are related to that band only
    - A promoter's page - displays the promoter's info page with info, and at the bottom posts related to that promoter which could cover multiple bands.

    So for the second 2, essentially to work like a category archives page but with static content at the top.

    Make sense?

    Cheers.

  4. SFIQUET
    Member
    Posted 11 months ago #

    You solve my problem rdellconsulting !! Thanks !!

  5. nikeo
    Member
    Theme Author

    Posted 11 months ago #

    Hi @dominici_ks,

    You can easily create a page template with the Customizr theme.
    The theme actually already includes an example of page template called custom-page.php, including all the necessary html markup and hooks.

    You can start by making a copy of it and rename it like you need. Then customize it either with the hooks API (recommended method => actions, filters) or by adding your own custom php code and markup inside it.

    Hope this helps!

  6. ElectricFeet
    Member
    Posted 11 months ago #

    (I can't believe I'm suggesting something different to nikeo. While his suggestion is best, if it's beyond your skill level, the following is an easier hack.)

    Alternatively, starting from the category page, you can insert another page's content.

    Assuming that you have created categories band1 and band2 (change as required) and that all relevant posts are marked up with the band1/band2 categories:

    Create pages "Band 1 page" and "Band 2 page" (again, change as required). Add the bands' bios etc to the two pages as you wish.

    Get each page's ID. You can find the IDs in the URL when you are editing a page. The URL will look something like ...wp-admin/post.php?post=1234&action=edit.... The page's ID in this case is 1234 (don't worry that it says post=; it's a page).

    Add the following to your child theme's functions.php.

    // Add content of pages to specific category archives
    add_action  ( '__before_loop', 'add_page_content_before_post_list');
    function add_page_content_before_post_list() {
    	if ( is_category( 'band1' ) ) {
    		$post = get_post(1234); // <<<<<<<<<< Change this for the correct page ID for band1's page
    		echo $post->post_content;
    	}
    	if ( is_category( 'band2' ) ) {
    		$post = get_post(1235); // <<<<<<<<<< Change this for the correct page ID for band2's page
    		echo $post->post_content;
    	}
    }

    Read How to customize Customizr if you've never done this before.

    When you want to link to the band's page, you can link to the category page, which will be something like http://example.com/category/band1/.

  7. dominic_ks
    Member
    Posted 11 months ago #

    Excellent thanks guys, only just finished my W3 Schools CSS tutorial so don't have enough PHP to do what Nikeo has described right now :-)

    Think I'll take what ElectricFeet suggested for now and come back to update it all when I've got the skills!

    One more - is there a way to do what ElectricFeet has suggested but on the front page?

    Cheers.

  8. ElectricFeet
    Member
    Posted 11 months ago #

  9. nikeo
    Member
    Theme Author

    Posted 11 months ago #

    OK.
    About CSS, (and many other programming language) I also recommend this guide from the Mozilla Developer Network : https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started

  10. nikeo
    Member
    Theme Author

    Posted 11 months ago #

    @electricfeet :-D. I am glad my suggestions are not some sort of gospel ;-)

  11. ElectricFeet
    Member
    Posted 11 months ago #

    :-)

Reply

You must log in to post.

About this Theme

About this Topic