kuma  DK
kuma DK

Reputation: 1861

finding wordpress function location

I'm a little bit new to WordPress. Recently I developed a WordPress website using V magazine-Lite theme and working on customizing the theme.

In the template files, I found out that it is calling a function called "vmagazine_lite_before_body_content" which is not defined any of the template files (I did a file content search)

<?php do_action( 'vmagazine_lite_before_body_content' ); ?>

Where I'd be able to find this function.

Upvotes: 1

Views: 66

Answers (1)

CK MacLeod
CK MacLeod

Reputation: 1042

You can think of the "do_action" function as not "calling" the function, but as establishing it - or, more properly, creating the action hook. You won't find it anywhere else (usually) because this will (typically) be the unique position for that hook.

You can create a new function or functions to initiate when that hook is encountered, like so:

add_action( 'vmagazine_lite_before_body_content', 'woah_nelly_that_there_content' ) ; 

function woah_nelly_that_there_content() {

   echo 'Woah, Nelly!' ;

}

So that'll place "Woah, Nelly!" presumably before the body content in V Magazine Lite, however V Magazine Lite defines it.

Wordpress Handbook: Actions

Upvotes: 2

Related Questions