Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter florryone

    (@florryone)

    yep that worked fine 🙂 many thanks…

    Hi All,

    First of all thanks for the helpful post here.
    I am trying to use custom field to change the ‘read more’ links of my posts on the homepage of my blog to link through to either individual pages or to the post page.

    So far I managed to assign the custom fields value (url) to the link of the post but I cannot get the default value back.

    I guess my main problem is letting $field_value be the_permalink() if there is no value in the custom field with the key link
    Please let me know if you have any idea how to fix this.

    What I have:
    an if statement to determine if there is a custom field:
    if($field_name=”link”){
    $field_value = $field_value = get_post_meta($post->ID, $field_name, true);
    }else {
    $field_value = the_permalink();
    }

    The value of $field_value is being read out in the link:
    “<?php echo $field_value; ?>”

    Thread Starter florryone

    (@florryone)

    Hi Samboll,

    Thanks for the reply. I had look but unfortunately it did not help me getting what I wanted. Perhaps my question was not clear enough.

    What I am looking for is to have the possibility to have posts that either link straight to a page and ones that link to the full post (this is something wordpress automatically does). My guess is to have somekind of php line that checks if there is a use of a custom field for the more links. If so it uses the value as the URL for the ‘more..’ link. If no value is found the ‘more..’ link will go to the standard full post page.As I am not a php expert (far from) I have not a clue how to get this working. I hope this makes more sense.

    Perhaps someone has made a plugin for this or an expert can help me with a line of PHP.

    Thanks,

    F

Viewing 3 replies - 1 through 3 (of 3 total)