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

  • SEARCH
  • Home
  • 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 8344471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:23:06+00:00 2026-06-09T06:23:06+00:00

I am trying to work this function in wordpress theme the way where I

  • 0

I am trying to work this function in wordpress theme the way where I can get value only what I want and not all to gather. I am not much familiar with using array in function so I need you expert help to make it works and I would really appreciate that.

Here is my code

function gallery_artist($arg=null, $arg2=null, $arg3=null){

    global $png_gallery_meta;
    $png_gallery_meta->the_meta();

    $gallery = get_post_meta(get_the_ID(), $png_gallery_meta->get_the_id(), TRUE);

    $gallery_value = $gallery['image_artist'];
    $artist_info = $gallery_value;

    $string = $artist_info;
    $artist = substr($string, 0, stripos($string, "/") );

    // getting first name and last name from user id
    $author_first_name = get_userdata(basename($string))->first_name;

    $author_last_name = get_userdata(basename($string))->last_name;

    $author_full_name = $author_first_name . ' ' . $author_last_name;

    $user_id = '<a href=" ' . get_author_posts_url(basename($string)) . ' " title="more submissions of ' . $author_first_name .' '. $author_last_name . ' " >' . $artist . '</a>';


    $arg = $author_first_name;      
    echo $arg;

    $arg2 = $author_last_name;      
    echo $arg2;

    $arg3 = $user_id;
    echo $arg3;     

}

After than I want to use this function to get any value I want and not unnecessary to render all three to gather. Means if I want only first name than I pass value only for that and it will render only first name so on..

Here how I want to use something. but you can suggest any code and type of function I have no issue.

<?php call_user_func_array('gallery_artist', array('first_name','last_name','artist_id') ) ?>

Big Big thanks to you all..

  • 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-09T06:23:07+00:00Added an answer on June 9, 2026 at 6:23 am

    Try replacing the bottom section with this:

    if(!is_null($arg))
    {
        $arg = $author_first_name;      
        echo $arg;
    }
    
    if(!is_null($arg2))
    {
        $arg2 = $author_last_name;      
        echo $arg2;
    }
    
    if(!is_null($arg3))
    {
        $arg3 = $user_id;
        echo $arg3;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to work out the best way of doing this but not
I'm trying to work this function but I can't. My application hasn't got a
i am trying to work this out is the simplest way, i am a
I am trying to get nivoSlider to work on this site http://fritech.co.uk/ where it
Okay I been trying to work this out but unable too. I have a
I'm trying to work on this website wherein I need to filter the data
I am trying to detetct/work around this bug in RSS elements. That means I
I'm trying for a while to work this out with no success so far
Im trying to understand how class generics work and this bit just doesnt make
I ask this because I am currently trying to work out my own technique,

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.