Hello guys, Maybe someone can help me. I'm using tradeexpert script in my wordpress blog. To use skimming traffic, I changed the following code in my homepage From: <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"> PHP: To: <a href="/webmasters/out.php?s=100,75,65&u=<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"> PHP: Now I have installed this plugin: https://wordpress.org/plugins/page-links-to/ Screenshot of the plugin: My idea is to use always this code in my posts: <a href="/webmasters/out.php?s=100,75,65&u=<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"> PHP: But when I use a custom URL I want to use the default code: <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"> PHP: Would be great if someone can help me with this Plugin code: https://paste2.org/4Fa60fpe Thank you guys and a good week to all!
Well, you'll need some way to "pick up" that you're using either a modified URL, or the standard permalink. Then you would need to make something akin to: $link = (something to distinguish which one to use, either custom or permalink) ? the_permalink() : custom_url; Code (markup): And then you would just use that $link-variable in the a-tag in the code you have. Since I dunno how the other plugin works, or what kind of interface it uses, that's about as distinctive that I can get.
Hello PoPSiCLe, Thank you for trying to help me. Unfortunately I don't have enough skills to complete your code. Can this file of the plugin help you complete the code? https://paste2.org/4Fa60fpe Thanks!!
I'm close to the solution using this code: add_filter('the_permalink', function( $url ){ if ( get_post_meta( get_the_ID(), '_links_to', true ) === true) { return $url; } else { return '/webmasters/out.php?s=100,75,65&u=' . $url; } }); PHP: But unfortunately all my links are appearing with /webmasters/out.php... Probably the issue is in this code line: if ( get_post_meta( get_the_ID(), '_links_to', true ) === true) { PHP: Plugin code: https://paste2.org/4Fa60fpe Any suggestions? EDIT --------------------------------- Fixed! Just replaced: if ( get_post_meta( get_the_ID(), '_links_to', true ) === true) { PHP: With: $id=get_the_ID(); if ( get_post_meta( $id, '_links_to', true )) { PHP: Thank you anyway