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
- How could I prevent using the same custom loop in a template file when I only need to change one meta_query parameter?
- Custom theme on multisite has issues with standard loop output
- Custom theme: Alternatives to long list of ‘include’ in functions.php
- Theme Options Page – User Updates Logo
- Changing layout with wp_customise
- Converting HTML Template to WordPress Theme
- Extending the WP_Widget_Text class
- How to use my style.css file outside of wordpress subdomain?
- How to show part of the_content?
- Dynamic Stylesheet loads but doesn’t finish
- Wp-login appears White Screen, Error: Cannot modify header information
- Filter Select results based on selection
- How to remove the cufon script from Dzonia Lite theme [closed]
- get_the_tags() not iterating through for/while loop, but will with foreach
- Using loop pagination on single.php
- Trying to get property of non-object “ wordpress ”
- 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?
- Show css depending on activity type in BuddyPress activity-loop [closed]
- Hide categories that are not used in the post type
- How do I add custom bulk actions to multiple custom post types?
- Add_action not working in required file of functions.php
- Why my filterable portfolio page work not perfectly between slug button and slug output WORDRPESS?
- How to set up VS Code for WP plugin/theme development in 2021? [closed]
- How to prevent XSS alter custom global javascript object & methods in WordPress
- adding custom user input fields in WordPress admin dashboard gives error The link you followed has expired. Please try again
- what is the best practice to add new field to an api route
- Grab posts by multiple categories
- Can’t access variable outside for loop
- I have a problem in the order of enqueues while enqueuing stylesheets and scripts for a specific page in my function.php
- add custom link to wordpress media gallery modal
- Need Help Fixing My Iframes [closed]
- Iterate through posts based on array of categories
- Avoid parallax images hardcoding
- Improve page speed loading using CDN and async or defer attribute
- get author_name from queried post
- Displaying Woocommerce Product Category in WordPress
- populate form fields in a loop with ajax
- How can I add extra word in permalink when someone click download button?
- Error in custom php function doesn’t exist
- Customizer: active_callback and sanitize_callback incompatibility?
- post created but no permalink
- Increase offset while looping
- Blog posts repeat
- How to add condition in wordpress loop? [closed]
- Woocommerce : Can’t get product info in loop
- How to set variable, pass it to a partial file and remove it after?
- how to refresh div on template part?
- Populate editor with some content of a page with a page template
- Two queries for a WP_User_Query search work perfectly apart, but not together
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- Catchable fatal error: Object of class stdClass could not be converted to string after WP 4.7
- Alert Bar section within WP loop is displaying even though there are no posts
- Menu jumping when calling it via PHP
- remove post that has no content
- Display category name only once inside loop
- Displaying recent posts on static page with template-part via shortcode
- How to edit widget code to add unique class name to each div?
- Can’t find infinite loop cause
- Checking array against author id in loop
- How do I Turn This Into An if statement?
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- Skt full width basic slideshow problem
- Load wordpress content in other domain
- How Can I use WP_Query to Only Display 1 Post from Custom Post Type if Query Returns Posts with Matching ID in Custom Field
- Checkbox doesn’t stay checked, conten
- How to disable controls in theme customizer?
- How do I link a button I created in theme customizer to a function?
- Trying to retrieve post meta
- can i fetch a custom metabox data in another page or post type?
- Is there a way to conditionally check whether a WordPress post title is empty?
- Is the “_s” on this `sprintf(__(‘Page %s’, ‘_s’), max($paged, $page))` just refer to a text domain?
- get_template_part for specific page
- How do I create my own .php file with a code part and echo it on different pages?
- post thumbnail, conditions, else wont work
- Widgets in the loop if active
- List posts that don’t have a specific tag?
- Changing the_posts_navigation() html output
- How to remove woocommerce_breadcrumb() from do_action( ‘woocommerce_before_main_content’ ); [closed]
- ‘Post-thumbnails’ feature does not seem to register
- if statement with is_active_sidebar()