• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

advanced custom fields wordpress custom class

phpwordpressadvanced-custom-fields


PHP Snippet 1:

/* Target Page 1 Button */
.page-1 .btn {
  background-color: red;
}
/* Target Page 2 Button */
.page-2 .btn {
  background-color: blue;
}

PHP Snippet 2:

<?php
// e.g. in functions.php
function extraButtonClass() {
  // Target by page slug or ID
  if(is_page('page-1')) {
    return ' red';
  } elseif(is_page('page-2')) {
    return ' blue';
  } else {
    return null;
  }
}

// In template:
<button class="btn<?php echo extraButtonClass(); ?>">My Button</button>

Related Snippets

Don't show recurring price for WooCommerce subscriptions worth 0$

How to generate QR CODE for dynamic generating link and logo using Simple QrCode in laravel?

Required field only if another field has a value, must be empty otherwise

Get sum of arrays inside array

(PHPUnit) PHP Fatal error: Uncaught Error: Call to undefined function each()

PHP: Insert marker every 3 iterations

Limit WooCommerce products in cart only from one custom taxonomy

Symfony - EasyAdmin - Add and remove functions are ignored from AssociationField

cakephp save drag and drop list order to database

disable two buttons after clicking another button

Laravel Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) on a sub query with "ROW_NUMBER() OVER PARTITION"

Creating a config file in PHP

onKeyUp event calculation not working on the following rows from php generated forms except the first one

PHPExcel file download using AJAX call

find in set in laravel ? example

About Contact Privacy policy Terms and conditions