I’m not really sure what you’re trying to achieve with the is_page
parts – maybe I’m missing something – but what if you’d just write:
if (is_user_logged_in()) {
$my_account = "My Account";
echo ($my_account);
} else {
$login = "Login/Sign Up";
echo ($login);
}
return
just returns the variables for use in your code, echo
prints them to the HTML
Related Posts:
- Remove Container Element From wp_nav_menu() Markup
- Breadcrumbs showing Parent and Child Pages
- Return only top-level navigation items from a menu using wp_get_nav_menu_items
- Menu fallback “menu_class” rendering a “div” instead of a “ul”
- How do I create page navigation linking to each H2 within the page? [closed]
- Custom Static Links For Specific Menu Right Before/Next The wp_nav_menu Function now working
- Hard-coding custom menu elements for menu manager
- Categories as main menu items and subcategories as nested lists
- retrieves menu and converts it to a readable array
- Secondary Menu and Logged In Users
- Default Nav Highlight
- Multiple navigation menu in same location
- Bizarre Child Menu Issue on WP Site
- Header menu aligned right on all pages except for single-post page [closed]
- How to automatically add counted number to navigation menu items?
- How to add widget in main menu
- Move Custom Fields on General Settings Page to New Location
- Detecting classes, adding widgets, and adding divs in with a Nav Walker
- How to get correct URLs in network wide menu (Multisite)?
- Skeleton Child Theme Add Icon Bar to Header Flex Grid
- Help with walker for nav
- Using my WordPress menu on another platform
- Removing specific menu items?
- Redirect to another page using contact form 7? [closed]
- append to existing parent theme function
- Using _s theme, menu changes do not affect header menu
- different style sheet for just one page template
- Custom Post Type & Custom Menu Walker to append custom class for active post types
- Condition OR for current user ID
- How to retrieve the current post’s generated featured image size?
- disable Tab post on nav-menus page (Admin)
- How do I hook into the container of wp_nav_menu?
- Custom Behavior when Adding New Custom Post Type in Dashboard
- Where do I store custom functions that call custom page template files?
- Why There Is No “get content by ID” Function
- Add login hyperlink to secondary navigation menu
- Sticky menu for WP custom menubars
- Custom HTML markup
- Use a shortcode to display custom meta box contents
- New custom menu created. how to apply it?
- Dropline menus — seperators between children only?
- Filter nav menu items HTML tags and wrap inner text with span
- Wp-query Order By problem
- Create custom function for hero image
- Functions php shortcode for displaying main menu with no child items
- Randomizing wp_tag_cloud() in child theme
- Nav menus all outputting the same links
- Change menu based on page template via functions.php
- login_headertitle is deprecated since version 5.2.0
- Show some menu sub items as dropdown under a menu item
- How to append classname to body tag if guest user
- Where do I go to edit this area? [closed]
- How to add custom li item to wordpress menu
- Replace plugin function with a custom function?
- Add attribute only to first image of every post via functions.php
- Add Login/Logout Menu Item to Primary Nav “My Account” Submenu [Woocommerce] [closed]
- Different favicon on different pages
- The_content and Preg_replace in loaded Iframe [closed]
- why is this function firing on all child menu items as well?
- Position a hard-coded menu item
- Different methods of adding menu support to custom theme
- Adding a section in line at the end of the main navigation menu in php
- Problem with images URL after filter applying
- two search forms on the same page
- Function to replace comment’s accented characters before posting
- wp_nav_menu work in functions.php but not in the theme
- How to register a menu based on a ACF condition
- How to hightlight all ancestor menu items of a child page NOT displayed in menu
- Nav-Menu not showing up
- How to add active state to the navigation links?
- Insert a field with PREG_REPLACE – strange behaviour
- How to echo Widget Title in Custom Frontend-Template Box
- New checkbox in custom widget isn’t saving data
- Linking Javascript in functions.php file
- current_page_item is missing inside wp_nav_menu
- how to display a page before the home page
- search form leads to 404
- loginout function customization
- Unable to add extra elements to the main navi (wp_nav_menu_items)
- How Can I add a menu to the theme from withen the function.php file
- define css class in functions.php
- Custom Menu in Admin doesn’t change menu in browser
- Function to check if custom page is used by page?
- implementing a centralized content “show-do-not-show” toggle?
- Conditional custom menu?
- How to display this meta data (an array) in form of a function (created with a custom write panel)?
- WordPress – using sessions?
- Customize Widget Navigation
- wp_nav_menu displaying all pages
- Warning at top of website & top menu gone
- Custom menu not showing even though it shows as being registered?
- How to remove font awesome from loading in wp theme
- How to display an image before title text in menu items
- How to replace ACTION url from original wordpress login form?
- Current menu item highlights wrong
- Save_post – Warning: Cannot modify header information
- How to use WP conditional tag in a functions.php with OCEANWP Theme?
- Modifying a WordPress Plugin
- CF7 select value get to function and reciept value from function
- Hide author info in single posts by certain users