WordPress.org

Ready to get started?Download WordPress

Forums

Built-in custom field (9 posts)

  1. RobotHero
    Member
    Posted 10 years ago #

    I'm interested in creating having one custom field that will appear with every post.
    So, I've been trying to modify post.php so that instead of having to make two submissions to post, ('Add Custom Field' and then 'Publish') I can treat the custom field as just another text-box to fill.
    I've already putting it in just the extra code needed to create the form inputs, but there seems to be more to it than that.
    Any comments or pointers? What should I look into?

  2. Miriam
    Member
    Posted 10 years ago #

    Did you find a solution for this? I'm interested in the same thing.

  3. unteins
    Member
    Posted 10 years ago #

    Take a look at my LJ Extras plugin and see if that is what you are looking for (in general)

  4. RobotHero
    Member
    Posted 10 years ago #

    If I could get it to work, it would be. I activated LJ Extras, LJ Mood Icons, and LJ Music, and then I tried a couple of test posts. It wasn't displaying anything, so I printed out the results of get_post_custom()
    Array
    (
    [unt_lj_entry] => Array
    (
    [0] =>
    )
    [unt_lj_journal] => Array
    (
    [0] =>
    )
    [unt_lj_mood] => Array
    (
    [0] =>
    )
    [unt_lj_moodid] => Array
    (
    [0] =>
    )
    [unt_lj_music] => Array
    (
    [0] =>
    )
    [unt_lj_synch] => Array
    (
    [0] =>
    )
    )

    So, while it is creating the keys, it isn't correctly assigning them a value.

  5. unteins
    Member
    Posted 10 years ago #

    Here is the code I use to get my custom data:
    $cur_mood = get_post_custom_values('unt_lj_mood');
    $cur_mood = $cur_mood[0];

  6. RobotHero
    Member
    Posted 10 years ago #

    Okay. I've narrowed down the problem to this:
    $_POST is returning nothing. This could be because the version of PHP I'm running predates the introduction of $_POST.
    I've contacted my host to see if they are interested in updating it, and if not, I will try re-writing your plugin to use $HTTP_POST_VARS.

  7. unteins
    Member
    Posted 10 years ago #

    Ahhhh, yeah $_POST not existing would be the problem, you are probably going to have to rewrite quite a bit if you want to use the HTTP ones. I am impressed that WordPress works at all since I know that it uses $_POST, $_GET and so on all over the place...

  8. RobotHero
    Member
    Posted 10 years ago #

    Well, my host says they are using version 4.3.7, and $_POST was introduced in version 4.1.0. Plus, some of the WordPress core files use $_POST, and it hasn't caused me trouble before. So that's shouldn't be the problem.

  9. ile
    Member
    Posted 9 years ago #

    I cant activate plugin. This is error: Warning: get_lj_login_data(): Unable to access ../wp-includes/class-IXR.php in c:\Domains\ibs-nekretnine.hr\wwwroot\wordpress\wp-content\plugins\ljextras.php on line 89
    Warning: get_lj_login_data(../wp-includes/class-IXR.php): failed to open stream: No such file or directory in c:\Domains\ibs-nekretnine.hr\wwwroot\wordpress\wp-content\plugins\ljextras.php on line 89
    Fatal error: get_lj_login_data(): Failed opening required '../wp-includes/class-IXR.php' (include_path='.;c:\php4\pear') in c:\Domains\ibs-nekretnine.hr\wwwroot\wordpress\wp-content\plugins\ljextras.php on line 89

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.