Assuming you know that there will always be two words separated by a space, you can use explode. Something like this:
$pieces = explode(" ", get_the_title());
$word1 = $pieces[0];
$word2 = $pieces[1];
$output .= '<li><a href="'.get_permalink().'" class="'.$page_id->post_name.'-link"><div class="'.$page_id->post_name.'-info"><h2>'.$word1.'</h2><div class="'.$page_id->post_name.'-img">'.get_the_post_thumbnail($page->ID,'icons').'</div><h2>'.$word2.'</h2></div></a></li>';
Related Posts:
- Show modified time if post is actually modified
- AJAX handler throws 400 (Bad request) – why?
- How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?
- Most elegant way to enqueue scripts in function.php with foreach loop
- WordPress – thumbnail image from youtube (function and loop)
- Adding WooCommerce to a Custom Theme – not working [closed]
- A snippet after every image
- Function to show only first instance of shortcode
- Automatically insert php function into post $the_content
- Creating loop within functions.php
- Display WooCommerce subscriptions for user [closed]
- How to use max and min values of custom fields
- Custom Shortcode, functions PHP WP_Query loop
- Filtering posts by category name based on page’s slug
- 2 Loops, Only Displaying 1 Loop in Both Loops
- Having a Function Inside of the Loop
- Getting different functions data while using while loop in wordpress
- Create a new query in function.php to filter blog posts
- Limit length of first excerpt in the loop
- Default Custom Field Value Automatically Update
- Multiple Loops Meta Data
- Why doesn’t is_page(id) work in functions.php?
- The Loop not looping?
- While loop with an exception after a count is reached
- How do I pull excerpts from pages?
- Output loop to function return?
- issue with if/elseif in_array inside foreach loop display only one post
- Genesis Framework: How to exclude a specific author from archive custom loop
- Problem with calling custom function in a foreach loop
- Get term slug by term id and then explode it
- Using functions.php to include code that’s processed inline
- Simplest Way to Build Custom Archives Page?
- Woocommerce Variable Product Dropdown for Custom Shop Template
- the_date() and the_time() functions display actual date an time instead of published date and time
- How set a while with a function
- Pass post ID from archive template to functions file
- Prevent function from triggering on current page
- How to use `foreach()` in ajax call
- Code executes outside of Loop while same code gives ‘Uninitialized string offset’ notice inside a while loop
- Only seems to be displaying one child when there are supposed to be multiple
- Integrate WP Tiles into existing loop (index.php) and theme
- Check if excerpt is empty at loop-portfolio
- Function to get the name in database table from the comma separated string
- Way of getting queried loop before the query with a filter hook?
- Post variables not displaying correctly in custom function
- Why don’t some template tags work when querying information on single.php?
- how to handle multiple forloop?
- Parse error: syntax error, unexpected ‘endforeach’ (T_ENDFOREACH) in [closed]
- How do grab the main loop, with conditions, and output via shortcodes
- Creating mixture of shortcodes to use in the visual/text editor
- Get full slug for a WordPress Post
- Update post meta with wp cron
- get php variable from functions php and echo it in theme template files [closed]
- Use AJAX in shortcode
- WordPress Theme Update Action?
- Auto close (hide) custom metabox / set default state
- Does WordPress Development Mode Exist (with not minified JS)?
- WP_Query in functions.php
- wp_delete_user with username
- what is the meaning of settings_fields()
- Organize functions.php
- Change labels on ‘Nickname’ and ‘Biographical Info’ in user-edit.php
- Edit the_content function
- write in functions.php
- How to set child post categories to parent post categories when updating parent post?
- get excerpt without images
- display 100 products per page on product category page [closed]
- Help to resolve Syntax error, unexpected ‘endwhile’ (T_ENDWHILE) [closed]
- Removing the first image in content
- Global functions on WPMU
- Remove the deleted users avatar from list
- is_account_page() change to page slug
- Help with WP gallery function, wrap gallery in div
- set_post_thumbnail when user is not logged in
- Force to use STRONG users password and implement rule to prevent REUSE [closed]
- Passing User_Fields to Contact form 7 [duplicate]
- How can this crude function be improved?
- Author Date Function not working as expected [duplicate]
- wp_star_rating() – Adding a 5 star rating system to theme
- How to hide image-url if no attachment?
- How to properly refresh page after form action?
- Default Nav Highlight
- WordPress Website with Login system
- Return link pages instead of displaying them
- Adding Read More to Custom excerpts
- Replace theme function
- How to access custom class methods from any include without using global
- More than one search results page template for two searches on site
- How do i create a search option for pdf’s only
- What is best practices to move the following code into a function?
- Return ACF Field value function
- Best way to add image to recent posts widget?
- wp_enqueue_script only works outside of action
- Get Value of Custom Field
- Undefined offset: 2
- How to Delete Posts by title?
- Display function from functions.php in tag.php
- AJAX values converted to PHP Variables?
- Different ads on every website on multisite environment
- How to get variable from other function inside class function using add_action for Ajax call