0

I need to crease a author block for the wordpress posts in fishpig integration furthermore I need to create an author profile page and recommended posts etc. However inorder to do this I need to access wordpress database values ...Does this extension already reference this data eg:display name post date etc ...are there any other lines of code that reference wordpress data?... like in these lines of code

$post->getPostDate(), $post->getAuthor()->getDisplayName()

or would I have to make a custom query to the database?

4

Under /app/code/community/Fishpig/Wordpress/Model, you should find some files including these fields.

  • Post.php accesses post data
  • User.php accesses author data
  • Term.php accesses category data

From your description, most of the information you're looking for will be in Post.php and User.php


Examples:

From the post view and any other pages with access to the post class, you can use these:

$post->getPostTitle()  // Post's display name
$post->getPostDate()   // Post's date
$post->getAuthor()     // Post's author, allows access to methods in the User.php file
$post->getAuthor()->getFirstName()  // Author's first name from Wordpress
$post->getAuthor()->getGravatarUrl()  // The url to the author's Gravatar image
$post->getParentTerm('category')  // Post's category, allows access to methods in the Term.php file
$post->getParentTerm('category')->getUrl()  // Category's url
$post->getParentTerm('category')->getPostCount()  // Total number of posts in the category

From the user view and any other pages with access to the user class directly, you can use these:

$author->getFirstName()
$author->getGravatarUrl()

From the term / category views and any other pages with access to the term class directly:

$term->getUrl()
$term->getPostCount()
  • thanks for the answer..could you please provide me with an example of how you would use functions in these files, please it would be a massive help. Thanks – Brad Duncan Nov 13 '15 at 14:16
  • Hi Brad, I updated the post to include a few examples. – Ben LeBlanc Nov 18 '15 at 13:57
  • @BenLeBlanc hi have you know how fishpig is working in magento2? – Rutvee Sojitra Aug 24 '18 at 6:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.