This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Read More buttons

  • Creator
    Topic
  • #2314
    elianab
    Participant

    I have a portfolio showing websites I have designed. I want to do one of two things to the Read More buttons.
    1) How can I hide the Read More buttons after each post in my portfolio?
    2) Is there a way that I can change the text on the Read More button to say “View Site” and have it link to the website that the image represents. There is a way to link the image to a website, so I wonder if I could use that link and put it in a button rather than on the image.

    I think a good feature to add in the options on each post would be to have a check box for
    a) hide the Read More buttons
    b) change the text on the Read More buttons
    c) set the link on the Read More button and/or the image (you already have the option to set it on the image)

    thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #2325
    Jason Bobich
    Keymaster

    Hello,

    There are really so many different ways someone could accomplish these different things. I think adding these kind of options would sort of muck up the simple code that is already there that people have to work with from their Child theme, and make things overall more complicated. What you’re asking sounds pretty specific to what your’re trying to do, which is totally fine; so let’s talk about your options.

    And actually there is already a plugin out there that allows the user to change any text string in the theme, which may interest you: http://wordpress.org/extend/plugins/theme-blvd-string-swap/

    To edit how a post looks in a post grid, you’d simply copy content-grid.php to your Child theme and edit that simple file. — http://dev.themeblvd.com/tutorial/editable-content-files/

    1) How can I hide the Read More buttons after each post in my portfolio?

    You’d simply delete this part in content-grid.php:

    <?php echo themeblvd_button( themeblvd_get_local( 'read_more' ), get_permalink( get_the_ID() ), 'default', '_self', 'small', 'read-more', get_the_title( get_the_ID() )  ); ?>

    2) Is there a way that I can change the text on the Read More button to say “View Site” and have it link to the website that the image represents. There is a way to link the image to a website, so I wonder if I could use that link and put it in a button rather than on the image.

    Or in the themeblvd_button function you could pass in your own display text and your own URL that you collect somehow from the user. Maybe you could do this through a custom field? That’d be one idea.

    <?php echo themeblvd_button( 'My Button Text', get_post_meta( get_the_ID(), 'your_custom_field_id', true ), 'default', '_self', 'small' ); ?>

    Additionally, here are how you could tap into some of the options already there in your Post Options box:

    get_post_meta( get_the_ID(), '_tb_thumb_link', true )
    get_post_meta( get_the_ID(), '_tb_image_link', true )
    get_post_meta( get_the_ID(), '_tb_video_link', true )
    get_post_meta( get_the_ID(), '_tb_external_link', true )
    #3043
    gregfields
    Participant

    Jason,
    I have some custom code in the functions.php file to change the “Read More” button text on specific categories. For two photo gallery categories it is “View”. All was working perfectly. Recently I had to change one of the photo gallery category names due to a typo. Now in some places the “View” text has reverted to “Read more” even after I updated the functions.php code to the new name. It is behaving as if the database did not update.

    On this page the page the button text is displaying properly: sfvedanta.org/category/shanti-ashrama-retreat-photos/

    On these pages it is not displaying correctly: sfvedanta.org/resources/photo-galleries/ (notice how the edited category at bottom is displaying “Read more”) and sfvedanta.org/resources/ (scroll down to Photo Galleries)

    I used the Builder to create the Resources and Photo Galleries page templates. I verified that they are calling the recently edited category.

    Here is the functions.php code:

    //This is the function with conditional tags around the "read more" - 
    // put this at the very top of child theme's functions file
    function themeblvd_blog_content_default( $type ) {
    		if( $type == 'content' ) {
    			// Show full content
    			the_content( themeblvd_get_local('read_more').' &rarr;' );
    		} else {
    			// Show excerpt and read more button
    			the_excerpt();
    			
    			if (is_category(array('lecture-audio','class-audio'))) { 
    			echo '<a href="'.get_permalink( get_the_ID() ).'">Listen &rarr;</a>';
    			}					
    			elseif (is_category(array('memorial-weekend-retreat-photos','shanti-ashrama-retreat-photos'))) { 		    
    		    echo '<a href="'.get_permalink( get_the_ID() ).'">View &rarr;</a>';		
    			}
    			elseif (in_category(array('memorial-weekend-retreat-photos','shanti-ashrama-retreat-photos'))) { 		    
    		    echo '<a href="'.get_permalink( get_the_ID() ).'">View &rarr;</a>';		
    			}									
    			else {	
    			echo '<a href="'.get_permalink( get_the_ID() ).'">Read more &rarr;</a>';
    			}
    		}
    	}	
    /*-------------------------------------------------------*/
    /* Run Theme Blvd framework (required)
    /*-------------------------------------------------------*/
    require_once ( TEMPLATEPATH . '/framework/themeblvd.php' );

    Any insight would be greatly appreciated!
    Greg

    #3051
    Jason Bobich
    Keymaster

    @gregfields

    This doesn’t have anything to do with something not saving to the database. You just need to re-evaluate your conditional statements.

    I used the Builder to create the Resources and Photo Galleries page templates. I verified that they are calling the recently edited category.

    So, if you’re using the builder to create a page, then WordPress’s is_category() would never return true. This conditional will only return true for category archive pages. But just because you include some category in an element of a custom layout, doesn’t mean that this is now a category archive page; I think that’s where the confusion is here with what you’re doing.

    You could check for that specific page the layout is attached to.

    if( is_page( '2026' ) )

    You could check for custom layouts in general:

    if( is_page_template( 'template_builder.php' ) )

    You could check for a custom layout specifically:

    if( themeblvd_config('builder') == 'photo-galleries' )
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.