Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8947363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:44:26+00:00 2026-06-15T12:44:26+00:00

I implemented this code with a wordpress plugin to retrieve a custom field value

  • 0

I implemented this code with a wordpress plugin to retrieve a custom field value and then add a value at the end of a post URL if the custom field value is true.

So for the below example, if the custom field “testme” value is “news”, it should add the $news value at the end of the URL, which is ?fromwhere=news”.
This concept / code worked fine in the plugin I was using, then I tried to apply it inside the main WordPress loop and it does not work. Here is the code I’m using inside the main wordpress loop:

/* entry_title */
if ( !function_exists( 'wpstart_entry_title' ) ) {
    function wpstart_entry_title() {
    $post = get_post($single->ID);
    $newss = get_post_meta($post->ID, $key, TRUE);
                $key = 'testme';
                $news = '?fromwhere=news"';
             if($newss == 'news') {

        if ( is_single() || is_page() ) { ?>
            <h1 class="entry-title"><?php the_title(); ?></h1>
        <?php } elseif (is_404()) { ?>
            <h1 class="entry-title"><?php _e( 'Page not found', 'wpstart' ); ?> - 404</h1>
        <?php } else { ?>
            <h2 class="entry-title"><a href="<?php the_permalink(); ?>'.$news.'" 
title="<?php the_title_attribute( array('before' => esc_attr__( 'Permalink: ',   'wpstart' ), 
'after' => '')); ?>" rel="bookmark">
<?php the_title(); ?></a></h2>
        <?php }

        }
        else { echo '<h2>DID NOT WORK</h2>';
        }
    }
}

All the post titles return “DID NOT WORK”, even those that I set the “testme” custom field to “news”. Why isn’t this working?! 🙁

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:44:27+00:00Added an answer on June 15, 2026 at 12:44 pm

    I simply moved the $newss value so it was below the other key functions.. like so..

    /* entry_title */
    if ( !function_exists( 'wpstart_entry_title' ) ) {
    function wpstart_entry_title() {
    $post = get_post($single->ID);
                $key = 'testme';
                $news = '?fromwhere=news"';
                $newss = get_post_meta($post->ID, $key, TRUE);
                if($newss == 'news') {
                          more code...
    

    This did the trick. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code implemented and I like how straight forward it is because
I implemented this Jquery show/hide code and everything works fine except that the box
I have implemented correctly bump's api, and added this code: - (void) configureBump {
So I got this little piece of code, don't bother the way it's implemented.
I have implemented this code in appDelegate in order to costumize navigation bar back
I have implemented this code in Delphi, it will search for the File or
I have seen many examples of creating a custom titlebar: http://zaman91.wordpress.com/2010/03/16/android-how-to-add-custom-title-bar/ Is there a
Hi I have implemented this code: Button goToRegister = (Button) findViewById(R.id.reg); goToRegister.setOnClickListener(new View.OnClickListener() {
I have implemented this accordions script under What We Do I need to add
I implemented this code: C# Processing Fixed Width Files But since my work PC

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.