I'm new to WP and trying to configure the 'My Account' page on a WP site. The site uses the Paid Memberships Pro (PMP) plugin. In the WP admin console > Pages, there is a page called 'My Account'. The content of the page is '[pmpro_account]', which is the shortcode for the PMP account page. From what I can tell, the shortcode is ultimately rendered by the pmpro_account.php page. However, the code on that page does not match what you see when you browse to the page. After more digging, I noticed the page uses a template, called 'My Account':
I found the template (myaccount-page.php), which just does this:
get_template_part( 'loop', 'myaccount' );
then found the loop page (loop-myaccount.php), which just does this:
...
<?php the_content(); ?>
...
After searching all of the files, I found an account.php, which contains the actual content that I see when browsing to the page. How did WordPress know to render this page? How does WP determine what gets generated when there is page, a shortcode and a template?
I'm new to WP and trying to configure the 'My Account' page on a WP site. The site uses the Paid Memberships Pro (PMP) plugin. In the WP admin console > Pages, there is a page called 'My Account'. The content of the page is '[pmpro_account]', which is the shortcode for the PMP account page. From what I can tell, the shortcode is ultimately rendered by the pmpro_account.php page. However, the code on that page does not match what you see when you browse to the page. After more digging, I noticed the page uses a template, called 'My Account':
I found the template (myaccount-page.php), which just does this:
get_template_part( 'loop', 'myaccount' );
then found the loop page (loop-myaccount.php), which just does this:
...
<?php the_content(); ?>
...
After searching all of the files, I found an account.php, which contains the actual content that I see when browsing to the page. How did WordPress know to render this page? How does WP determine what gets generated when there is page, a shortcode and a template?
Share Improve this question edited Jan 23, 2019 at 22:13 Glorfindel 6113 gold badges10 silver badges18 bronze badges asked Aug 30, 2015 at 20:50 rycornellrycornell 1012 bronze badges 2- 1 the_content() call the content of the page => "[pmpro_account]" => the shortcode is replaced by is content => the file account.php – mmm Commented Aug 30, 2015 at 21:16
- @mmm What do you mean by "the shortcode is replaced by is content => the file account.php" ? – rycornell Commented Aug 30, 2015 at 21:29
1 Answer
Reset to default 2Nice sleuthing. Every single person on this SO site has been foiled by something exactly like this at one point or another with the WordPress template hierarchy.
You might think of this backwards though. All the steps you found lead you back to the shortcode [pmpro_account]
which gets output in the loop-myaccount.php
by way of the_content()
.
That shortcode is defined in their code base like this:
add_shortcode('pmpro_account', 'pmpro_shortcode_account');
That's telling WordPress: when you sees the [pmpro_account]
shortcode, run the function called pmpro_shortcode_account
. In that same file, up at the top, is a function called pmpro_shortcode_account()
. That function has all of the HTML and logic in it.
It doesn't look like they have a way to overwrite that code via filter but I've never used the plugin so I can't say for sure. They have a list of all of the available hooks and filters in their docs.
If worse comes to worse and you need to change the HTML output. you could remove the shortcode call from the editor and try replicate the functionality of pmpro_shortcode_account()
within your loop-myaccount.php
template.