djb21au 0 Report post Posted March 16, 2011 I want to remove the post link from the title text on a post. I know how to do this normally by changing the permalink code in index.php, but can't work out where to find the equivalent in PlatformPro. Assume it has something to do with the pagelines_get_post_title() function, but can't find the actual function. Guidance please. Share this post Link to post Share on other sites
cmunns 16 Report post Posted March 16, 2011 You would apply a filter to the function to remove the link output portion of it. but regardless when I look at the function in the core files it shouldn't have a link on the single pages anyway. Share this post Link to post Share on other sites
djb21au 0 Report post Posted March 16, 2011 Thanks Adam. I actually want to remove the link from the blog page, not the single posts, as the blog page version is exactly the same as the single post (it's a photo blog). Can you give me a hint as to the filter I would need ??“ or at least how I target the piece of code to filter out? Share this post Link to post Share on other sites
cmunns 16 Report post Posted March 16, 2011 Well here is the function ` function pagelines_get_post_title( $format = '' ){ if ( is_singular() ) { $title = sprintf( '%s', apply_filters( 'pagelines_post_title_text', get_the_title() ) ); } elseif( $format == 'clip'){ $title = sprintf( '%s', get_permalink(), the_title_attribute('echo=0'), apply_filters( 'pagelines_post_title_text', get_the_title() ) ); } else { $title = sprintf( '%s', get_permalink(), the_title_attribute('echo=0'), apply_filters( 'pagelines_post_title_text', get_the_title() ) ); } echo apply_filters('pagelines_post_title_output', $title) . "n"; } ` you see the filter there at the end to use? Do you know how to use filters? Share this post Link to post Share on other sites
djb21au 0 Report post Posted March 16, 2011 No, but I'm happy to learn if you can point me to a good resource. I have used hooks so understand the general idea. Share this post Link to post Share on other sites
bryan-hadaway 3 Report post Posted March 17, 2011 Please wait for further help from Adam. Thanks, Bryan Share this post Link to post Share on other sites
cmunns 16 Report post Posted March 17, 2011 Not sure what the best article would be, but this one seems easier to understand. http://www.raymondselda.com/understanding-filter-hooks-in-wordpress/ You usually also have to return the content of the function back at the end. Can provide more assistance if necessary. Share this post Link to post Share on other sites
djb21au 0 Report post Posted March 17, 2011 Thanks. That article was pretty good. I've had a play but I'm missing something (this will demonstrate my limited knowledge). I've added the following code to functions.php: function pagelines_post_title_nolink() {?> {$title = sprintf( '<h2 class="entry-title">%s</h2>', apply_filters( 'pagelines_post_title_text', get_the_title() ) ;} echo apply_filters('pagelines_post_title_nolink', $title) . "n"; <?php } add_filter('pagelines_post_title_output','pagelines_post_title_nolink'); I've tried a few things but whatever I put into the function just gets returned literally (see www.streetsofmytown.net to see what I mean) I also tried just using a div within the function (as per the example on the tutorial) but it just comes back blank ??“ I'm not sure how to define and call the 'post title' variable. Share this post Link to post Share on other sites
bryan-hadaway 3 Report post Posted March 18, 2011 Please await further developer help. Thanks, Bryan Share this post Link to post Share on other sites
djb21au 0 Report post Posted March 18, 2011 I've managed to find something that works, though I don't know if it is the most efficient approach: ` function pagelines_post_title_nolink() { $titlenl = get_the_title(); return $titlenl; } add_filter('pagelines_post_title_output','pagelines_post_title_nolink'); ` If there's a better way I'd be happy to be told. Share this post Link to post Share on other sites
djb21au 0 Report post Posted March 18, 2011 A problem I've noticed with my solution above is that there doesn't seem to be a class applied to the returned text, so I can't change its format. EDIT: Found the class: post-title Share this post Link to post Share on other sites
Simon 248 Report post Posted March 18, 2011 Always better to use built in filters. `add_filter ( 'pagelines_post_title_output', 'wp_strip_all_tags');` And one liners are cool Share this post Link to post Share on other sites
djb21au 0 Report post Posted March 18, 2011 Thanks Simon - an elegant solution. I browsed numerous WP forums and no-one mentioned that wp function. Share this post Link to post Share on other sites