Skip to content

Instantly share code, notes, and snippets.

@xrman
Created April 5, 2017 13:44
Show Gist options
  • Save xrman/127e3a94dd5d338c922735d356f15fb2 to your computer and use it in GitHub Desktop.
Save xrman/127e3a94dd5d338c922735d356f15fb2 to your computer and use it in GitHub Desktop.
Single About Page
<?php
if ( ! defined( 'ABSPATH' ) ) { exit; }
function about_page_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'title' => '',
'bg' => '',
'desc' => '',
), $atts ) );
$about_page_markup= '<div class="single-about">
<div class="container">';
$about_page_markup.='
<div class="row">
<div class="col-md-6">
<div class="carrer-about-content">
<h2>'.$title.'</h2>
'.wpautop($desc).'
</div>
</div>
<div class="col-md-6">
<img src="'.wp_get_attachment_image_src($bg,'')[0].' " alt="'.$title.'">
</div>
</div>
';
$about_page_markup .= '</div> </div>';
return $about_page_markup;
}
add_shortcode('carrer_about_page', 'about_page_shortcode');
<?php
/**
* Plugin Name: Carrer Toolkit
* Plugin URI: http://crazycafe.com
* Description: This plugin adds related with this theme
* Version: 1.0.0
* Author: crazycafe
* Author URI: http://crazycafe.com
* License: GPL2
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/*=============>Path Acces Block Code <======================*/
define( 'CARRER_ACC_URL', WP_PLUGIN_URL . '/' . plugin_basename( dirname( __FILE__ ) ) . '/' );
define( 'CARRER_ACC_PATH', plugin_dir_path( __FILE__ ) );
function carrer_get_page_as_list( ) {
$args = wp_parse_args( array(
'post_type' => 'page',
'numberposts' => -1,
) );
$posts = get_posts( $args );
$post_options = array('-- Select page --'=>'');
if ( $posts ) {
foreach ( $posts as $post ) {
$post_options[ $post->post_title ] = $post->ID;
}
}
return $post_options;
}
function carrer_get_as_list( ) {
$args = wp_parse_args( array(
'post_type' => 'slide',
'numberposts' => -1,
) );
$posts = get_posts( $args );
$post_options = array('-- Select slide --'=>'');
if ( $posts ) {
foreach ( $posts as $post ) {
$post_options[ $post->post_title ] = $post->ID;
}
}
return $post_options;
}
add_action( 'init', 'carrer_theme_custom_post' );
function carrer_theme_custom_post() {
register_post_type( 'carrer-slide',
array(
'labels' => array(
'name' => __( 'Slides' ),
'singular_name' => __( 'Slide' )
),
'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'),
'public' => false,
'show_ui' => true,
'menu_icon' => 'dashicons-laptop'
)
);
}
add_filter('widget_text', 'do_shortcode');
require_once( CARRER_ACC_PATH . 'vc-addons/vc-blocks-load.php' );
require_once( CARRER_ACC_PATH . 'theme-shortcodes/slides-shortcode.php' );
require_once( CARRER_ACC_PATH . 'theme-shortcodes/section-title-shortcode.php' );
require_once( CARRER_ACC_PATH . 'theme-shortcodes/service-shortcode.php' );
require_once( CARRER_ACC_PATH . 'theme-shortcodes/about-shortcode.php' );
require_once( CARRER_ACC_PATH . 'theme-shortcodes/counter-shortcode.php' );
require_once( CARRER_ACC_PATH . 'theme-shortcodes/logo-carousel-shortcode.php' );
require_once( CARRER_ACC_PATH . 'theme-shortcodes/about-page-shortcode.php' );
function carrer_toolkit_files(){
wp_enqueue_style('owl-carousel', plugin_dir_url( __FILE__ ) .'assets/css/owl.carousel.css');
wp_enqueue_style('carrer-toolkit', plugin_dir_url( __FILE__ ) .'assets/css/carrer-toolkit.css');
wp_enqueue_style('carrer-toolkit-animate', plugin_dir_url( __FILE__ ) .'assets/css/animate.css');
wp_enqueue_script( 'carrer-owl-carousel', plugin_dir_url( __FILE__ ) . 'assets/js/owl.carousel.min.js', array('jquery'), '20120206', true );
}
add_action('wp_enqueue_scripts', 'carrer_toolkit_files');
<?php
if (!defined('ABSPATH')) die('-1');
class carrerVCExtendAddonClass {
function __construct() {
add_action( 'init', array( $this, 'carrerIntegrateWithVC' ) );
}
public function carrerIntegrateWithVC() {
include CARRER_ACC_PATH . '/vc-addons/vc-slides.php';
include CARRER_ACC_PATH . '/vc-addons/vc-section-title.php';
include CARRER_ACC_PATH . '/vc-addons/vc-service.php';
include CARRER_ACC_PATH . '/vc-addons/vc-about.php';
include CARRER_ACC_PATH . '/vc-addons/vc-counter.php';
include CARRER_ACC_PATH . '/vc-addons/vc-logo-carousel.php';
include CARRER_ACC_PATH . '/vc-addons/vc-about-page.php';
}
}
new carrerVCExtendAddonClass();
<?php
if ( ! defined( 'ABSPATH' ) ) { exit; }
vc_map(
array(
"name" => __( "About Page", "carrer-theme" ),
"base" => "carrer_about_page",
"category" => __( "Carrer Path", "carrer-theme"),
"params" => array(
array(
"type" => "textfield",
"heading" => __( "Title", "carrer-theme" ),
"param_name" => "title",
"description" => __( "Type your service title", "carrer-theme" )
),
array(
"type" => "attach_image",
"heading" => __( "Background", "carrer-theme" ),
"param_name" => "bg",
"description" => __( "Upload your service box background here", "carrer-theme" )
),
array(
"type" => "textarea",
"heading" => __( "Description", "carrer-theme" ),
"param_name" => "desc",
"description" => __( "Type your service description here", "carrer-theme" )
),
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment