Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Theme functions and definitions.
*
* For additional information on potential customization options,
* read the developers' documentation:
*
* https://developers.elementor.com/docs/hello-elementor-theme/
*
* @package HelloElementorChild
@prosvitco
prosvitco / gist:bb3ca4d48a15ce5544729a173af67f75
Last active October 23, 2023 14:22
Parent Page and Sub Pages Conditional Content Display
global $post;
if (is_page()) {
if ($post->post_parent) {
echo '<h1>Child page: ' . $post->post_title . '</h1>';
echo '<p>You can display content specific to child pages here.</p>';
} else {
echo '<h1>Page parent: ' . $post->post_title . '</h1>';
echo '<p>You can display content specific to parent pages here.</p>';
}
public function is_page( $page = '' ) {
if ( ! $this->is_page ) {
return false;
}
if ( empty( $page ) ) {
return true;
}
$page_obj = $this->get_queried_object();
@prosvitco
prosvitco / gist:a7f837c74507f02082a95854427eb8f9
Created August 28, 2021 04:44
Gutenberg Block Template Sample
<!-- wp:group {"style":{"color":{"background":"#0c3f55"}},"className":"custom-group-class"} -->
<div class="wp-block-group custom-group-class has-background" style="background-color:#0c3f55"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:paragraph {"style":{"color":{"text":"#ffffff"}}} -->
<p class="has-text-color" style="color:#ffffff">Column 1 </p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"><!-- wp:paragraph {"style":{"color":{"text":"#ffffff"}}} -->
@prosvitco
prosvitco / .gitignore
Created June 9, 2020 04:14 — forked from pixeline/.gitignore
Default Wordpress .gitignore file
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@prosvitco
prosvitco / CreateWordpressUser.php
Created November 22, 2017 04:09 — forked from jawinn/CreateWordpressUser.php
Create WordPress Admin User from PHP
<?php
// ADD NEW ADMIN USER TO WORDPRESS
// ----------------------------------
// Put this file in your Wordpress root directory and run it from your browser.
// Delete it when you're done.
require_once('wp-blog-header.php');
require_once('wp-includes/registration.php');
// ----------------------------------------------------
@prosvitco
prosvitco / Bootstrap-3-navbar-center.scss
Created February 4, 2016 10:00
Center Bootstrap 3 Navbar
.navbar-nav {
@media (min-width: $screen-sm-min) {
width: 100%;
text-align: center;
}
> li {
@media (min-width: $screen-sm-min) {
@prosvitco
prosvitco / header.php
Created February 4, 2016 07:04 — forked from retlehs/header.php
Sage header template for Bootstrap top navbar component
<?php
// This file assumes that you have included the nav walker from https://github.com/twittem/wp-bootstrap-navwalker
// somewhere in your theme.
?>
<header class="banner navbar navbar-default navbar-static-top" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"><?= __('Toggle navigation', 'sage'); ?></span>