Forum Replies Created
-
AuthorPosts
-
bluenavy
ParticipantI found this code to remove the url but not to amend it
//* Remove the link from each post title - WORKING add_filter( 'genesis_post_title_output', 'ytn_post_title_output', 15 ); function ytn_post_title_output( $title ) { $title = sprintf( '<h2 class="entry-title">%s</h2> ', apply_filters( 'genesis_post_title_text', get_the_title() ) ); return $title; }
bluenavy
ParticipantI have tried to fix this for 3 days but I just can't figure it out :0(
Somebody put an old dog out of his misery
bluenavy
Participantbluenavy
Participantdone
bluenavy
ParticipantThankyou for your response.
Is this something you could code on a developer basis ( for a fee of course )
If so, please let me know and length of time to create.
Many Thanks
bluenavy
ParticipantThanks for the link, but have absolutely no idea what to do with that LOL
function get_term_link( $term, $taxonomy = '' ) { global $wp_rewrite; if ( !is_object($term) ) { if ( is_int( $term ) ) { $term = get_term( $term, $taxonomy ); } else { $term = get_term_by( 'slug', $term, $taxonomy ); } } if ( !is_object($term) ) $term = new WP_Error( 'invalid_term', __( 'Empty Term.' ) ); if ( is_wp_error( $term ) ) return $term; $taxonomy = $term->taxonomy; $termlink = $wp_rewrite->get_extra_permastruct($taxonomy); /** * Filters the permalink structure for a terms before token replacement occurs. * * @since 4.9.0 * * @param string $termlink The permalink structure for the term's taxonomy. * @param WP_Term $term The term object. */ $termlink = apply_filters( 'pre_term_link', $termlink, $term ); $slug = $term->slug; $t = get_taxonomy($taxonomy); if ( empty($termlink) ) { if ( 'category' == $taxonomy ) $termlink = '?cat=' . $term->term_id; elseif ( $t->query_var ) $termlink = "?$t->query_var=$slug"; else $termlink = "?taxonomy=$taxonomy&term=$slug"; $termlink = home_url($termlink); } else { if ( $t->rewrite['hierarchical'] ) { $hierarchical_slugs = array(); $ancestors = get_ancestors( $term->term_id, $taxonomy, 'taxonomy' ); foreach ( (array)$ancestors as $ancestor ) { $ancestor_term = get_term($ancestor, $taxonomy); $hierarchical_slugs[] = $ancestor_term->slug; } $hierarchical_slugs = array_reverse($hierarchical_slugs); $hierarchical_slugs[] = $slug; $termlink = str_replace("%$taxonomy%", implode('/', $hierarchical_slugs), $termlink); } else { $termlink = str_replace("%$taxonomy%", $slug, $termlink); } $termlink = home_url( user_trailingslashit($termlink, 'category') ); } // Back Compat filters. if ( 'post_tag' == $taxonomy ) { /** * Filters the tag link. * * @since 2.3.0 * @deprecated 2.5.0 Use 'term_link' instead. * * @param string $termlink Tag link URL. * @param int $term_id Term ID. */ $termlink = apply_filters( 'tag_link', $termlink, $term->term_id ); } elseif ( 'category' == $taxonomy ) { /** * Filters the category link. * * @since 1.5.0 * @deprecated 2.5.0 Use 'term_link' instead. * * @param string $termlink Category link URL. * @param int $term_id Term ID. */ $termlink = apply_filters( 'category_link', $termlink, $term->term_id ); } /** * Filters the term link. * * @since 2.5.0 * * @param string $termlink Term link URL. * @param object $term Term object. * @param string $taxonomy Taxonomy slug. */ return apply_filters( 'term_link', $termlink, $term, $taxonomy ); }
bluenavy
ParticipantThanks for the response.
What I meant was that I was trying to make the shortlink just replicate the shortlink url, the issue i am facing is that if I have 2, 3, 5, 11, 20 or 30 pages, if i just put a generic text in ( 'Your link text here' ) then it will be the same for all pages and I wanted the individual shortlink to be replicated in text.
With regards to using a different function, for the lack of trying I did try to glean some info online but was a tad overwhelmed with the jargon.
Do you have nay ideas on a simple way to get the tag archive permalink ?
The hook ( I hope that is the correct phrase ) is correct and the shortlink displays where it should be.
Is this the bit which defines the post type
if ( is_tag() ) {
I could live with just putting a generic ( 'Aortic Deviation' ) in the that field and its just the shortlink being based on the tag archive permalink that is really throwing me ;(
bluenavy
ParticipantThat works a treat just two little niggles which may be an easy one for you to assist.
I am using the below code from your site - https://wpsites.net/web-design/add-shortlink-anywhere-in-genesis/
Great resource and bookmarked !
add_action( 'genesis_after_post_content', 'add_wp_get_shortlink' ); function add_wp_get_shortlink() { printf( '<a href="%s">' . __( 'Your link text here' ) . '</a>', __( wp_get_shortlink() ) ); }
It outputs the shortlink at the bottom of the page as needed ( Thankyou !! )
Is their a way I can tweak the ( 'Your link text here' ) code to change the outputted text to the shortlink ie https://myshortlinkonthesceenatthebottom.com/wootwoot
Secondly the shortlink is being generated to the post permalink as opposed to the permalink of the actual tag archive page.
Is their a way to tweak that so the shortlink generated is strictly based on the tag archive page permalink ?
If it helps my permalink structure is based on /%category%/%postname%/ and my tag base is 'aortic aneurysms'
Thankyou so much in advance and I apologise for my incorrect terminology or if I am not as fluent in the code language.
Thanks
bluenavy
Participantyes sorry for my bad terminology ::embarrassed::
Ideally i would like to add something to that code so it all outputs the same
Sorry for the confusion
bluenavy
Participant@VictorFont
Hi Victor - I have created a post and have added 5 tags to the post.
This has generated 5 tag posts that have their own individual permalinks.
I have used the case i posted to get wordpress to put a shortlink under the content but it has just worked on the 1 post and not for the tag posts.
I presume the code to get it to work on the post is not directed at tag posts and I just wanted to know what I would target to get a shorter to be outputted to all the tag posts ?
The code currently reads
add_filter( "the_content", "astp_add_shortlink", 11 );
would the below suffice ?
add_filter( "genesis_after_post_content", "astp_add_shortlink", 11 );
or is their a filter that would enable me to enable a shortlink to be displayed at the bottom of all tags, posts or pages or any other post taxonomy ?
Thanks
bluenavy
Participant@VictorFont
Hi Victor - I have a post and have added 5 tags to the post.
This has generated 5 tag posts that have their own individual permalinks.
I have used the case i posted to get wordpress to put a shortlink under the content but it has just worked on the 1 post and not for the tag posts.
I presume the code to get it to work on the post is not directed at tag posts and I just wanted to know what I would target to get a shorter to be outputted to all the tag posts ?
The code currently reads
add_filter( "the_content", "astp_add_shortlink", 11 );
would the below suffice ?
add_filter( "genesis_after_post_content", "astp_add_shortlink", 11 );
or is their a filter that would enable me to enable a shortlink to be displayed at the bottom of all tags, posts or pages or any other post taxonomy ?
Thanks
bluenavy
Participantits local dev site - its just a normal tag post.
-
AuthorPosts