• Resolved chaseman

    (@chaseman)


    I’m trying to create a wordpress template, the design is finished and now I’m onto the coding part and I’m figuring that it’s kind of messy to learn the WordPress functions.

    The Function Reference section in the documentation seems very underdeveloped, some functions out of that list do not work for me as explained.

    For example the function the_title() works for me, but the function get_the_title() does not work for me, I only get empty space with the latter function. The explanation mentioned of passing the post_id to the function but even if I do that it won’t work.

    There is a page in the documentation for the_exceprt, but the function name itself is not even listed in the reference list. And a lot of other stuff is very unclear and messy.

    I’m wondering how am I supposed to learn all the functions and the correct way of using them, if there’s no reliable resource for it?

    Any suggestions?

Viewing 7 replies - 1 through 7 (of 7 total)
  • esmi

    (@esmi)

    You could try looking at the core code itself.

    Thread Starter chaseman

    (@chaseman)

    Thanks for the answer, when you say “core code” which files exactly do you mean?

    I’ve looked in the files containing the word “function” in the file name which are located in the wp_includes folder, but I couldn’t find the functions I was looking for.

    FOR EXAMPLE:
    Right now I wrote a function which will take a string and shorten it as soon as it passes a max amount of characters. I used the function on the_title(), which didn’t work, but it DID work on get_the_title(), at this point I don’t know why it works on one but not on the other, and it would help if I could have a look at the functions themselves to figure out the answers to my questions.

    I tried to use the same self made function on the category inside The Loop, I applied it to the function call the_category(), which again didn’t work, the string would simply remain the same length. If I apply it on get_the_category() I will get the error that is an array.

    Perhaps I could get cleared most of the confusing issues if I simply can have a look at the functions themselves. So in that sense your suggestion makes sense. Though, I’d appreciate a tip where exactly to look at, as I said I can’t find the right functions in the files I was looking into.

    Thanks.

    GRAQ

    (@graq)

    get_the_title() == the_title(,,false)

    The difference is between a function echo()ing straight to the browser or return the result (for variable assignment or string concatenation).

    HTH

    Thread Starter chaseman

    (@chaseman)

    That makes sense, thanks for letting me know. Do you know in which file I can find the function declaration, so I can have a look at it myself?

    If I would have been able to do that in the first place I probably would have figured it out on my own.

    GRAQ

    (@graq)

    On the codex page there is a Source File section.

    https://codex.www.ads-software.com/Function_Reference/the_title
    https://core.trac.www.ads-software.com/browser/tags/3.1/wp-includes/post-template.php

    It’s not there for all functions, so the best way is to grab a copy of the source code and browse through it yourself.

    Thread Starter chaseman

    (@chaseman)

    That was what I was looking for, thanks, I didn’t realize you could find it in the post-template file.

    GRAQ

    (@graq)

    Glad to help.

    You should mark the topic resolved ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to Learn All the WordPress Functions?’ is closed to new replies.