Jump to content

Recommended Posts

hello dear phpfreaks

 

this is a question regarding a wordpress-thing. I run  wp with the theme twentyfourteen

can i put the "featured-images" in the theme 2014 to another position.

see the example-page http://www.ex-libri.org
note: it is beta-beta at the moment

they are at the top of the postings. can i put these images to another position - let me say to the mid of the page.
in other words - put them down is this possible.?

guess that we can go like so;

The code that controls the Featured Content is found in a file called "page.php" in the main directory of the theme. It contains the following lines:

 

<?php
    if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
        // Include the featured content template.
        get_template_part( 'featured-content' );
    }
?>

In theory we  should be able to copy that bit of code and put it anywhere we like.

If we put it somewhere other than the homepage then we need to delete the characters

"is_front_page() &&"

because that line is checking to see if the homepage is being displayed, and that we have chosen to display featured posts.
 

 
What do   you think about this....

You could move the "featured-images". Just be aware that when the twentyfourteen theme is updated by the original developers, your changes will likely be lost...if you're editing the theme files directly.

 

To avoid this issue, you could look into using Child Themes. More information can be found here:

https://codex.wordpress.org/Child_Themes

hello dear cyber-robot.

 

many many thanks for the quick reply. GREAT advices that i will follow.

 

i will add the child-theme.

 

question: what would you add to the child-theme. besides the code that is shown in the link you have given - this following


/*
 Theme Name:   Twenty Fifteen Child
 Theme URI:    http://example.com/twenty-fifteen-child/
 Description:  Twenty Fifteen Child Theme
 Author:       John Doe
 Author URI:   http://example.com
 Template:     twentyfifteen
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
 Text Domain:  twenty-fifteen-child
*/

would you add:  - this ....

<?php
    if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
        // Include the featured content template.
        get_template_part( 'featured-content' );
    }
?>

dear cyberrobot. i love to hear from  you

 

regards dilbert

It's been a while since I've experimented with Child Themes. But if I remember correctly and I didn't misread the quote below from the WordPress Codex, you'll need to completely replace whatever theme file you want to change.

 

...your child theme can override any file in the parent theme: simply include a file of the same name in the child theme directory, and it will override the equivalent file in the parent theme directory when your site loads. For instance, if you want to change the PHP code for the site header, you can include a header.php in your child theme's directory, and that file will be used instead of the parent theme's header.php.

 

 

To change "page.php", you need to copy all the code from Twenty Fourteen's "page.php", paste it into your Child Theme's "page.php", and then make your changes.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.