• Skip to main content
  • Skip to primary sidebar

Edwin Velez

Just another WordPress site

Set Reading Settings on Theme Activation

March 13, 2019 by Edwin Velez Leave a Comment

Previously I shared a post on how to Set Reading Settings Programmatically. The code below takes it a step further by first creating the required pages, if they do not exist, needed for their respective settings. Thanks to the after_setup_theme() function, the process will run on activation of the theme.

[gist id=”2f6b40a4bd57e0ddbe5da19c4e575f63″]

Filed Under: Code Snippets, WordPress Tagged With: after_setup_theme, Automate, Automation, Programmatically, Reading Settings, Setup Theme, WordPress, WordPress Dashboard

Set Reading Settings with Code

January 11, 2019 by Edwin Velez Leave a Comment

Home Page and Post Page settings can be changed manually in the Reading Settings page of the WP Admin Dashboard. With the code snippet below, you can set reading settings programmatically.

The two variables, $home_page and $blog_page, should match the title of a Page you create in the WP Dashboard.

[gist id=”9e3cfa705fc0fd86852f320e26b386ab”]

Filed Under: Code Snippets, WordPress Tagged With: Automate, Automation, Programmatically, Reading Settings, WordPress, WordPress Dashboard

Compare Two Domain Name Values

January 8, 2019 by Edwin Velez Leave a Comment

The code snippet below compares two domain names. One domain name could point to development environment. The other domain name could be a live site on the Internet where visitors go to see the results of your hard work.

All you need to do is set the variable $live_site_url equal to the value of where your live site is found on the Internet. For example, the variable is set to edwinvelez.net which is points the website you are looking at now which is my live site. My development site lives elsewhere which is not on the Internet for you to find.

With the ability to compare locations based upon the domain name values, I can choose to selectively run code without making changes manually.

[gist id=”622327776aaf3f2df1c8006f6fd716e8″ file=”functions.php” highlight=”11″]

Filed Under: Code Snippets, WordPress

  • « Go to Previous Page
  • Go to page 1
  • Go to page 2

Primary Sidebar

Recent Posts

  • Add a Bootstrap 4 Navigation Menu to a Genesis Child Theme
  • Get WordPress User Role
  • Get Root URL and Directory of a Plugin Dynamically
  • Genesis Responsive Menus
  • Build Table of Contents in Sidebar of a Genesis Theme

Recent Comments

    Archives

    • December 2019
    • October 2019
    • September 2019
    • August 2019
    • June 2019
    • March 2019
    • January 2019

    Categories

    • Bootstrap
    • Code Snippets
    • Genesis Framework
    • JavaScript
    • Theme Development
    • WordPress

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org

    Copyright © 2019 · Genesis Sample on Genesis Framework · WordPress · Log in