Forum Replies Created

Viewing 15 replies - 151 through 165 (of 268 total)
  • Thread Starter Mark

    (@codeispoetry)

    Okay here’s the answer. I overlooked that the alt text was being set already due to my image being embedded in a link.

    For the benefit of others, this was to make the Flickr Pick a Picture plugin work with an Oxygen child theme. FPP puts the attribution, including a link to the Flickr photo page, in the image post_excerpt. Alt text can’t include links so I was looking for a way to display the post_excerpt with the featured image in another unobtrusive way. I settled for a div that only appears when you hover over the image.

    First, I was able to throw together a function for getting the post_excerpt() field (what I was calling the caption). Here is the function that I added to my functions.php:

    function get_the_feature_caption() {
      global $post;
    
      $thumbnail_id    = get_post_thumbnail_id($post->ID);
      $thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));
    
      if ($thumbnail_image && isset($thumbnail_image[0])) {
        $caption = '<span>'.$thumbnail_image[0]->post_excerpt.'</span>';
      }
      return $caption;
    }

    Then in the post.php template of my Oxygen child theme, I include the following code:

    if ( current_theme_supports( 'get-the-image' ) )
    	$image= get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'single-thumbnail', 'link_to_post' => false, 'image_class' => 'featured', 'attachment' => false, 'width' => 470, 'height' => 260, 'echo' => false ) );
    $caption = get_the_feature_caption();
    if ( !empty( $image ) ) {
    	echo '<div class="img-feature">' . $image ;
    	echo '<div class="feature-caption">' . $caption . '</div></div>';
    }

    Finally, in style.css of my child theme I use the following CSS to display the attribution in the lower right corner of the image — on hover only.

    .img-feature { position:relative; }
    .img-feature .feature-caption { display:none; }
    .img-feature:hover .feature-caption {
    	display:block;
    	position:absolute;
    	bottom:15px;
    	right:0px;
    	opacity:0.5;
    	background-color:#000;
    	padding:4px 8px;
    	color:#fff;
    	text-align:right;
    }
    .feature-caption a {
    	color:#fff;
    }
    .feature-caption a:hover {
    	color:#fff;
    }

    Hopefully this is helpful for others.

    Mark

    (@codeispoetry)

    Nope, it does it mostly the normal way, but the template files where it does it are a bit unexpected. For instance, page-template-front.php has a get_sidebar( 'primary' ) call. The secondary sidebar isn’t called from the same template but from footer.php.

    Something that may throw you off when trying to disable sidebars is the fact that the full-width page template is made to be without sidebars not by excluding the sidebar template calls (as many themes do) but by disabling them for that specific template via functions.php.

    The do_atomic() calls are hooks that you could adress via functions.php to add or filter content. They don’t do the sidebars.

    Mark

    (@codeispoetry)

    1. Set up a child theme.
    2. Place a file named page-template-front.php in your child theme folder.
    3. Put the following code in that file:

    
    
    <?php
    /**
     * Template Name: Front Page
     *
     * Magazine layout with several loop areas and a featured content area (slider). This template must be manually set for a page. Then the same page can be set as a Front page from Settings -> Reading -> Front page displays -> A static page.
     *
     * @package Oxygen
     * @subpackage Template
     */
    
    get_header(); // Loads the header.php template. ?>
    
    	<?php get_template_part( 'featured-content' ); // Loads the featured-content.php template. ?>
    
    	<div class="aside">
    
    		<?php get_template_part( 'menu', 'secondary' ); // Loads the menu-secondary.php template.  ?>
    
    		<?php get_sidebar( 'primary' ); // Loads the sidebar-primary.php template. ?>
    
    	</div>
    
    	<?php do_atomic( 'before_content' ); // oxygen_before_content ?>
    
    	<div class="content-wrap">
    
    		<div id="content">		
    
    			<?php do_atomic( 'open_content' ); // oxygen_open_content ?>
    
    			<div class="hfeed">
    
    				<h4 class="section-title">Links</h4>
    
    				<?php get_links(); ?>
    
    			</div><!-- .hfeed -->
    
    			<?php do_atomic( 'close_content' ); // oxygen_close_content ?>
    
    		</div><!-- #content -->
    
    		<?php do_atomic( 'after_content' ); // oxygen_after_content ?>
    
    <?php get_footer(); // Loads the footer.php template. ?>

    4. That gives you the default “Links” output. You can modify how links are placed there using the instructions found here.

    Thread Starter Mark

    (@codeispoetry)

    Great, looking forward to that!

    Here are some ideas to make the corporate layout useful and easy to setup with pages.

    1. Provide the flexibility to have two, three or four content blocks. (Five seems too much for the nicely designed icons, but two and four would be nice to have as options besides the current three.)

    2. Don’t let the user set content and images from the theme settings page. This leads to theme lock-in (meaning it becomes hard to switch themes, which isn’t user friendly) but worse, it doesn’t use the powerful built-in features of WP.

    3. Following from #2, populate the corporate content blocks with content from existing pages the user chooses: Either the full page content or the_excerpt if set. For the icons, take the featured images of the pages. The user already knows their way around the edit windows and can easily change the text and the icon images.

    Mark

    (@codeispoetry)

    By the way, Co-Authors Plus is fantastic. I’ve switched from Custom Author Byline and I’m not going back. The guest author bylines feature is very useful and using the above tweak I can get it to work with Hybrid-based themes.

    The problem still remains that one has to edit Hybrid core files to make it work, due (apparently) to the Co-Authors Plus filters not being applied to all author-related function calls. (See my question above about “appropriate template tags”.)

    Mark

    (@codeispoetry)

    I can confirm it is solved in the latest version. Thank you.

    Mark

    (@codeispoetry)

    This is my question too. How is this topic ‘resolved’? I haven’t been able to find an answer.

    Mark

    (@codeispoetry)

    I can confirm this same problem still exists on WordPress 3.5 and php 5.4. For a plugin that is advertised as requiring php 5, this is a bit surprising.

    Mark

    (@codeispoetry)

    You seem to want to replace the primary menu (which isn’t so much “located on the server” as edited and set via the “Menus” settings page) by a automatically generated list of categories.

    Probably the easiest way is to use a function like wp_list_categories() to generate a list of categories, which you can then style like the secondary menu by copying the css for the menu from the Oxygen theme and adjusting it to your needs.

    You would place this function in a child theme in a copy of the the menu-primary.php template file.

    Mark

    (@codeispoetry)

    Aldouslzl, please start your own thread instead of reviving an existing one on an unrelated topic.

    In general, what you would do is (1) create a child theme, (2) locate the template file that generates whatever you are trying to remove, (3) place a copy of that template file in your child theme, and (4) edit that template file so that it doesn’t generate whatever you don’t want it to generate.

    If you mean “articles” instead of comments, here are some directions you can follow.

    Mark

    (@codeispoetry)

    Pretty much anything is possible. But for us to be of any help you need to provide more details on what you want precisely and on the modifications that you did try to make.

    Do you want to change the width on all pages? Homepage only? Single posts? With or without sidebar? You need to be this specific because style.css sets the width for all these elements and you can change all of these individually.

    Mark

    (@codeispoetry)

    What version of WordPress? This is not an error that should normally be caused by the theme. Try re-uploading or re-installing it.

    Mark

    (@codeispoetry)

    I’m not sure chrisneylan’s reply really answers the question. Here is the most forward-compatible way to do this:

    1. Make an Oxygen child theme by creating a new theme folder (your-theme) and creating a style.css file in that folder with the following content:

    /*
    Theme Name: Oxygen child theme
    Author: Your Name
    Template: oxygen
    */
    
    @import url("../oxygen/style.css");

    2. Copy the file page-template-front.php from the Oxygen theme folder into your new child theme.

    3. Modify the page-template-front.php file in your child theme to delete the two custom loops that are responsible for pulling out “Recent articles” and “More articles”.

    The brute way to do this is to remove all of the code that appears between the following two lines:

    <?php do_atomic( 'open_content' ); // oxygen_open_content ?>
    [remove everything in between here, lines 24-131]
    <?php do_atomic( 'close_content' ); // oxygen_close_content ?>

    CSS-only alternative

    Alternatively, if you don’t care that posts are loaded and HTML is produced, you can simply hide it using CSS. Follow step 1 above and then add the following line to the child theme’s style.css:

    .page-template-front #content { display:none }

    I don’t recommend this approach as it just hides the posts instead of not loading them in the first place, but it does work.

    Mark

    (@codeispoetry)

    Sorry, I wasn’t very clear. This is not just the Oxygen theme. Oxygen is one of many themes based on the Hybrid core by Justin Tadlock, a highly respected plugin author and theme developer.

    From the Co-Authors Plus page:

    And, if your theme is using the appropriate template tags, you can create guest bylines without any additional configuration.

    What are “the appropriate template tags”? If a theme uses get_the_author_meta( 'display_name' ) and get_author_posts_url( get_the_author_meta( 'ID' ), will it work? If not, could Co-Authors Plus be made to filter those functions too? Or do you think it is the theme’s business to check for the presence of Co-Authors Plus?

    Mark

    (@codeispoetry)

    Thanks, I will investigate that option. (The main reason we went for the simpler Custom Author Byline plugin is that that quite a few authors on our website are one-offs and we don’t necessarily want to go through the trouble of creating co-authors for them.)

    The problem then remains though: how would you use the fix you describe above in a child theme, without modifying any parent theme files? I’ve tried redeclaring the relevant functions and shortcodes in my child theme’s functions.php, but I suspect I’m running into issues with the priorities and phases of adding actions and removing shortcodes. Getting out of my depth there.

    The best solution for broad compatibility would be if the Hybrid [entry-author] shortcode could be made to refer to a redefined or enhanced entry-author-shortcode function, but I’m still not sure how to accomplish that in a child theme.

Viewing 15 replies - 151 through 165 (of 268 total)