so I turn to you guys to help me see what I am doing wrong here.
First thing your doing wrong is over complicating a simple effective API.
Your code makes no sense. Your mixing functions that echo output with arbitrary html mark up that gets assigned to a non existing class property that nothing is ever done with.
Your trying to OOP something that you have written as procedural. Just use a variable that lives inside the method and either return it or echo it and be done. And while your at it use the WordPress functions that return the values instead of printing them and assign to this same variable.
The only reason to use protected properties are for class extensibility and building objects. Your just running the loop.
Related Posts:
- Guidance with The Loop for CMS
- How can I loop into two different DIVS without repeating the DIVs
- WordPress loop specific thumbnail size
- Use object in template part
- Syntax error when I try to insert my loop into an unordered list? [closed]
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Why in my theme I can’t see all the statics content under the posts?
- Get all posts as an array ID => Name
- home.php show blog posts as grid view
- Get options from database using php class
- Search.php gets metadata from first post
- Check if current post in loop is last on current page
- Looping through dummy posts and showing them in the main index.php
- Proper use of Output Buffer for a whole php clas
- Problems with the WordPress loop [closed]
- WP Knowledge Base Theme bug – Subcategories and Articles, Need to change WP_Query
- Trying to display ads on only a third of posts in a loop. Keep getting Error 500?
- Pagination not working properly
- add_action in namespace not working
- Conditionally loading JavaScript based on the Advanced Custom Fields in the post
- reason of splitting theme files to multiple files
- How to add active class to custom menu using while loop and wp_list_pages
- Print html when custom field has value inside while loop
- Use different javascript files for each page on website
- How to get custom image size for image uploaded in Customizer
- do not show web page section when using advanced custom fields pro
- How to do conditional publishing?
- Switching between custom templates in a post type of the admin menu
- How do I display the function the_content in this loop?
- How to get to a specific position in wp_query?
- Facebook “like” open graph meta in header.php
- Custom category code not showing all posts
- How do I get current page ID in WordPress customizer file?
- Customizer: Output default value in Customizer CSS
- WordPress does not load page.php, return 404.php
- Using foreach loop breaks
- Add child pages of parent to navbar PHP
- Converting HTML Template to WordPress Theme
- How to use my style.css file outside of wordpress subdomain?
- How to remove the cufon script from Dzonia Lite theme [closed]
- Loop with slider (slider not loading)
- How to hide all child pages with post_query?
- How to sort posts based on the value (number) of a post’s metadata?
- Add_action not working in required file of functions.php
- How to set up VS Code for WP plugin/theme development in 2021? [closed]
- Improve page speed loading using CDN and async or defer attribute
- Displaying Woocommerce Product Category in WordPress
- How can I add extra word in permalink when someone click download button?
- Woocommerce : Can’t get product info in loop
- Populate editor with some content of a page with a page template
- Skt full width basic slideshow problem
- get_template_part for specific page
- How do I create my own .php file with a code part and echo it on different pages?
- Can we count the WordPress Loop
- get_template_part() not firing within a switch statement when template has new WP_Query
- How to call multiple functions from multiple files into a WordPress page template [closed]
- Need oop for wordpress theme? [duplicate]
- Last class on last headline?
- What is the best way to define constant options for a theme?
- Warning: printf(): Too few arguments in helpers.php file
- Cant register rest routs from class instance
- Help Fallback (thumbnail)
- Echoing a CSS class based on category of post in a list
- get_page_templates only return templates with “home” in the filename
- Class property seems to lose scope, attached to save_post action?
- Show different website layout if no sidebar added
- Php code error in wordpress if else statements [closed]
- Need advice on theme customizer and child themes
- How to make sure relative URL works when site is not on root domain?
- pagination broken – clicking next displays “page not found”
- How do you remove header sitewide from mobile only?
- PHP inside echo HTML
- Call to “admin_notices” hook from a static method
- How do I get pagination for get_posts() in WordPress or do I have to rewrite the whole code?
- How to change PHP variables with AJAX request in WordPress
- is_user_logged_in returns false when I access certain pages
- REST API custom endpoint to fetch pages and posts not working
- Exclude category from woocommerce product category list
- Trying to get pagination working on WP_Query() post grid
- Custom Post Type has wrong label and is not found when called by a loop
- How to add typehints to function in functions.php when argument is an object?
- adding or removing endforeach; throws error!
- Fix hover images blink
- Adding PHP to an if else loop
- Filter loop by ‘price’ with meta_query
- How to add Open/Close Toggle button into Twenty Fifteen theme for hiding left sidebar?
- How to replace hard-coded list of custom taxonomy terms based on custom field query [closed]
- WordPress while loop with aphabetic counting like one, two, three
- Calling PHP function doesn’t work in index.php
- Add post class in custom loop (WP_QUERY)
- How to correctly add the featured immage (thumbnails) support in a WP theme? Why I can’t add a featured immage?
- I want my wordpress loop to only display posts of the standard format
- Automatically create a loop for post ID
- why is this content-template not showing any of my blog-entries?
- Listing current pages subp page in list items in the sidebar
- How to call the_author_meta and make it work?
- Add CSS class to PHP Statement
- Load slideshow.css file only if Slideshow is checked / on
- Excerpt all post content Content Same Size without word cutting off
- Headers already sent error with get_template_part in REST API call