Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /** * Mevzu functions and definitions * * @link https://developer.wordpress.o..
Decoded Output download
<?php
/**
* Mevzu functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package Mevzu
*/
if ( ! defined( '_S_VERSION' ) ) {
// Replace the version number of the theme on each release.
define( '_S_VERSION', '1.0.0' );
}
include('inc/ajax.php');
include('inc/wp-bootstrap5.0-pagination.php');
include('inc/bootstrap-5-wordpress-navbar-walker.php');
add_theme_support( 'yoast-seo-breadcrumbs' );
add_image_size( 'gorsel-48-48', 48,48, true);
add_image_size( 'gorsel-936-544', 936, 544, true);
add_image_size( 'gorsel-936-526', 936, 526, true, array( 'center', 'center' ));
// add_image_size( 'gorsel-936-544', 936, 544, true);
// add_image_size( 'gorsel-875-120', 875, 120, true);
// add_image_size( 'gorsel-628-265', 628, 265, true);
// add_image_size( 'gorsel-590-257', 590, 257, true);
// add_image_size( 'gorsel-520-255', 520, 255, true);
add_image_size( 'gorsel-456-243', 456, 243, true);
add_image_size( 'gorsel-400-246', 400, 246, true);
add_image_size( 'gorsel-376-211', 376, 211, true);
add_image_size( 'gorsel-366-238', 366, 205, true);
add_image_size( 'gorsel-305-171', 305, 171, true);
add_image_size( 'gorsel-296-166', 296, 166, true);
// add_image_size( 'gorsel-296-73', 296, 73, true);
add_image_size( 'gorsel-255-166', 255, 143, true);
add_image_size( 'gorsel-200-135', 200, 135, true, array( 'center', 'center' ));
// add_image_size( 'gorsel-190-230', 190, 230, true);
// add_image_size( 'gorsel-146-628', 146, 635, true);
add_image_size( 'gorsel-120-100', 120, 100, array( 'center', 'center' ));
add_image_size( 'gorsel-100-70', 100, 70, true);
add_image_size( 'gorsel-100-60', 100, 60, true);
add_image_size( 'mobil-logo', 200, 35, array( 'center', 'center' ));
// eski bilesenler ve yazi editoru
// add_filter('gutenberg_use_widgets_block_editor', '__return_false');
// add_filter('use_widgets_block_editor', '__return_false');
// add_filter('use_block_editor_for_post', '__return_false');
// eski bilesenler ve yazi editoru
/* if is single page */
function add_bg_white_class_to_body($classes) {
if (is_single()) {
$classes[] = 'bg-white';
}
return $classes;
}
add_filter('body_class', 'add_bg_white_class_to_body');
/* if is single page */
/* Archive baslik listeleme */
function my_theme_archive_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '<span>:</span>', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '<span>#</span>', false );
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>';
} elseif ( is_post_type_archive() ) {
$title = post_type_archive_title( '<span>:</span>', false );
} elseif ( is_tax() ) {
$title = single_term_title( '', false );
} elseif ( is_home() ) {
$title = 'Blog'; // rnek olarak "Blog" yazabilirsiniz veya istediiniz baka bir metin ekleyebilirsiniz
}
return $title;
}
add_filter( 'get_the_archive_title', 'my_theme_archive_title' );
/* Archive baslik listeleme */
/* post views */
function get_post_view() {
$count = get_post_meta( get_the_ID(), 'views_count', true );
return "$count grntleme";
}
function set_post_view() {
$key = 'views_count';
$post_id = get_the_ID();
$count = (int) get_post_meta( $post_id, $key, true );
$count++;
update_post_meta( $post_id, $key, $count );
}
function posts_column_views( $columns ) {
$columns['post_views'] = 'Grntlenme';
return $columns;
}
function posts_custom_column_views( $column ) {
if ( $column === 'post_views') {
echo get_post_view();
}
}
add_filter( 'manage_posts_columns', 'posts_column_views' );
add_action( 'manage_posts_custom_column', 'posts_custom_column_views' );
/* post views */
/* Breadcrumbs */
function custom_breadcrumbs() {
// Settings
$separator = '>';
$breadcrums_id = 'breadcrumbs';
$breadcrums_class = 'breadcrumb';
$home_title = "Anasayfa";
// If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
// $custom_taxonomy = 'product_cat';
// Get the query & post information
global $post,$wp_query;
// Do not display on the homepage
if ( !is_front_page() ) {
// Build the breadcrums
echo '<nav class="breadcrumb" aria-label="breadcrumb"><ol id="' . $breadcrums_id . '" class="' . $breadcrums_class . '">';
// Home page
echo '<li class="breadcrumb-item"><a href="' . get_home_url() . '" title="' . $home_title . '">' . $home_title . '</a></li>';
if ( is_archive() && !is_tax() && !is_category() && !is_tag() ) {
echo '<li class="breadcrumb-item active">' . post_type_archive_title('', false) . '</li>';
} else if ( is_archive() && is_tax() && !is_category() && !is_tag() ) {
// If post is a custom post type
$post_type = get_post_type();
// If it is a custom post type display name and link
if($post_type != 'post') {
$post_type_object = get_post_type_object($post_type);
$post_type_archive = get_post_type_archive_link($post_type);
echo '<li class="breadcrumb-item item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
}
$custom_tax_name = get_queried_object()->name;
echo '<li class="item-current item-archive active">' . $custom_tax_name . '</li>';
} else if ( is_single() ) {
// If post is a custom post type
$post_type = get_post_type();
// If it is a custom post type display name and link
if($post_type != 'post') {
$post_type_object = get_post_type_object($post_type);
$post_type_archive = get_post_type_archive_link($post_type);
echo '<li class="breadcrumb-item item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
}
// Get post category info
$category = get_the_category();
if(!empty($category)) {
// Get last category post is in
$category_values = array_values($category);
$last_category = end($category_values);
// Get parent any categories and create array
$get_cat_parents = rtrim(get_category_parents($last_category->term_id, true, ','),',');
$cat_parents = explode(',',$get_cat_parents);
// Loop through parent categories and store in variable $cat_display
$cat_display = '';
foreach($cat_parents as $parents) {
if($post_type != 'post' && $post_type != 'resmi-ilanlar') {
$cat_display .= '<li class="breadcrumb-item">'.$parents.'</li>';
}
}
}
// If it's a custom post type within a custom taxonomy
// $taxonomy_exists = taxonomy_exists($custom_taxonomy);
// if(empty($last_category) && !empty($custom_taxonomy) && $taxonomy_exists) {
// $taxonomy_terms = get_the_terms( $post->ID, $custom_taxonomy );
// $cat_id = $taxonomy_terms[0]->term_id;
// $cat_nicename = $taxonomy_terms[0]->slug;
// $cat_link = get_term_link($taxonomy_terms[0]->term_id, $custom_taxonomy);
// $cat_name = $taxonomy_terms[0]->name;
// }
// Check if the post is in a category
if(!empty($last_category)) {
echo $cat_display;
echo '<li class="breadcrumb-item active item-current item-' . $post->ID . '">' . get_the_title() . '</li>';
// Else if post is in a custom taxonomy
} else if(!empty($cat_id)) {
echo '<li class="breadcrumb-item breadcrumb-item-' . $cat_id . ' breadcrumb-item-' . $cat_nicename . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $cat_nicename . '" href="' . $cat_link . '" title="' . $cat_name . '">' . $cat_name . '</a></li>';
echo '<li class="breadcrumb-item active item-current item-' . $post->ID . '">' . get_the_title() . '</li>';
} else {
echo '<li class="breadcrumb-item active item-current item-' . $post->ID . '">' . get_the_title() . '</li>';
}
} else if ( is_category() ) {
// Category page
echo '<li class="breadcrumb-item active item-current breadcrumb-item">' . single_cat_title('', false) . '</li>';
} else if ( is_page() ) {
// Standard page
if( $post->post_parent ){
// If child page, get parents
$anc = get_post_ancestors( $post->ID );
// Get parents in the right order
$anc = array_reverse($anc);
// Parent page loop
if ( !isset( $parents ) ) $parents = null;
foreach ( $anc as $ancestor ) {
$parents .= '<li class="item-parent item-parent-' . $ancestor . '"><a class="bread-parent bread-parent-' . $ancestor . '" href="' . get_permalink($ancestor) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li>';
}
// Display parent pages
echo $parents;
// Current page
echo '<li class="breadcrumb-item active item-current item-' . $post->ID . '">' . get_the_title() . '</li>';
} else {
// Just display current page if not parents
echo '<li class="breadcrumb-item active item-current item-' . $post->ID . '">' . get_the_title() . '</li>';
}
} else if ( is_tag() ) {
// Tag page
// Get tag information
$term_id = get_query_var('tag_id');
$taxonomy = 'post_tag';
$args = 'include=' . $term_id;
$terms = get_terms( $taxonomy, $args );
$get_term_id = $terms[0]->term_id;
$get_term_slug = $terms[0]->slug;
$get_term_name = $terms[0]->name;
// Display the tag name
echo '<li class="breadcrumb-item active item-current item-tag-' . $get_term_id . ' item-tag-' . $get_term_slug . '">' . $get_term_name . '</li>';
} elseif ( is_day() ) {
// Day archive
// Year link
echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link( get_the_time('Y') ) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</a></li>';
// Month link
echo '<li class="item-month item-month-' . get_the_time('m') . '"><a class="bread-month bread-month-' . get_the_time('m') . '" href="' . get_month_link( get_the_time('Y'), get_the_time('m') ) . '" title="' . get_the_time('M') . '">' . get_the_time('M') . ' Archives</a></li>';
// Day display
echo '<li class="breadcrumb-item active item-current item-' . get_the_time('j') . '">' . get_the_time('jS') . ' ' . get_the_time('M') . ' Archives</li>';
} else if ( is_month() ) {
// Month Archive
// Year link
echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link( get_the_time('Y') ) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</a></li>';
// Month display
echo '<li class="active item-month item-month-' . get_the_time('m') . '">' . get_the_time('M') . ' Archives</li>';
} else if ( is_year() ) {
// Display year archive
echo '<li class="breadcrumb-item active item-current item-current-' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</li>';
} else if ( is_author() ) {
// Auhor archive
// Get the author information
global $author;
$userdata = get_userdata( $author );
// Display author name
echo '<li class="breadcrumb-item active item-current item-current-' . $userdata->user_nicename . '">' . 'Author: ' . $userdata->display_name . '</li>';
} else if ( get_query_var('paged') ) {
// Paginated archives
echo '<li class="breadcrumb-item active item-current item-current-' . get_query_var('paged') . '">'.__('Page') . ' ' . get_query_var('paged') . '</li>';
} else if ( is_search() ) {
// Search results page
echo '<li class="breadcrumb-item active item-current item-current-' . get_search_query() . '">Arama: ' . get_search_query() . '</li>';
} elseif ( is_404() ) {
// 404 page
echo '<li class="active">' . 'Error 404' . '</li>';
}
echo '</nav></ol>';
}
}
/* Breadcrumbs */
function mevzu_setup() {
load_theme_textdomain( 'mevzu', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus(
array(
'main-menu' => esc_html__( 'Main Menu', 'mevzu' ),
'ust-menu' => esc_html__( 'Ust Menu', 'mevzu' ),
'footer-menu-1' => esc_html__( 'Footer Menu - 1', 'mevzu' ),
'footer-menu-2' => esc_html__( 'Footer Menu - 2', 'mevzu' ),
'footer-menu-3' => esc_html__( 'Footer Menu - 3', 'mevzu' ),
'footer-menu-4' => esc_html__( 'Footer Menu - 4', 'mevzu' ),
)
);
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support(
'html5',
array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
)
);
// Set up the WordPress core custom background feature.
add_theme_support(
'custom-background',
apply_filters(
'mevzu_custom_background_args',
array(
'default-color' => 'ffffff',
'default-image' => '',
)
)
);
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support(
'custom-logo',
array(
'height' => 250,
'width' => 250,
'flex-width' => true,
'flex-height' => true,
)
);
}
add_action( 'after_setup_theme', 'mevzu_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function mevzu_content_width() {
$GLOBALS['content_width'] = apply_filters( 'mevzu_content_width', 640 );
}
add_action( 'after_setup_theme', 'mevzu_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function mevzu_widgets_init() {
register_sidebar(
array(
'name' => esc_html__( 'Sidebar Anasayfa', 'mevzu' ),
'id' => 'sidebar-anasayfa',
'description' => esc_html__( 'Add widgets here.', 'mevzu' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Sidebar Single', 'mevzu' ),
'id' => 'sidebar-single',
'description' => esc_html__( 'Add widgets here.', 'mevzu' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
}
add_action( 'widgets_init', 'mevzu_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function mevzu_scripts() {
wp_enqueue_style( 'mevzu-style', get_stylesheet_uri(), array(), _S_VERSION );
wp_style_add_data( 'mevzu-style', 'rtl', 'replace' );
wp_enqueue_script( 'mevzu-navigation', get_template_directory_uri() . '/js/navigation.js', array(), _S_VERSION, true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'mevzu_scripts' );
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require get_template_directory() . '/inc/template-functions.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
if ( defined( 'JETPACK__VERSION' ) ) {
require get_template_directory() . '/inc/jetpack.php';
}
// Creating the widget
class wpb_widget extends WP_Widget {
function __construct() {
parent::__construct(
// Base ID of your widget
'wpb_widget',
// Widget name will appear in UI
__('WPBeginner Widget', 'wpb_widget_domain'),
// Widget description
array( 'description' => __( 'Sample widget based on WPBeginner Tutorial', 'wpb_widget_domain' ), )
);
}
// Creating widget front-end
public function widget( $args, $instance ) {
$title = apply_filters( 'widget_title', $instance['title'] );
// before and after widget arguments are defined by themes
echo $args['before_widget'];
if ( ! empty( $title ) )
echo $args['before_title'] . $title . $args['after_title'];
// This is where you run the code and display the output
echo __( 'Hello, World!', 'wpb_widget_domain' );
echo $args['after_widget'];
}
// Widget Backend
public function form( $instance ) {
if ( isset( $instance[ 'title' ] ) ) {
$title = $instance[ 'title' ];
}
else {
$title = __( 'New title', 'wpb_widget_domain' );
}
// Widget admin form
?>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
</p>
<?php
}
// Updating widget replacing old instances with new
public function update( $new_instance, $old_instance ) {
$instance = array();
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
return $instance;
}
// Class wpb_widget ends here
}
// Register and load the widget
function wpb_load_widget() {
register_widget( 'wpb_widget' );
}
add_action( 'widgets_init', 'wpb_load_widget' );
// Define path and URL to the ACF plugin.
define( 'MY_ACF_PATH', get_stylesheet_directory() . '/inc/acf/' );
define( 'MY_ACF_URL', get_stylesheet_directory_uri() . '/inc/acf/' );
// Include the ACF plugin.
include_once( MY_ACF_PATH . 'acf.php' );
// Customize the url setting to fix incorrect asset URLs.
add_filter('acf/settings/url', 'my_acf_settings_url');
function my_acf_settings_url( $url ) {
return MY_ACF_URL;
}
// (Optional) Hide the ACF admin menu item.
// add_filter('acf/settings/show_admin', '__return_false');
// When including the PRO plugin, hide the ACF Updates menu
add_filter('acf/settings/show_updates', '__return_false', 100);
// Bileen Tanmlama
function custom_post_list_widget() {
register_widget('Custom_Post_List_Widget');
}
add_action('widgets_init', 'custom_post_list_widget');
// Bileen Snf
class Custom_Post_List_Widget extends WP_Widget {
public function __construct() {
$widget_options = array(
'classname' => 'custom_post_list_widget',
'description' => 'zelletirilebilir haber listeleme',
);
parent::__construct('custom_post_list_widget', ':Mevzu Haber Sralama', $widget_options);
}
public function widget($args, $instance) {
$title = !empty($instance['title']) ? apply_filters('widget_title', $instance['title']) : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
$template = !empty($instance['template']) ? $instance['template'] : 'populer-basliklar';
echo '<div class="sag-widget '.$template.' mb-3 mb-lg-4">';
if ($title) {
echo '<div class="title"><span>' . $title . '</span></div>';
}
if($order_by == 'meta_value_num') {
$args = array(
'post_type' => 'post',
'posts_per_page' => $post_count,
'orderby' => $order_by,
'meta_key' => 'views_count',
'order' => 'DESC',
);
}
else {
$args = array(
'post_type' => 'post',
'posts_per_page' => $post_count,
'orderby' => $order_by,
);
}
$custom_query = new WP_Query($args);
echo '<div class="widget-body">';
if($template == 'populer-basliklar') {
if ($custom_query->have_posts()) {
$count = 0;
while ($custom_query->have_posts()) {
$custom_query->the_post(); $count++;?>
<a href="<?php the_permalink() ?>" class="ripple" data-mdb-ripple-color="light">
<div class="card-body">
<div class="row align-items-center mx-0">
<div class="col-auto">
<span class="no"><?php echo $count ?></span>
</div>
<div class="col ps-0">
<h3 class="card-title"><?php the_title(); ?></h3>
</div>
</div>
</div>
</a>
<?php }
wp_reset_postdata();
} else {
echo 'No posts found.';
}
}
if($template == 'populer-basliklar-2') {
if ($custom_query->have_posts()) {
$count = 0;
while ($custom_query->have_posts()) {
$custom_query->the_post(); $count++; ?>
<a href="<?php the_permalink() ?>" class="ripple" data-mdb-ripple-color="light">
<div class="card-body">
<div class="row align-items-center mx-0">
<div class="col-auto ps-0">
<span class="no"><?php echo $count ?></span>
</div>
<div class="col ps-0">
<h3 class="card-title satir-3"><?php the_title(); ?></h3>
</div>
</div>
</div>
</a>
<?php }
wp_reset_postdata();
} else {
echo 'No posts found.';
}
}
echo '</div>';
echo '</div>';
}
public function form($instance) {
$title = !empty($instance['title']) ? $instance['title'] : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
$template = !empty($instance['template']) ? $instance['template'] : 'populer-basliklar';
?>
<!-- Balk Alan -->
<p>
<label for="<?php echo $this->get_field_id('title'); ?>">Balk:</label>
<input class="widefat" type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($title); ?>">
</p>
<!-- Sralama Seenekleri -->
<p>
<label for="<?php echo $this->get_field_id('order_by'); ?>">Sralama:</label>
<select class="widefat" id="<?php echo $this->get_field_id('order_by'); ?>" name="<?php echo $this->get_field_name('order_by'); ?>">
<option value="date" <?php selected($order_by, 'date'); ?>>Tarihe gre</option>
<option value="meta_value_num" <?php selected($order_by, 'meta_value_num'); ?>>Tklanmaya gre</option>
<option value="category" <?php selected($order_by, 'category'); ?>>Kategoriye gre</option>
</select>
</p>
<!-- kt Adedi -->
<p>
<label for="<?php echo $this->get_field_id('post_count'); ?>">Grntlenecek haber says: </label>
<input class="widefat" type="number" id="<?php echo $this->get_field_id('post_count'); ?>" name="<?php echo $this->get_field_name('post_count'); ?>" value="<?php echo esc_attr($post_count); ?>" min="1" max="20">
</p>
<!-- ablon Seenei -->
<p>
<label for="<?php echo $this->get_field_id('template'); ?>">ablon:</label>
<select class="widefat" id="<?php echo $this->get_field_id('template'); ?>" name="<?php echo $this->get_field_name('template'); ?>">
<option value="populer-basliklar" <?php selected($template, 'populer-basliklar'); ?>>ablon - 1</option>
<option value="populer-basliklar-2" <?php selected($template, 'populer-basliklar-2'); ?>>ablon - 2</option>
</select>
</p>
<?php
}
public function update($new_instance, $old_instance) {
$instance = array();
$instance['title'] = !empty($new_instance['title']) ? sanitize_text_field($new_instance['title']) : '';
$instance['order_by'] = !empty($new_instance['order_by']) ? sanitize_text_field($new_instance['order_by']) : 'date';
$instance['post_count'] = !empty($new_instance['post_count']) ? absint($new_instance['post_count']) : 5;
$instance['template'] = !empty($new_instance['template']) ? sanitize_text_field($new_instance['template']) : 'populer-basliklar';
return $instance;
}
}
// Bileen Tanmlama
function custom_bilesen_egazete() {
register_widget('bilesen_egazete');
}
add_action('widgets_init', 'custom_bilesen_egazete');
// Bileen Snf
class bilesen_egazete extends WP_Widget {
public function __construct() {
$widget_options = array(
'classname' => 'custom_bilesen_egazete',
'description' => 'zelletirilebilir e-gazete listeleme',
);
parent::__construct('custom_bilesen_egazete', ':Mevzu E-Gazete', $widget_options);
}
public function widget($args, $instance) {
$title = !empty($instance['title']) ? apply_filters('widget_title', $instance['title']) : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
echo '<div class="sag-widget sag-egazete mb-3 mb-lg-4">';
if ($title) {
echo '<div class="title"><span>' . $title . '</span></div>';
}
if($order_by == 'meta_value_num') {
$args = array(
'post_type' => 'e-gazete',
'posts_per_page' => $post_count,
'orderby' => $order_by,
'meta_key' => 'views_count',
'order' => 'DESC',
);
}
else {
$args = array(
'post_type' => 'e-gazete',
'posts_per_page' => $post_count,
'orderby' => $order_by,
);
}
$custom_query = new WP_Query($args);
echo '<div class="widget-body">';
if ($custom_query->have_posts()) {
$count = 0; ?>
<div id="owl-egazeteslider" class="owl-carousel">
<?php while ($custom_query->have_posts()) {
$custom_query->the_post(); $count++;?>
<div class="item">
<div class="card card-kucuk">
<a href="<?php the_permalink() ?>" class="ripple" data-mdb-ripple-color="light">
<img src="<?php echo '/wp-content/uploads/e-gazete/auto-thumbnails/'. get_the_ID() .'.png'; ?> " alt="<?php the_title(); ?>">
<div class="card-body">
<h3 class="card-title satir-2"><?php echo get_the_date("d.m.Y"); ?></h3>
<span class="details">
Tarihli E-Gazete
</span>
</div>
</a>
</div>
</div>
<?php }
wp_reset_postdata(); ?>
</div>
<a href="<?php echo get_page_uri(117336); ?>" class="btn btn-primary">Tmn Gster</a>
<?php
} else {
echo 'Bulunamad';
}
echo '</div>';
echo '</div>';
}
public function form($instance) {
$title = !empty($instance['title']) ? $instance['title'] : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
?>
<!-- Balk Alan -->
<p>
<label for="<?php echo $this->get_field_id('title'); ?>">Balk:</label>
<input class="widefat" type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($title); ?>">
</p>
<!-- Sralama Seenekleri -->
<p>
<label for="<?php echo $this->get_field_id('order_by'); ?>">Sralama:</label>
<select class="widefat" id="<?php echo $this->get_field_id('order_by'); ?>" name="<?php echo $this->get_field_name('order_by'); ?>">
<option value="date" <?php selected($order_by, 'date'); ?>>Tarihe gre</option>
<option value="meta_value_num" <?php selected($order_by, 'meta_value_num'); ?>>Tklanmaya gre</option>
<option value="category" <?php selected($order_by, 'category'); ?>>Kategoriye gre</option>
</select>
</p>
<!-- kt Adedi -->
<p>
<label for="<?php echo $this->get_field_id('post_count'); ?>">Grntlenecek haber says: </label>
<input class="widefat" type="number" id="<?php echo $this->get_field_id('post_count'); ?>" name="<?php echo $this->get_field_name('post_count'); ?>" value="<?php echo esc_attr($post_count); ?>" min="1" max="20">
</p>
<?php
}
public function update($new_instance, $old_instance) {
$instance = array();
$instance['title'] = !empty($new_instance['title']) ? sanitize_text_field($new_instance['title']) : '';
$instance['order_by'] = !empty($new_instance['order_by']) ? sanitize_text_field($new_instance['order_by']) : 'date';
$instance['post_count'] = !empty($new_instance['post_count']) ? absint($new_instance['post_count']) : 5;
$instance['template'] = !empty($new_instance['template']) ? sanitize_text_field($new_instance['template']) : 'populer-basliklar';
return $instance;
}
}
// Bileen Tanmlama
function custom_bilesen_videohaberler() {
register_widget('bilesen_videohaberler');
}
add_action('widgets_init', 'custom_bilesen_videohaberler');
// Bileen Snf
class bilesen_videohaberler extends WP_Widget {
public function __construct() {
$widget_options = array(
'classname' => 'custom_bilesen_videohaberler',
'description' => 'zelletirilebilir videolu haberleri listeleme',
);
parent::__construct('custom_bilesen_videohaberler', ':Mevzu Video Haberler', $widget_options);
}
public function widget($args, $instance) {
$title = !empty($instance['title']) ? apply_filters('widget_title', $instance['title']) : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
echo '<div class="sag-widget video-haberler mb-3 mb-lg-4">';
if ($title) {
echo '<div class="title"><span>' . $title . '</span></div>';
}
if($order_by == 'meta_value_num') {
$args = array(
'post_type' => 'post',
'posts_per_page' => $post_count,
'orderby' => $order_by,
'meta_key' => 'views_count',
'order' => 'DESC',
'category_name' => 'Video Galerisi',
'meta_query' => array(
'relation' => 'AND', // Hem kategori hem de ne kan grseli koulunu kontrol ediyoruz
array(
'key' => '_thumbnail_id', // Bu, ne kan grseli kontrol eder
'compare' => 'EXISTS', // ne kan grseli olanlar alr
),
array(
'taxonomy' => 'category', // Kategori sorgusu yapacaz
'field' => 'slug', // Kategori alann slug olarak kullanacaz
'terms' => 'video-galerisi', // Video Galerisi kategorisinin slug'
),
),
);
}
else {
$args = array(
'post_type' => 'post',
'posts_per_page' => $post_count,
'orderby' => $order_by,
'category_name' => 'Video Galerisi',
'meta_query' => array(
'relation' => 'AND', // Hem kategori hem de ne kan grseli koulunu kontrol ediyoruz
array(
'key' => '_thumbnail_id', // Bu, ne kan grseli kontrol eder
'compare' => 'EXISTS', // ne kan grseli olanlar alr
),
array(
'taxonomy' => 'category', // Kategori sorgusu yapacaz
'field' => 'slug', // Kategori alann slug olarak kullanacaz
'terms' => 'video-galerisi', // Video Galerisi kategorisinin slug'
),
),
);
}
$custom_query = new WP_Query($args);
echo '<div class="widget-body">';
if ($custom_query->have_posts()) {
$count = 0; ?>
<?php while ($custom_query->have_posts()) {
$custom_query->the_post(); $count++;?>
<a href="<?php the_permalink() ?>" class="ripple" data-mdb-ripple-color="light">
<div class="card-body">
<div class="row align-items-center mx-0">
<div class="col-auto">
<?php the_post_thumbnail('gorsel-100-60', ['title' => get_the_title()]); ?>
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 15 15"><path fill="currentColor" d="M4.79 2.093A.5.5 0 0 0 4 2.5v10a.5.5 0 0 0 .79.407l7-5a.5.5 0 0 0 0-.814l-7-5Z"/></svg>
</div>
<div class="col ps-0">
<h3 class="card-title"><?php the_title() ?></h3>
</div>
</div>
</div>
</a>
<?php }
wp_reset_postdata(); ?>
<?php
} else {
echo 'Bulunamad';
}
echo '</div>';
echo '</div>';
}
public function form($instance) {
$title = !empty($instance['title']) ? $instance['title'] : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
?>
<!-- Balk Alan -->
<p>
<label for="<?php echo $this->get_field_id('title'); ?>">Balk:</label>
<input class="widefat" type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($title); ?>">
</p>
<!-- Sralama Seenekleri -->
<p>
<label for="<?php echo $this->get_field_id('order_by'); ?>">Sralama:</label>
<select class="widefat" id="<?php echo $this->get_field_id('order_by'); ?>" name="<?php echo $this->get_field_name('order_by'); ?>">
<option value="date" <?php selected($order_by, 'date'); ?>>Tarihe gre</option>
<option value="meta_value_num" <?php selected($order_by, 'meta_value_num'); ?>>Tklanmaya gre</option>
<option value="category" <?php selected($order_by, 'category'); ?>>Kategoriye gre</option>
</select>
</p>
<!-- kt Adedi -->
<p>
<label for="<?php echo $this->get_field_id('post_count'); ?>">Grntlenecek haber says: </label>
<input class="widefat" type="number" id="<?php echo $this->get_field_id('post_count'); ?>" name="<?php echo $this->get_field_name('post_count'); ?>" value="<?php echo esc_attr($post_count); ?>" min="1" max="20">
</p>
<?php
}
public function update($new_instance, $old_instance) {
$instance = array();
$instance['title'] = !empty($new_instance['title']) ? sanitize_text_field($new_instance['title']) : '';
$instance['order_by'] = !empty($new_instance['order_by']) ? sanitize_text_field($new_instance['order_by']) : 'date';
$instance['post_count'] = !empty($new_instance['post_count']) ? absint($new_instance['post_count']) : 5;
$instance['template'] = !empty($new_instance['template']) ? sanitize_text_field($new_instance['template']) : 'populer-basliklar';
return $instance;
}
}
// Bileen Tanmlama
function custom_bilesen_skortablosu() {
register_widget('bilesen_skortablosu');
}
add_action('widgets_init', 'custom_bilesen_skortablosu');
// Bileen Snf
class bilesen_skortablosu extends WP_Widget {
public function __construct() {
$widget_options = array(
'classname' => 'custom_bilesen_skortablosu',
'description' => 'zelletirilebilir skor tablosu listeleme',
);
parent::__construct('custom_bilesen_skortablosu', ':Mevzu Skor Tablosu', $widget_options);
}
public function widget($args, $instance) {?>
<div class="widget-puandurumu py-2 px-3 mb-3 mb-lg-4">
<div class="row puandurumu-baslik">
<div class="col-1">#</div>
<div class="col-8">Takmlar</div>
<div class="col-1">O</div>
<div class="col-1">AV</div>
<div class="col-1">P</div>
</div>
<?php $arr = array("Adana Demir","Alanyaspor","MKE Ankaragc","Antalyaspor","Beikta","Karagmrk","Fenerbahe","Galatasaray","Gaziantep FK","Hatayspor","Baakehir","Kasmpaa","Kayserispor","Konyaspor","Pendikspor",". Rizespor","Samsunspor","Sivasspor","Trabzonspor","stanbulspor","Trabzonspor");
for ($i = 1; $i < count($arr); $i++) { ?>
<?php if($i == 9) : ?>
<div class="row show-button">
<div class="col-12 text-center">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12a1 1 0 1 0 2 0a1 1 0 1 0-2 0m7 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0m7 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0"/></svg>
</div>
</div>
<?php endif; ?>
<div class="row takim takim-<?php echo $i ?>">
<div class="col-1"><span><?php echo $i; ?></span></div>
<div class="col-8"><?php echo $arr[$i]; ?></div>
<div class="col-1">0</div>
<div class="col-1">0</div>
<div class="col-1">0</div>
</div>
<?php } ?>
<a href="#" class="btn btn-primary">Puan Durumu</a>
</div>
<?php
}
public function form($instance) {
$title = !empty($instance['title']) ? $instance['title'] : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
?>
<!-- Balk Alan -->
<p>
<label for="<?php echo $this->get_field_id('title'); ?>">Balk:</label>
<input class="widefat" type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($title); ?>">
</p>
<!-- Sralama Seenekleri -->
<p>
<label for="<?php echo $this->get_field_id('order_by'); ?>">Sralama:</label>
<select class="widefat" id="<?php echo $this->get_field_id('order_by'); ?>" name="<?php echo $this->get_field_name('order_by'); ?>">
<option value="date" <?php selected($order_by, 'date'); ?>>Tarihe gre</option>
<option value="meta_value_num" <?php selected($order_by, 'meta_value_num'); ?>>Tklanmaya gre</option>
<option value="category" <?php selected($order_by, 'category'); ?>>Kategoriye gre</option>
</select>
</p>
<!-- kt Adedi -->
<p>
<label for="<?php echo $this->get_field_id('post_count'); ?>">Grntlenecek haber says: </label>
<input class="widefat" type="number" id="<?php echo $this->get_field_id('post_count'); ?>" name="<?php echo $this->get_field_name('post_count'); ?>" value="<?php echo esc_attr($post_count); ?>" min="1" max="20">
</p>
<?php
}
public function update($new_instance, $old_instance) {
$instance = array();
$instance['title'] = !empty($new_instance['title']) ? sanitize_text_field($new_instance['title']) : '';
$instance['order_by'] = !empty($new_instance['order_by']) ? sanitize_text_field($new_instance['order_by']) : 'date';
$instance['post_count'] = !empty($new_instance['post_count']) ? absint($new_instance['post_count']) : 5;
return $instance;
}
}
// Bileen Tanmlama
function custom_bilesen_reklam() {
register_widget('bilesen_reklam');
}
add_action('widgets_init', 'custom_bilesen_reklam');
// Bileen Snf
class bilesen_reklam extends WP_Widget {
public function __construct() {
$widget_options = array(
'classname' => 'custom_bilesen_reklam',
'description' => 'zelletirilebilir reklam alan',
);
parent::__construct('custom_bilesen_reklam', ':Mevzu Reklam', $widget_options);
}
public function widget($args, $instance) {
$title = !empty($instance['title']) ? apply_filters('widget_title', $instance['title']) : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
echo '<div class="reklam h-240 mb-3 mb-lg-4">
Reklam Alan<b>296x240</b>
</div>';
}
public function form($instance) {
$title = !empty($instance['title']) ? $instance['title'] : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
?>
<!-- Balk Alan -->
<p>
Bu alan <span class="dashicons dashicons-megaphone"></span> <a href="./admin.php?page=mevzu-reklamlar">Reklamlar</a> blmnde yer alan <b>Bileen Reklam</b> blmnden dzenlenebilir.
</p>
<?php
}
public function update($new_instance, $old_instance) {
$instance = array();
$instance['title'] = !empty($new_instance['title']) ? sanitize_text_field($new_instance['title']) : '';
$instance['order_by'] = !empty($new_instance['order_by']) ? sanitize_text_field($new_instance['order_by']) : 'date';
$instance['post_count'] = !empty($new_instance['post_count']) ? absint($new_instance['post_count']) : 5;
$instance['template'] = !empty($new_instance['template']) ? sanitize_text_field($new_instance['template']) : 'populer-basliklar';
return $instance;
}
}
add_filter( 'wp_kses_allowed_html', 'acf_add_allowed_svg_tag', 10, 2 );
function acf_add_allowed_svg_tag( $tags, $context ) {
if ( $context === 'acf' ) {
$tags['svg'] = array(
'xmlns' => true,
'width' => true,
'height' => true,
'preserveAspectRatio' => true,
'fill' => true,
'viewbox' => true,
'role' => true,
'aria-hidden' => true,
'focusable' => true,
);
$tags['path'] = array(
'd' => true,
'fill' => true,
'stroke' => true,
'stroke-linecap' => true,
'stroke-linejoin' => true,
'stroke-width' => true,
);
$tags['g'] = array(
'fill' => true,
'transform' => true,
'stroke' => true,
'stroke-linecap' => true,
'stroke-linejoin' => true,
'stroke-width' => true,
'clip-path' => true
);
}
return $tags;
}
/* Options Pages */
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Ayarlar',
'menu_title' => 'Mevzu Ayarlar',
'menu_slug' => 'mevzu-ayarlar',
'icon_url' => 'dashicons-admin-generic',
));
acf_add_options_page(array(
'page_title' => 'Reklam Ayarlar',
'menu_title' => 'Reklamlar',
'menu_slug' => 'mevzu-reklamlar',
'icon_url' => 'dashicons-megaphone',
'position' => 7
));
}
/* Options Pages */
/* Admin theme */
function wpacg_mevzu_admin_color_scheme() {
$theme_dir = get_stylesheet_directory_uri();
wp_admin_css_color( 'mevzu', __( 'mevzu' ),
$theme_dir . '/css/admin_mevzu.css',
array( '#222222', '#fff', '#d54e21', '#c90914' )
);
}
add_action( 'admin_init', 'wpacg_mevzu_admin_color_scheme' );
/* Admin theme */
/* Admin page logo */
function wpb_custom_logo() {
echo '
<style type="text/css">
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
background-image: url(' . get_bloginfo('stylesheet_directory') . '/img/favicon.jpg) !important;
background-size:cover;
background-position: 0 0;
color:rgba(0, 0, 0, 0);
}
#wpadminbar #wp-admin-bar-wp-logo.hover > .ab-item .ab-icon {
background-position: 0 0;
}
</style>
';
}
add_action('wp_before_admin_bar_render', 'wpb_custom_logo');
/* Admin page logo */
/* Remove jQuery Migrate */
function remove_jquery_migrate( $scripts ) {
if ( ! is_admin() && isset( $scripts->registered['jquery'] ) ) {
$script = $scripts->registered['jquery'];
if ( $script->deps ) {
$script->deps = array_diff( $script->deps, array( 'jquery-migrate' ) );
}
}
}
add_action( 'wp_default_scripts', 'remove_jquery_migrate' );
/* Remove jQuery Migrate */
/* Custom Posts Name */
function custom_change_post_labels( $args, $post_type ) {
if ( $post_type === 'post' ) { // Check if it's the default "post" post type
$new_name = 'Haberler'; // Replace 'Your Custom Name' with the name you want to use
$new_icon = 'dashicons-admin-page'; // Replace 'dashicons-star-filled' with the Dashicon class or URL of the custom icon you want to use
$args['labels']['name'] = $new_name;
$args['labels']['singular_name'] = $new_name;
$args['menu_icon'] = $new_icon;
}
return $args;
}
add_filter( 'register_post_type_args', 'custom_change_post_labels', 10, 2 );
/* Custom Posts Name */
/* Default thumbnail */
/* Default thumbnail */
/* Comment Form */
/* Comment Form */
/* Custom WP Login */
function ppwp_custom_login_logo() { ?>
<style type="text/css">
#login{padding: 7rem 1rem 0 1rem !important;}
#loginform{border-radius: .25rem;}
#login h1 a, .login h1 a {
background-image: url(<?php echo get_template_directory_uri() . '/img/logo_admin.png' ?>);
height:44px;
width:320px;
background-size: contain;
background-repeat: no-repeat;
padding-bottom: 10px;
}
#nav{text-align: center;}
#backtoblog{display: none;}
.kerem{text-align: center;margin-top: 1.5rem !important;}
.kerem a{opacity: 1;display: inline-block;text-decoration: none;color: #000;}
.kerem a:focus{box-shadow: none !important;}
.kerem a:hover{opacity: .8;color: currentColor;}
.kerem img{width: 32px;}
.privacy-policy-page-link{display: none;}
</style>
<?php }
add_action( 'login_enqueue_scripts', 'ppwp_custom_login_logo' );
function ppwp_custom_login_url() {
return home_url();
}
add_filter( 'login_headerurl', 'ppwp_custom_login_url' );
function ppwp_login_logo_url_redirect() {
return get_bloginfo('url');
}
add_filter( 'login_headertitle', 'ppwp_login_logo_url_redirect' );
add_filter( 'login_display_language_dropdown', '__return_false' );
function custom_login_footer_text() { ?>
<div class="kerem">
<a href="http://kkerem.github.io/" target="_blank">
<img src="<?php bloginfo('template_url')?>/img/kkerem.png" title="Kerem ER">
</a>
</div>
<?php }
add_action( 'login_footer', 'custom_login_footer_text' );
function custom_admin_title( $admin_title, $title ) {
if ( is_admin() ) {
$admin_title = get_bloginfo( 'name' ) . ' ‹ ' . $title;
}
return $admin_title;
}
add_filter( 'admin_title', 'custom_admin_title', 10, 2 );
function custom_login_title( $login_title ) {
// Replace "WordPress" with an empty string to remove it from the title
$login_title = get_bloginfo( 'name' );
return $login_title;
}
add_filter( 'login_title', 'custom_login_title' );
/* Custom WP Login */
function fb_opengraph() {
if(is_single()) {
if(has_post_thumbnail(get_the_ID())) {
$img_src = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'gorsel-936-526')[0];
} ?>
<meta property="og:title" content="<?php echo the_title(); ?>"/>
<meta property="og:description" content="<?php echo strip_tags(mb_strimwidth(get_the_content(), 0, 300, '...')); ?>"/>
<meta property="og:type" content="article"/>
<meta property="og:url" content="<?php echo the_permalink(); ?>"/>
<meta property="og:site_name" content="<?php echo get_bloginfo(); ?>"/>
<meta property="og:image" content="<?php echo $img_src; ?>"/>
<?php }
}
add_action('wp_head', 'fb_opengraph', 5);
// Function to handle the thumbnail request
function get_the_post_thumbnail_src($img)
{
return (preg_match('~src="([^"]++)"~', $img, $matches)) ? $matches[1] : '';
}
function wpvkp_social_buttons($content) {
global $post;
if(is_singular() || is_home()){
$sb_url = urlencode(get_permalink());
$sb_title = str_replace( ' ', '%20', get_the_title());
$sb_thumb = get_the_post_thumbnail_src(get_the_post_thumbnail());
$twitterURL = 'https://twitter.com/intent/tweet?text='.$sb_title.'&url='.$sb_url.'&via=wpvkp';
$facebookURL = 'https://www.facebook.com/sharer/sharer.php?u='.$sb_url;
$bufferURL = 'https://bufferapp.com/add?url='.$sb_url.'&text='.$sb_title;
$whatsappURL = 'whatsapp://send?text='.$sb_title . ' ' . $sb_url;
$linkedInURL = 'https://www.linkedin.com/shareArticle?mini=true&url='.$sb_url.'&title='.$sb_title;
if(!empty($sb_thumb)) {
$pinterestURL = 'https://pinterest.com/pin/create/button/?url='.$sb_url.'&media='.$sb_thumb[0].'&description='.$sb_title;
}
else {
$pinterestURL = 'https://pinterest.com/pin/create/button/?url='.$sb_url.'&description='.$sb_title;
}
$pinterestURL = 'https://pinterest.com/pin/create/button/?url='.$sb_url.'&media='.$sb_thumb[0].'&description='.$sb_title;
$gplusURL ='https://plus.google.com/share?url='.$sb_title.'';
$content .= '<div class="col-12 col-md-auto ms-auto pe-lg-0 paylas px-0"><span class="small pe-2 d-none d-lg-inline-block">Payla: </span>';
$content .= '<a class="facebook" href="'.$facebookURL.'" target="_blank" rel="nofollow"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#4565a0" d="M14 13.5h2.5l1-4H14v-2c0-1.03 0-2 2-2h1.5V2.14c-.326-.043-1.557-.14-2.857-.14C11.928 2 10 3.657 10 6.7v2.8H7v4h3V22h4v-8.5Z"/></svg></a>';
$content .= '<a class="twitter" href="'. $twitterURL .'" target="_blank" rel="nofollow"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#64b6ef" d="M22.46 6c-.77.35-1.6.58-2.46.69c.88-.53 1.56-1.37 1.88-2.38c-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29c0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15c0 1.49.75 2.81 1.91 3.56c-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07a4.28 4.28 0 0 0 4 2.98a8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21C16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56c.84-.6 1.56-1.36 2.14-2.23Z"></path></svg></a>';
$content .= '<a class="whatsapp" href="'.$whatsappURL.'" target="_blank" rel="nofollow"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#25d366" d="M12.001 2c5.523 0 10 4.477 10 10s-4.477 10-10 10a9.954 9.954 0 0 1-5.03-1.355L2.005 22l1.352-4.968A9.953 9.953 0 0 1 2.001 12c0-5.523 4.477-10 10-10ZM8.593 7.3l-.2.008a.961.961 0 0 0-.372.1a1.293 1.293 0 0 0-.294.228c-.12.113-.188.211-.261.306A2.73 2.73 0 0 0 6.9 9.62c.002.49.13.967.33 1.413c.409.902 1.082 1.857 1.97 2.742c.214.213.424.427.65.626a9.448 9.448 0 0 0 3.84 2.046l.568.087c.185.01.37-.004.556-.013a1.99 1.99 0 0 0 .833-.231a4.83 4.83 0 0 0 .383-.22s.043-.028.125-.09c.135-.1.218-.171.33-.288c.083-.086.155-.187.21-.302c.078-.163.156-.474.188-.733c.024-.198.017-.306.014-.373c-.004-.107-.093-.218-.19-.265l-.582-.261s-.87-.379-1.402-.621a.497.497 0 0 0-.176-.041a.482.482 0 0 0-.378.127c-.005-.002-.072.055-.795.931a.35.35 0 0 1-.368.13a1.43 1.43 0 0 1-.191-.066c-.124-.052-.167-.072-.252-.108a6.025 6.025 0 0 1-1.575-1.003c-.126-.11-.243-.23-.363-.346a6.297 6.297 0 0 1-1.02-1.268l-.059-.095a.923.923 0 0 1-.102-.205c-.038-.147.061-.265.061-.265s.243-.266.356-.41c.11-.14.203-.276.263-.373c.118-.19.155-.385.093-.536c-.28-.684-.57-1.365-.868-2.041c-.059-.134-.234-.23-.393-.249c-.054-.006-.108-.012-.162-.016a3.385 3.385 0 0 0-.403.004l.201-.008Z"/></svg></a>';
$content .= '<a href="#" class="mail"><svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 28 28"><path fill="#9da1a4" d="m3 10.124l10.654 5.541a.75.75 0 0 0 .692 0L25 10.125v9.625a3.25 3.25 0 0 1-3.066 3.245L21.75 23H6.25a3.25 3.25 0 0 1-3.245-3.066L3 19.75v-9.626ZM6.25 5h15.5a3.25 3.25 0 0 1 3.245 3.066L25 8.25v.184l-11 5.72l-11-5.72V8.25a3.25 3.25 0 0 1 3.066-3.245L6.25 5h15.5h-15.5Z"/></svg></a>';
$content .= '</div>';
return $content;
}else{
return $content;
}
};
add_shortcode('social','wpvkp_social_buttons');
add_filter( 'comment_form_fields', 'move_comment_field' );
function move_comment_field( $fields ) {
$comment_field = $fields['comment'];
unset( $fields['comment'] );
$fields['comment'] = $comment_field;
return $fields;
}
function saat() {
return human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' nce';
}
// Aktivasyon srasnda tabloyu olutur
function create_doviz_table_on_activation() {
global $wpdb;
$table_name = $wpdb->prefix . 'doviz';
$charset_collate = $wpdb->get_charset_collate();
$sql = "CREATE TABLE $table_name (
id INT NOT NULL AUTO_INCREMENT,
currency_code VARCHAR(10) NOT NULL,
satis DECIMAL(10, 4) NOT NULL,
alis DECIMAL(10, 4) NOT NULL,
degisim DECIMAL(5, 2) NOT NULL,
PRIMARY KEY (id)
) $charset_collate;";
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
dbDelta($sql);
}
register_activation_hook(__FILE__, 'create_doviz_table_on_activation');
// Cron job'u ayarla
function setup_custom_doviz_cron() {
if (!wp_next_scheduled('custom_doviz_cron_event')) {
wp_schedule_event(time(), 'hourly2', 'custom_doviz_cron_event');
}
}
add_action('wp', 'setup_custom_doviz_cron');
// Cron job'u altr
add_action('custom_doviz_cron_event', 'custom_doviz_cron_job');
// Cron job'u olutur
function custom_doviz_cron_job() {
// API URL
$api_url = 'https://api.genelpara.com/embed/doviz.json';
// API'den veriyi al
$response = wp_remote_get($api_url);
if (is_array($response) && !is_wp_error($response)) {
$data = json_decode($response['body'], true);
if ($data) {
global $wpdb;
$table_name = $wpdb->prefix . 'doviz';
foreach ($data as $currency_code => $entry) {
$wpdb->replace(
$table_name,
array(
'currency_code' => $currency_code,
'satis' => $entry['satis'],
'alis' => $entry['alis'],
'degisim' => $entry['degisim'],
)
);
}
}
}
}
?>
Did this file decode correctly?
Original Code
<?php
/**
* Mevzu functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package Mevzu
*/
if ( ! defined( '_S_VERSION' ) ) {
// Replace the version number of the theme on each release.
define( '_S_VERSION', '1.0.0' );
}
include('inc/ajax.php');
include('inc/wp-bootstrap5.0-pagination.php');
include('inc/bootstrap-5-wordpress-navbar-walker.php');
add_theme_support( 'yoast-seo-breadcrumbs' );
add_image_size( 'gorsel-48-48', 48,48, true);
add_image_size( 'gorsel-936-544', 936, 544, true);
add_image_size( 'gorsel-936-526', 936, 526, true, array( 'center', 'center' ));
// add_image_size( 'gorsel-936-544', 936, 544, true);
// add_image_size( 'gorsel-875-120', 875, 120, true);
// add_image_size( 'gorsel-628-265', 628, 265, true);
// add_image_size( 'gorsel-590-257', 590, 257, true);
// add_image_size( 'gorsel-520-255', 520, 255, true);
add_image_size( 'gorsel-456-243', 456, 243, true);
add_image_size( 'gorsel-400-246', 400, 246, true);
add_image_size( 'gorsel-376-211', 376, 211, true);
add_image_size( 'gorsel-366-238', 366, 205, true);
add_image_size( 'gorsel-305-171', 305, 171, true);
add_image_size( 'gorsel-296-166', 296, 166, true);
// add_image_size( 'gorsel-296-73', 296, 73, true);
add_image_size( 'gorsel-255-166', 255, 143, true);
add_image_size( 'gorsel-200-135', 200, 135, true, array( 'center', 'center' ));
// add_image_size( 'gorsel-190-230', 190, 230, true);
// add_image_size( 'gorsel-146-628', 146, 635, true);
add_image_size( 'gorsel-120-100', 120, 100, array( 'center', 'center' ));
add_image_size( 'gorsel-100-70', 100, 70, true);
add_image_size( 'gorsel-100-60', 100, 60, true);
add_image_size( 'mobil-logo', 200, 35, array( 'center', 'center' ));
// eski bilesenler ve yazi editoru
// add_filter('gutenberg_use_widgets_block_editor', '__return_false');
// add_filter('use_widgets_block_editor', '__return_false');
// add_filter('use_block_editor_for_post', '__return_false');
// eski bilesenler ve yazi editoru
/* if is single page */
function add_bg_white_class_to_body($classes) {
if (is_single()) {
$classes[] = 'bg-white';
}
return $classes;
}
add_filter('body_class', 'add_bg_white_class_to_body');
/* if is single page */
/* Archive baslik listeleme */
function my_theme_archive_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '<span>:</span>', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '<span>#</span>', false );
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>';
} elseif ( is_post_type_archive() ) {
$title = post_type_archive_title( '<span>:</span>', false );
} elseif ( is_tax() ) {
$title = single_term_title( '', false );
} elseif ( is_home() ) {
$title = 'Blog'; // rnek olarak "Blog" yazabilirsiniz veya istediiniz baka bir metin ekleyebilirsiniz
}
return $title;
}
add_filter( 'get_the_archive_title', 'my_theme_archive_title' );
/* Archive baslik listeleme */
/* post views */
function get_post_view() {
$count = get_post_meta( get_the_ID(), 'views_count', true );
return "$count grntleme";
}
function set_post_view() {
$key = 'views_count';
$post_id = get_the_ID();
$count = (int) get_post_meta( $post_id, $key, true );
$count++;
update_post_meta( $post_id, $key, $count );
}
function posts_column_views( $columns ) {
$columns['post_views'] = 'Grntlenme';
return $columns;
}
function posts_custom_column_views( $column ) {
if ( $column === 'post_views') {
echo get_post_view();
}
}
add_filter( 'manage_posts_columns', 'posts_column_views' );
add_action( 'manage_posts_custom_column', 'posts_custom_column_views' );
/* post views */
/* Breadcrumbs */
function custom_breadcrumbs() {
// Settings
$separator = '>';
$breadcrums_id = 'breadcrumbs';
$breadcrums_class = 'breadcrumb';
$home_title = "Anasayfa";
// If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
// $custom_taxonomy = 'product_cat';
// Get the query & post information
global $post,$wp_query;
// Do not display on the homepage
if ( !is_front_page() ) {
// Build the breadcrums
echo '<nav class="breadcrumb" aria-label="breadcrumb"><ol id="' . $breadcrums_id . '" class="' . $breadcrums_class . '">';
// Home page
echo '<li class="breadcrumb-item"><a href="' . get_home_url() . '" title="' . $home_title . '">' . $home_title . '</a></li>';
if ( is_archive() && !is_tax() && !is_category() && !is_tag() ) {
echo '<li class="breadcrumb-item active">' . post_type_archive_title('', false) . '</li>';
} else if ( is_archive() && is_tax() && !is_category() && !is_tag() ) {
// If post is a custom post type
$post_type = get_post_type();
// If it is a custom post type display name and link
if($post_type != 'post') {
$post_type_object = get_post_type_object($post_type);
$post_type_archive = get_post_type_archive_link($post_type);
echo '<li class="breadcrumb-item item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
}
$custom_tax_name = get_queried_object()->name;
echo '<li class="item-current item-archive active">' . $custom_tax_name . '</li>';
} else if ( is_single() ) {
// If post is a custom post type
$post_type = get_post_type();
// If it is a custom post type display name and link
if($post_type != 'post') {
$post_type_object = get_post_type_object($post_type);
$post_type_archive = get_post_type_archive_link($post_type);
echo '<li class="breadcrumb-item item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
}
// Get post category info
$category = get_the_category();
if(!empty($category)) {
// Get last category post is in
$category_values = array_values($category);
$last_category = end($category_values);
// Get parent any categories and create array
$get_cat_parents = rtrim(get_category_parents($last_category->term_id, true, ','),',');
$cat_parents = explode(',',$get_cat_parents);
// Loop through parent categories and store in variable $cat_display
$cat_display = '';
foreach($cat_parents as $parents) {
if($post_type != 'post' && $post_type != 'resmi-ilanlar') {
$cat_display .= '<li class="breadcrumb-item">'.$parents.'</li>';
}
}
}
// If it's a custom post type within a custom taxonomy
// $taxonomy_exists = taxonomy_exists($custom_taxonomy);
// if(empty($last_category) && !empty($custom_taxonomy) && $taxonomy_exists) {
// $taxonomy_terms = get_the_terms( $post->ID, $custom_taxonomy );
// $cat_id = $taxonomy_terms[0]->term_id;
// $cat_nicename = $taxonomy_terms[0]->slug;
// $cat_link = get_term_link($taxonomy_terms[0]->term_id, $custom_taxonomy);
// $cat_name = $taxonomy_terms[0]->name;
// }
// Check if the post is in a category
if(!empty($last_category)) {
echo $cat_display;
echo '<li class="breadcrumb-item active item-current item-' . $post->ID . '">' . get_the_title() . '</li>';
// Else if post is in a custom taxonomy
} else if(!empty($cat_id)) {
echo '<li class="breadcrumb-item breadcrumb-item-' . $cat_id . ' breadcrumb-item-' . $cat_nicename . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $cat_nicename . '" href="' . $cat_link . '" title="' . $cat_name . '">' . $cat_name . '</a></li>';
echo '<li class="breadcrumb-item active item-current item-' . $post->ID . '">' . get_the_title() . '</li>';
} else {
echo '<li class="breadcrumb-item active item-current item-' . $post->ID . '">' . get_the_title() . '</li>';
}
} else if ( is_category() ) {
// Category page
echo '<li class="breadcrumb-item active item-current breadcrumb-item">' . single_cat_title('', false) . '</li>';
} else if ( is_page() ) {
// Standard page
if( $post->post_parent ){
// If child page, get parents
$anc = get_post_ancestors( $post->ID );
// Get parents in the right order
$anc = array_reverse($anc);
// Parent page loop
if ( !isset( $parents ) ) $parents = null;
foreach ( $anc as $ancestor ) {
$parents .= '<li class="item-parent item-parent-' . $ancestor . '"><a class="bread-parent bread-parent-' . $ancestor . '" href="' . get_permalink($ancestor) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li>';
}
// Display parent pages
echo $parents;
// Current page
echo '<li class="breadcrumb-item active item-current item-' . $post->ID . '">' . get_the_title() . '</li>';
} else {
// Just display current page if not parents
echo '<li class="breadcrumb-item active item-current item-' . $post->ID . '">' . get_the_title() . '</li>';
}
} else if ( is_tag() ) {
// Tag page
// Get tag information
$term_id = get_query_var('tag_id');
$taxonomy = 'post_tag';
$args = 'include=' . $term_id;
$terms = get_terms( $taxonomy, $args );
$get_term_id = $terms[0]->term_id;
$get_term_slug = $terms[0]->slug;
$get_term_name = $terms[0]->name;
// Display the tag name
echo '<li class="breadcrumb-item active item-current item-tag-' . $get_term_id . ' item-tag-' . $get_term_slug . '">' . $get_term_name . '</li>';
} elseif ( is_day() ) {
// Day archive
// Year link
echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link( get_the_time('Y') ) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</a></li>';
// Month link
echo '<li class="item-month item-month-' . get_the_time('m') . '"><a class="bread-month bread-month-' . get_the_time('m') . '" href="' . get_month_link( get_the_time('Y'), get_the_time('m') ) . '" title="' . get_the_time('M') . '">' . get_the_time('M') . ' Archives</a></li>';
// Day display
echo '<li class="breadcrumb-item active item-current item-' . get_the_time('j') . '">' . get_the_time('jS') . ' ' . get_the_time('M') . ' Archives</li>';
} else if ( is_month() ) {
// Month Archive
// Year link
echo '<li class="item-year item-year-' . get_the_time('Y') . '"><a class="bread-year bread-year-' . get_the_time('Y') . '" href="' . get_year_link( get_the_time('Y') ) . '" title="' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</a></li>';
// Month display
echo '<li class="active item-month item-month-' . get_the_time('m') . '">' . get_the_time('M') . ' Archives</li>';
} else if ( is_year() ) {
// Display year archive
echo '<li class="breadcrumb-item active item-current item-current-' . get_the_time('Y') . '">' . get_the_time('Y') . ' Archives</li>';
} else if ( is_author() ) {
// Auhor archive
// Get the author information
global $author;
$userdata = get_userdata( $author );
// Display author name
echo '<li class="breadcrumb-item active item-current item-current-' . $userdata->user_nicename . '">' . 'Author: ' . $userdata->display_name . '</li>';
} else if ( get_query_var('paged') ) {
// Paginated archives
echo '<li class="breadcrumb-item active item-current item-current-' . get_query_var('paged') . '">'.__('Page') . ' ' . get_query_var('paged') . '</li>';
} else if ( is_search() ) {
// Search results page
echo '<li class="breadcrumb-item active item-current item-current-' . get_search_query() . '">Arama: ' . get_search_query() . '</li>';
} elseif ( is_404() ) {
// 404 page
echo '<li class="active">' . 'Error 404' . '</li>';
}
echo '</nav></ol>';
}
}
/* Breadcrumbs */
function mevzu_setup() {
load_theme_textdomain( 'mevzu', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus(
array(
'main-menu' => esc_html__( 'Main Menu', 'mevzu' ),
'ust-menu' => esc_html__( 'Ust Menu', 'mevzu' ),
'footer-menu-1' => esc_html__( 'Footer Menu - 1', 'mevzu' ),
'footer-menu-2' => esc_html__( 'Footer Menu - 2', 'mevzu' ),
'footer-menu-3' => esc_html__( 'Footer Menu - 3', 'mevzu' ),
'footer-menu-4' => esc_html__( 'Footer Menu - 4', 'mevzu' ),
)
);
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support(
'html5',
array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
)
);
// Set up the WordPress core custom background feature.
add_theme_support(
'custom-background',
apply_filters(
'mevzu_custom_background_args',
array(
'default-color' => 'ffffff',
'default-image' => '',
)
)
);
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support(
'custom-logo',
array(
'height' => 250,
'width' => 250,
'flex-width' => true,
'flex-height' => true,
)
);
}
add_action( 'after_setup_theme', 'mevzu_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function mevzu_content_width() {
$GLOBALS['content_width'] = apply_filters( 'mevzu_content_width', 640 );
}
add_action( 'after_setup_theme', 'mevzu_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function mevzu_widgets_init() {
register_sidebar(
array(
'name' => esc_html__( 'Sidebar Anasayfa', 'mevzu' ),
'id' => 'sidebar-anasayfa',
'description' => esc_html__( 'Add widgets here.', 'mevzu' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Sidebar Single', 'mevzu' ),
'id' => 'sidebar-single',
'description' => esc_html__( 'Add widgets here.', 'mevzu' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
}
add_action( 'widgets_init', 'mevzu_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function mevzu_scripts() {
wp_enqueue_style( 'mevzu-style', get_stylesheet_uri(), array(), _S_VERSION );
wp_style_add_data( 'mevzu-style', 'rtl', 'replace' );
wp_enqueue_script( 'mevzu-navigation', get_template_directory_uri() . '/js/navigation.js', array(), _S_VERSION, true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'mevzu_scripts' );
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require get_template_directory() . '/inc/template-functions.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
if ( defined( 'JETPACK__VERSION' ) ) {
require get_template_directory() . '/inc/jetpack.php';
}
// Creating the widget
class wpb_widget extends WP_Widget {
function __construct() {
parent::__construct(
// Base ID of your widget
'wpb_widget',
// Widget name will appear in UI
__('WPBeginner Widget', 'wpb_widget_domain'),
// Widget description
array( 'description' => __( 'Sample widget based on WPBeginner Tutorial', 'wpb_widget_domain' ), )
);
}
// Creating widget front-end
public function widget( $args, $instance ) {
$title = apply_filters( 'widget_title', $instance['title'] );
// before and after widget arguments are defined by themes
echo $args['before_widget'];
if ( ! empty( $title ) )
echo $args['before_title'] . $title . $args['after_title'];
// This is where you run the code and display the output
echo __( 'Hello, World!', 'wpb_widget_domain' );
echo $args['after_widget'];
}
// Widget Backend
public function form( $instance ) {
if ( isset( $instance[ 'title' ] ) ) {
$title = $instance[ 'title' ];
}
else {
$title = __( 'New title', 'wpb_widget_domain' );
}
// Widget admin form
?>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
</p>
<?php
}
// Updating widget replacing old instances with new
public function update( $new_instance, $old_instance ) {
$instance = array();
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
return $instance;
}
// Class wpb_widget ends here
}
// Register and load the widget
function wpb_load_widget() {
register_widget( 'wpb_widget' );
}
add_action( 'widgets_init', 'wpb_load_widget' );
// Define path and URL to the ACF plugin.
define( 'MY_ACF_PATH', get_stylesheet_directory() . '/inc/acf/' );
define( 'MY_ACF_URL', get_stylesheet_directory_uri() . '/inc/acf/' );
// Include the ACF plugin.
include_once( MY_ACF_PATH . 'acf.php' );
// Customize the url setting to fix incorrect asset URLs.
add_filter('acf/settings/url', 'my_acf_settings_url');
function my_acf_settings_url( $url ) {
return MY_ACF_URL;
}
// (Optional) Hide the ACF admin menu item.
// add_filter('acf/settings/show_admin', '__return_false');
// When including the PRO plugin, hide the ACF Updates menu
add_filter('acf/settings/show_updates', '__return_false', 100);
// Bileen Tanmlama
function custom_post_list_widget() {
register_widget('Custom_Post_List_Widget');
}
add_action('widgets_init', 'custom_post_list_widget');
// Bileen Snf
class Custom_Post_List_Widget extends WP_Widget {
public function __construct() {
$widget_options = array(
'classname' => 'custom_post_list_widget',
'description' => 'zelletirilebilir haber listeleme',
);
parent::__construct('custom_post_list_widget', ':Mevzu Haber Sralama', $widget_options);
}
public function widget($args, $instance) {
$title = !empty($instance['title']) ? apply_filters('widget_title', $instance['title']) : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
$template = !empty($instance['template']) ? $instance['template'] : 'populer-basliklar';
echo '<div class="sag-widget '.$template.' mb-3 mb-lg-4">';
if ($title) {
echo '<div class="title"><span>' . $title . '</span></div>';
}
if($order_by == 'meta_value_num') {
$args = array(
'post_type' => 'post',
'posts_per_page' => $post_count,
'orderby' => $order_by,
'meta_key' => 'views_count',
'order' => 'DESC',
);
}
else {
$args = array(
'post_type' => 'post',
'posts_per_page' => $post_count,
'orderby' => $order_by,
);
}
$custom_query = new WP_Query($args);
echo '<div class="widget-body">';
if($template == 'populer-basliklar') {
if ($custom_query->have_posts()) {
$count = 0;
while ($custom_query->have_posts()) {
$custom_query->the_post(); $count++;?>
<a href="<?php the_permalink() ?>" class="ripple" data-mdb-ripple-color="light">
<div class="card-body">
<div class="row align-items-center mx-0">
<div class="col-auto">
<span class="no"><?php echo $count ?></span>
</div>
<div class="col ps-0">
<h3 class="card-title"><?php the_title(); ?></h3>
</div>
</div>
</div>
</a>
<?php }
wp_reset_postdata();
} else {
echo 'No posts found.';
}
}
if($template == 'populer-basliklar-2') {
if ($custom_query->have_posts()) {
$count = 0;
while ($custom_query->have_posts()) {
$custom_query->the_post(); $count++; ?>
<a href="<?php the_permalink() ?>" class="ripple" data-mdb-ripple-color="light">
<div class="card-body">
<div class="row align-items-center mx-0">
<div class="col-auto ps-0">
<span class="no"><?php echo $count ?></span>
</div>
<div class="col ps-0">
<h3 class="card-title satir-3"><?php the_title(); ?></h3>
</div>
</div>
</div>
</a>
<?php }
wp_reset_postdata();
} else {
echo 'No posts found.';
}
}
echo '</div>';
echo '</div>';
}
public function form($instance) {
$title = !empty($instance['title']) ? $instance['title'] : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
$template = !empty($instance['template']) ? $instance['template'] : 'populer-basliklar';
?>
<!-- Balk Alan -->
<p>
<label for="<?php echo $this->get_field_id('title'); ?>">Balk:</label>
<input class="widefat" type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($title); ?>">
</p>
<!-- Sralama Seenekleri -->
<p>
<label for="<?php echo $this->get_field_id('order_by'); ?>">Sralama:</label>
<select class="widefat" id="<?php echo $this->get_field_id('order_by'); ?>" name="<?php echo $this->get_field_name('order_by'); ?>">
<option value="date" <?php selected($order_by, 'date'); ?>>Tarihe gre</option>
<option value="meta_value_num" <?php selected($order_by, 'meta_value_num'); ?>>Tklanmaya gre</option>
<option value="category" <?php selected($order_by, 'category'); ?>>Kategoriye gre</option>
</select>
</p>
<!-- kt Adedi -->
<p>
<label for="<?php echo $this->get_field_id('post_count'); ?>">Grntlenecek haber says: </label>
<input class="widefat" type="number" id="<?php echo $this->get_field_id('post_count'); ?>" name="<?php echo $this->get_field_name('post_count'); ?>" value="<?php echo esc_attr($post_count); ?>" min="1" max="20">
</p>
<!-- ablon Seenei -->
<p>
<label for="<?php echo $this->get_field_id('template'); ?>">ablon:</label>
<select class="widefat" id="<?php echo $this->get_field_id('template'); ?>" name="<?php echo $this->get_field_name('template'); ?>">
<option value="populer-basliklar" <?php selected($template, 'populer-basliklar'); ?>>ablon - 1</option>
<option value="populer-basliklar-2" <?php selected($template, 'populer-basliklar-2'); ?>>ablon - 2</option>
</select>
</p>
<?php
}
public function update($new_instance, $old_instance) {
$instance = array();
$instance['title'] = !empty($new_instance['title']) ? sanitize_text_field($new_instance['title']) : '';
$instance['order_by'] = !empty($new_instance['order_by']) ? sanitize_text_field($new_instance['order_by']) : 'date';
$instance['post_count'] = !empty($new_instance['post_count']) ? absint($new_instance['post_count']) : 5;
$instance['template'] = !empty($new_instance['template']) ? sanitize_text_field($new_instance['template']) : 'populer-basliklar';
return $instance;
}
}
// Bileen Tanmlama
function custom_bilesen_egazete() {
register_widget('bilesen_egazete');
}
add_action('widgets_init', 'custom_bilesen_egazete');
// Bileen Snf
class bilesen_egazete extends WP_Widget {
public function __construct() {
$widget_options = array(
'classname' => 'custom_bilesen_egazete',
'description' => 'zelletirilebilir e-gazete listeleme',
);
parent::__construct('custom_bilesen_egazete', ':Mevzu E-Gazete', $widget_options);
}
public function widget($args, $instance) {
$title = !empty($instance['title']) ? apply_filters('widget_title', $instance['title']) : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
echo '<div class="sag-widget sag-egazete mb-3 mb-lg-4">';
if ($title) {
echo '<div class="title"><span>' . $title . '</span></div>';
}
if($order_by == 'meta_value_num') {
$args = array(
'post_type' => 'e-gazete',
'posts_per_page' => $post_count,
'orderby' => $order_by,
'meta_key' => 'views_count',
'order' => 'DESC',
);
}
else {
$args = array(
'post_type' => 'e-gazete',
'posts_per_page' => $post_count,
'orderby' => $order_by,
);
}
$custom_query = new WP_Query($args);
echo '<div class="widget-body">';
if ($custom_query->have_posts()) {
$count = 0; ?>
<div id="owl-egazeteslider" class="owl-carousel">
<?php while ($custom_query->have_posts()) {
$custom_query->the_post(); $count++;?>
<div class="item">
<div class="card card-kucuk">
<a href="<?php the_permalink() ?>" class="ripple" data-mdb-ripple-color="light">
<img src="<?php echo '/wp-content/uploads/e-gazete/auto-thumbnails/'. get_the_ID() .'.png'; ?> " alt="<?php the_title(); ?>">
<div class="card-body">
<h3 class="card-title satir-2"><?php echo get_the_date("d.m.Y"); ?></h3>
<span class="details">
Tarihli E-Gazete
</span>
</div>
</a>
</div>
</div>
<?php }
wp_reset_postdata(); ?>
</div>
<a href="<?php echo get_page_uri(117336); ?>" class="btn btn-primary">Tmn Gster</a>
<?php
} else {
echo 'Bulunamad';
}
echo '</div>';
echo '</div>';
}
public function form($instance) {
$title = !empty($instance['title']) ? $instance['title'] : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
?>
<!-- Balk Alan -->
<p>
<label for="<?php echo $this->get_field_id('title'); ?>">Balk:</label>
<input class="widefat" type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($title); ?>">
</p>
<!-- Sralama Seenekleri -->
<p>
<label for="<?php echo $this->get_field_id('order_by'); ?>">Sralama:</label>
<select class="widefat" id="<?php echo $this->get_field_id('order_by'); ?>" name="<?php echo $this->get_field_name('order_by'); ?>">
<option value="date" <?php selected($order_by, 'date'); ?>>Tarihe gre</option>
<option value="meta_value_num" <?php selected($order_by, 'meta_value_num'); ?>>Tklanmaya gre</option>
<option value="category" <?php selected($order_by, 'category'); ?>>Kategoriye gre</option>
</select>
</p>
<!-- kt Adedi -->
<p>
<label for="<?php echo $this->get_field_id('post_count'); ?>">Grntlenecek haber says: </label>
<input class="widefat" type="number" id="<?php echo $this->get_field_id('post_count'); ?>" name="<?php echo $this->get_field_name('post_count'); ?>" value="<?php echo esc_attr($post_count); ?>" min="1" max="20">
</p>
<?php
}
public function update($new_instance, $old_instance) {
$instance = array();
$instance['title'] = !empty($new_instance['title']) ? sanitize_text_field($new_instance['title']) : '';
$instance['order_by'] = !empty($new_instance['order_by']) ? sanitize_text_field($new_instance['order_by']) : 'date';
$instance['post_count'] = !empty($new_instance['post_count']) ? absint($new_instance['post_count']) : 5;
$instance['template'] = !empty($new_instance['template']) ? sanitize_text_field($new_instance['template']) : 'populer-basliklar';
return $instance;
}
}
// Bileen Tanmlama
function custom_bilesen_videohaberler() {
register_widget('bilesen_videohaberler');
}
add_action('widgets_init', 'custom_bilesen_videohaberler');
// Bileen Snf
class bilesen_videohaberler extends WP_Widget {
public function __construct() {
$widget_options = array(
'classname' => 'custom_bilesen_videohaberler',
'description' => 'zelletirilebilir videolu haberleri listeleme',
);
parent::__construct('custom_bilesen_videohaberler', ':Mevzu Video Haberler', $widget_options);
}
public function widget($args, $instance) {
$title = !empty($instance['title']) ? apply_filters('widget_title', $instance['title']) : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
echo '<div class="sag-widget video-haberler mb-3 mb-lg-4">';
if ($title) {
echo '<div class="title"><span>' . $title . '</span></div>';
}
if($order_by == 'meta_value_num') {
$args = array(
'post_type' => 'post',
'posts_per_page' => $post_count,
'orderby' => $order_by,
'meta_key' => 'views_count',
'order' => 'DESC',
'category_name' => 'Video Galerisi',
'meta_query' => array(
'relation' => 'AND', // Hem kategori hem de ne kan grseli koulunu kontrol ediyoruz
array(
'key' => '_thumbnail_id', // Bu, ne kan grseli kontrol eder
'compare' => 'EXISTS', // ne kan grseli olanlar alr
),
array(
'taxonomy' => 'category', // Kategori sorgusu yapacaz
'field' => 'slug', // Kategori alann slug olarak kullanacaz
'terms' => 'video-galerisi', // Video Galerisi kategorisinin slug'
),
),
);
}
else {
$args = array(
'post_type' => 'post',
'posts_per_page' => $post_count,
'orderby' => $order_by,
'category_name' => 'Video Galerisi',
'meta_query' => array(
'relation' => 'AND', // Hem kategori hem de ne kan grseli koulunu kontrol ediyoruz
array(
'key' => '_thumbnail_id', // Bu, ne kan grseli kontrol eder
'compare' => 'EXISTS', // ne kan grseli olanlar alr
),
array(
'taxonomy' => 'category', // Kategori sorgusu yapacaz
'field' => 'slug', // Kategori alann slug olarak kullanacaz
'terms' => 'video-galerisi', // Video Galerisi kategorisinin slug'
),
),
);
}
$custom_query = new WP_Query($args);
echo '<div class="widget-body">';
if ($custom_query->have_posts()) {
$count = 0; ?>
<?php while ($custom_query->have_posts()) {
$custom_query->the_post(); $count++;?>
<a href="<?php the_permalink() ?>" class="ripple" data-mdb-ripple-color="light">
<div class="card-body">
<div class="row align-items-center mx-0">
<div class="col-auto">
<?php the_post_thumbnail('gorsel-100-60', ['title' => get_the_title()]); ?>
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 15 15"><path fill="currentColor" d="M4.79 2.093A.5.5 0 0 0 4 2.5v10a.5.5 0 0 0 .79.407l7-5a.5.5 0 0 0 0-.814l-7-5Z"/></svg>
</div>
<div class="col ps-0">
<h3 class="card-title"><?php the_title() ?></h3>
</div>
</div>
</div>
</a>
<?php }
wp_reset_postdata(); ?>
<?php
} else {
echo 'Bulunamad';
}
echo '</div>';
echo '</div>';
}
public function form($instance) {
$title = !empty($instance['title']) ? $instance['title'] : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
?>
<!-- Balk Alan -->
<p>
<label for="<?php echo $this->get_field_id('title'); ?>">Balk:</label>
<input class="widefat" type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($title); ?>">
</p>
<!-- Sralama Seenekleri -->
<p>
<label for="<?php echo $this->get_field_id('order_by'); ?>">Sralama:</label>
<select class="widefat" id="<?php echo $this->get_field_id('order_by'); ?>" name="<?php echo $this->get_field_name('order_by'); ?>">
<option value="date" <?php selected($order_by, 'date'); ?>>Tarihe gre</option>
<option value="meta_value_num" <?php selected($order_by, 'meta_value_num'); ?>>Tklanmaya gre</option>
<option value="category" <?php selected($order_by, 'category'); ?>>Kategoriye gre</option>
</select>
</p>
<!-- kt Adedi -->
<p>
<label for="<?php echo $this->get_field_id('post_count'); ?>">Grntlenecek haber says: </label>
<input class="widefat" type="number" id="<?php echo $this->get_field_id('post_count'); ?>" name="<?php echo $this->get_field_name('post_count'); ?>" value="<?php echo esc_attr($post_count); ?>" min="1" max="20">
</p>
<?php
}
public function update($new_instance, $old_instance) {
$instance = array();
$instance['title'] = !empty($new_instance['title']) ? sanitize_text_field($new_instance['title']) : '';
$instance['order_by'] = !empty($new_instance['order_by']) ? sanitize_text_field($new_instance['order_by']) : 'date';
$instance['post_count'] = !empty($new_instance['post_count']) ? absint($new_instance['post_count']) : 5;
$instance['template'] = !empty($new_instance['template']) ? sanitize_text_field($new_instance['template']) : 'populer-basliklar';
return $instance;
}
}
// Bileen Tanmlama
function custom_bilesen_skortablosu() {
register_widget('bilesen_skortablosu');
}
add_action('widgets_init', 'custom_bilesen_skortablosu');
// Bileen Snf
class bilesen_skortablosu extends WP_Widget {
public function __construct() {
$widget_options = array(
'classname' => 'custom_bilesen_skortablosu',
'description' => 'zelletirilebilir skor tablosu listeleme',
);
parent::__construct('custom_bilesen_skortablosu', ':Mevzu Skor Tablosu', $widget_options);
}
public function widget($args, $instance) {?>
<div class="widget-puandurumu py-2 px-3 mb-3 mb-lg-4">
<div class="row puandurumu-baslik">
<div class="col-1">#</div>
<div class="col-8">Takmlar</div>
<div class="col-1">O</div>
<div class="col-1">AV</div>
<div class="col-1">P</div>
</div>
<?php $arr = array("Adana Demir","Alanyaspor","MKE Ankaragc","Antalyaspor","Beikta","Karagmrk","Fenerbahe","Galatasaray","Gaziantep FK","Hatayspor","Baakehir","Kasmpaa","Kayserispor","Konyaspor","Pendikspor",". Rizespor","Samsunspor","Sivasspor","Trabzonspor","stanbulspor","Trabzonspor");
for ($i = 1; $i < count($arr); $i++) { ?>
<?php if($i == 9) : ?>
<div class="row show-button">
<div class="col-12 text-center">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12a1 1 0 1 0 2 0a1 1 0 1 0-2 0m7 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0m7 0a1 1 0 1 0 2 0a1 1 0 1 0-2 0"/></svg>
</div>
</div>
<?php endif; ?>
<div class="row takim takim-<?php echo $i ?>">
<div class="col-1"><span><?php echo $i; ?></span></div>
<div class="col-8"><?php echo $arr[$i]; ?></div>
<div class="col-1">0</div>
<div class="col-1">0</div>
<div class="col-1">0</div>
</div>
<?php } ?>
<a href="#" class="btn btn-primary">Puan Durumu</a>
</div>
<?php
}
public function form($instance) {
$title = !empty($instance['title']) ? $instance['title'] : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
?>
<!-- Balk Alan -->
<p>
<label for="<?php echo $this->get_field_id('title'); ?>">Balk:</label>
<input class="widefat" type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($title); ?>">
</p>
<!-- Sralama Seenekleri -->
<p>
<label for="<?php echo $this->get_field_id('order_by'); ?>">Sralama:</label>
<select class="widefat" id="<?php echo $this->get_field_id('order_by'); ?>" name="<?php echo $this->get_field_name('order_by'); ?>">
<option value="date" <?php selected($order_by, 'date'); ?>>Tarihe gre</option>
<option value="meta_value_num" <?php selected($order_by, 'meta_value_num'); ?>>Tklanmaya gre</option>
<option value="category" <?php selected($order_by, 'category'); ?>>Kategoriye gre</option>
</select>
</p>
<!-- kt Adedi -->
<p>
<label for="<?php echo $this->get_field_id('post_count'); ?>">Grntlenecek haber says: </label>
<input class="widefat" type="number" id="<?php echo $this->get_field_id('post_count'); ?>" name="<?php echo $this->get_field_name('post_count'); ?>" value="<?php echo esc_attr($post_count); ?>" min="1" max="20">
</p>
<?php
}
public function update($new_instance, $old_instance) {
$instance = array();
$instance['title'] = !empty($new_instance['title']) ? sanitize_text_field($new_instance['title']) : '';
$instance['order_by'] = !empty($new_instance['order_by']) ? sanitize_text_field($new_instance['order_by']) : 'date';
$instance['post_count'] = !empty($new_instance['post_count']) ? absint($new_instance['post_count']) : 5;
return $instance;
}
}
// Bileen Tanmlama
function custom_bilesen_reklam() {
register_widget('bilesen_reklam');
}
add_action('widgets_init', 'custom_bilesen_reklam');
// Bileen Snf
class bilesen_reklam extends WP_Widget {
public function __construct() {
$widget_options = array(
'classname' => 'custom_bilesen_reklam',
'description' => 'zelletirilebilir reklam alan',
);
parent::__construct('custom_bilesen_reklam', ':Mevzu Reklam', $widget_options);
}
public function widget($args, $instance) {
$title = !empty($instance['title']) ? apply_filters('widget_title', $instance['title']) : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
echo '<div class="reklam h-240 mb-3 mb-lg-4">
Reklam Alan<b>296x240</b>
</div>';
}
public function form($instance) {
$title = !empty($instance['title']) ? $instance['title'] : '';
$order_by = !empty($instance['order_by']) ? $instance['order_by'] : 'date';
$post_count = !empty($instance['post_count']) ? absint($instance['post_count']) : 5;
?>
<!-- Balk Alan -->
<p>
Bu alan <span class="dashicons dashicons-megaphone"></span> <a href="./admin.php?page=mevzu-reklamlar">Reklamlar</a> blmnde yer alan <b>Bileen Reklam</b> blmnden dzenlenebilir.
</p>
<?php
}
public function update($new_instance, $old_instance) {
$instance = array();
$instance['title'] = !empty($new_instance['title']) ? sanitize_text_field($new_instance['title']) : '';
$instance['order_by'] = !empty($new_instance['order_by']) ? sanitize_text_field($new_instance['order_by']) : 'date';
$instance['post_count'] = !empty($new_instance['post_count']) ? absint($new_instance['post_count']) : 5;
$instance['template'] = !empty($new_instance['template']) ? sanitize_text_field($new_instance['template']) : 'populer-basliklar';
return $instance;
}
}
add_filter( 'wp_kses_allowed_html', 'acf_add_allowed_svg_tag', 10, 2 );
function acf_add_allowed_svg_tag( $tags, $context ) {
if ( $context === 'acf' ) {
$tags['svg'] = array(
'xmlns' => true,
'width' => true,
'height' => true,
'preserveAspectRatio' => true,
'fill' => true,
'viewbox' => true,
'role' => true,
'aria-hidden' => true,
'focusable' => true,
);
$tags['path'] = array(
'd' => true,
'fill' => true,
'stroke' => true,
'stroke-linecap' => true,
'stroke-linejoin' => true,
'stroke-width' => true,
);
$tags['g'] = array(
'fill' => true,
'transform' => true,
'stroke' => true,
'stroke-linecap' => true,
'stroke-linejoin' => true,
'stroke-width' => true,
'clip-path' => true
);
}
return $tags;
}
/* Options Pages */
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Ayarlar',
'menu_title' => 'Mevzu Ayarlar',
'menu_slug' => 'mevzu-ayarlar',
'icon_url' => 'dashicons-admin-generic',
));
acf_add_options_page(array(
'page_title' => 'Reklam Ayarlar',
'menu_title' => 'Reklamlar',
'menu_slug' => 'mevzu-reklamlar',
'icon_url' => 'dashicons-megaphone',
'position' => 7
));
}
/* Options Pages */
/* Admin theme */
function wpacg_mevzu_admin_color_scheme() {
$theme_dir = get_stylesheet_directory_uri();
wp_admin_css_color( 'mevzu', __( 'mevzu' ),
$theme_dir . '/css/admin_mevzu.css',
array( '#222222', '#fff', '#d54e21', '#c90914' )
);
}
add_action( 'admin_init', 'wpacg_mevzu_admin_color_scheme' );
/* Admin theme */
/* Admin page logo */
function wpb_custom_logo() {
echo '
<style type="text/css">
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
background-image: url(' . get_bloginfo('stylesheet_directory') . '/img/favicon.jpg) !important;
background-size:cover;
background-position: 0 0;
color:rgba(0, 0, 0, 0);
}
#wpadminbar #wp-admin-bar-wp-logo.hover > .ab-item .ab-icon {
background-position: 0 0;
}
</style>
';
}
add_action('wp_before_admin_bar_render', 'wpb_custom_logo');
/* Admin page logo */
/* Remove jQuery Migrate */
function remove_jquery_migrate( $scripts ) {
if ( ! is_admin() && isset( $scripts->registered['jquery'] ) ) {
$script = $scripts->registered['jquery'];
if ( $script->deps ) {
$script->deps = array_diff( $script->deps, array( 'jquery-migrate' ) );
}
}
}
add_action( 'wp_default_scripts', 'remove_jquery_migrate' );
/* Remove jQuery Migrate */
/* Custom Posts Name */
function custom_change_post_labels( $args, $post_type ) {
if ( $post_type === 'post' ) { // Check if it's the default "post" post type
$new_name = 'Haberler'; // Replace 'Your Custom Name' with the name you want to use
$new_icon = 'dashicons-admin-page'; // Replace 'dashicons-star-filled' with the Dashicon class or URL of the custom icon you want to use
$args['labels']['name'] = $new_name;
$args['labels']['singular_name'] = $new_name;
$args['menu_icon'] = $new_icon;
}
return $args;
}
add_filter( 'register_post_type_args', 'custom_change_post_labels', 10, 2 );
/* Custom Posts Name */
/* Default thumbnail */
/* Default thumbnail */
/* Comment Form */
/* Comment Form */
/* Custom WP Login */
function ppwp_custom_login_logo() { ?>
<style type="text/css">
#login{padding: 7rem 1rem 0 1rem !important;}
#loginform{border-radius: .25rem;}
#login h1 a, .login h1 a {
background-image: url(<?php echo get_template_directory_uri() . '/img/logo_admin.png' ?>);
height:44px;
width:320px;
background-size: contain;
background-repeat: no-repeat;
padding-bottom: 10px;
}
#nav{text-align: center;}
#backtoblog{display: none;}
.kerem{text-align: center;margin-top: 1.5rem !important;}
.kerem a{opacity: 1;display: inline-block;text-decoration: none;color: #000;}
.kerem a:focus{box-shadow: none !important;}
.kerem a:hover{opacity: .8;color: currentColor;}
.kerem img{width: 32px;}
.privacy-policy-page-link{display: none;}
</style>
<?php }
add_action( 'login_enqueue_scripts', 'ppwp_custom_login_logo' );
function ppwp_custom_login_url() {
return home_url();
}
add_filter( 'login_headerurl', 'ppwp_custom_login_url' );
function ppwp_login_logo_url_redirect() {
return get_bloginfo('url');
}
add_filter( 'login_headertitle', 'ppwp_login_logo_url_redirect' );
add_filter( 'login_display_language_dropdown', '__return_false' );
function custom_login_footer_text() { ?>
<div class="kerem">
<a href="http://kkerem.github.io/" target="_blank">
<img src="<?php bloginfo('template_url')?>/img/kkerem.png" title="Kerem ER">
</a>
</div>
<?php }
add_action( 'login_footer', 'custom_login_footer_text' );
function custom_admin_title( $admin_title, $title ) {
if ( is_admin() ) {
$admin_title = get_bloginfo( 'name' ) . ' ‹ ' . $title;
}
return $admin_title;
}
add_filter( 'admin_title', 'custom_admin_title', 10, 2 );
function custom_login_title( $login_title ) {
// Replace "WordPress" with an empty string to remove it from the title
$login_title = get_bloginfo( 'name' );
return $login_title;
}
add_filter( 'login_title', 'custom_login_title' );
/* Custom WP Login */
function fb_opengraph() {
if(is_single()) {
if(has_post_thumbnail(get_the_ID())) {
$img_src = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'gorsel-936-526')[0];
} ?>
<meta property="og:title" content="<?php echo the_title(); ?>"/>
<meta property="og:description" content="<?php echo strip_tags(mb_strimwidth(get_the_content(), 0, 300, '...')); ?>"/>
<meta property="og:type" content="article"/>
<meta property="og:url" content="<?php echo the_permalink(); ?>"/>
<meta property="og:site_name" content="<?php echo get_bloginfo(); ?>"/>
<meta property="og:image" content="<?php echo $img_src; ?>"/>
<?php }
}
add_action('wp_head', 'fb_opengraph', 5);
// Function to handle the thumbnail request
function get_the_post_thumbnail_src($img)
{
return (preg_match('~\bsrc="([^"]++)"~', $img, $matches)) ? $matches[1] : '';
}
function wpvkp_social_buttons($content) {
global $post;
if(is_singular() || is_home()){
$sb_url = urlencode(get_permalink());
$sb_title = str_replace( ' ', '%20', get_the_title());
$sb_thumb = get_the_post_thumbnail_src(get_the_post_thumbnail());
$twitterURL = 'https://twitter.com/intent/tweet?text='.$sb_title.'&url='.$sb_url.'&via=wpvkp';
$facebookURL = 'https://www.facebook.com/sharer/sharer.php?u='.$sb_url;
$bufferURL = 'https://bufferapp.com/add?url='.$sb_url.'&text='.$sb_title;
$whatsappURL = 'whatsapp://send?text='.$sb_title . ' ' . $sb_url;
$linkedInURL = 'https://www.linkedin.com/shareArticle?mini=true&url='.$sb_url.'&title='.$sb_title;
if(!empty($sb_thumb)) {
$pinterestURL = 'https://pinterest.com/pin/create/button/?url='.$sb_url.'&media='.$sb_thumb[0].'&description='.$sb_title;
}
else {
$pinterestURL = 'https://pinterest.com/pin/create/button/?url='.$sb_url.'&description='.$sb_title;
}
$pinterestURL = 'https://pinterest.com/pin/create/button/?url='.$sb_url.'&media='.$sb_thumb[0].'&description='.$sb_title;
$gplusURL ='https://plus.google.com/share?url='.$sb_title.'';
$content .= '<div class="col-12 col-md-auto ms-auto pe-lg-0 paylas px-0"><span class="small pe-2 d-none d-lg-inline-block">Payla: </span>';
$content .= '<a class="facebook" href="'.$facebookURL.'" target="_blank" rel="nofollow"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#4565a0" d="M14 13.5h2.5l1-4H14v-2c0-1.03 0-2 2-2h1.5V2.14c-.326-.043-1.557-.14-2.857-.14C11.928 2 10 3.657 10 6.7v2.8H7v4h3V22h4v-8.5Z"/></svg></a>';
$content .= '<a class="twitter" href="'. $twitterURL .'" target="_blank" rel="nofollow"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#64b6ef" d="M22.46 6c-.77.35-1.6.58-2.46.69c.88-.53 1.56-1.37 1.88-2.38c-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29c0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15c0 1.49.75 2.81 1.91 3.56c-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07a4.28 4.28 0 0 0 4 2.98a8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21C16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56c.84-.6 1.56-1.36 2.14-2.23Z"></path></svg></a>';
$content .= '<a class="whatsapp" href="'.$whatsappURL.'" target="_blank" rel="nofollow"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#25d366" d="M12.001 2c5.523 0 10 4.477 10 10s-4.477 10-10 10a9.954 9.954 0 0 1-5.03-1.355L2.005 22l1.352-4.968A9.953 9.953 0 0 1 2.001 12c0-5.523 4.477-10 10-10ZM8.593 7.3l-.2.008a.961.961 0 0 0-.372.1a1.293 1.293 0 0 0-.294.228c-.12.113-.188.211-.261.306A2.73 2.73 0 0 0 6.9 9.62c.002.49.13.967.33 1.413c.409.902 1.082 1.857 1.97 2.742c.214.213.424.427.65.626a9.448 9.448 0 0 0 3.84 2.046l.568.087c.185.01.37-.004.556-.013a1.99 1.99 0 0 0 .833-.231a4.83 4.83 0 0 0 .383-.22s.043-.028.125-.09c.135-.1.218-.171.33-.288c.083-.086.155-.187.21-.302c.078-.163.156-.474.188-.733c.024-.198.017-.306.014-.373c-.004-.107-.093-.218-.19-.265l-.582-.261s-.87-.379-1.402-.621a.497.497 0 0 0-.176-.041a.482.482 0 0 0-.378.127c-.005-.002-.072.055-.795.931a.35.35 0 0 1-.368.13a1.43 1.43 0 0 1-.191-.066c-.124-.052-.167-.072-.252-.108a6.025 6.025 0 0 1-1.575-1.003c-.126-.11-.243-.23-.363-.346a6.297 6.297 0 0 1-1.02-1.268l-.059-.095a.923.923 0 0 1-.102-.205c-.038-.147.061-.265.061-.265s.243-.266.356-.41c.11-.14.203-.276.263-.373c.118-.19.155-.385.093-.536c-.28-.684-.57-1.365-.868-2.041c-.059-.134-.234-.23-.393-.249c-.054-.006-.108-.012-.162-.016a3.385 3.385 0 0 0-.403.004l.201-.008Z"/></svg></a>';
$content .= '<a href="#" class="mail"><svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 28 28"><path fill="#9da1a4" d="m3 10.124l10.654 5.541a.75.75 0 0 0 .692 0L25 10.125v9.625a3.25 3.25 0 0 1-3.066 3.245L21.75 23H6.25a3.25 3.25 0 0 1-3.245-3.066L3 19.75v-9.626ZM6.25 5h15.5a3.25 3.25 0 0 1 3.245 3.066L25 8.25v.184l-11 5.72l-11-5.72V8.25a3.25 3.25 0 0 1 3.066-3.245L6.25 5h15.5h-15.5Z"/></svg></a>';
$content .= '</div>';
return $content;
}else{
return $content;
}
};
add_shortcode('social','wpvkp_social_buttons');
add_filter( 'comment_form_fields', 'move_comment_field' );
function move_comment_field( $fields ) {
$comment_field = $fields['comment'];
unset( $fields['comment'] );
$fields['comment'] = $comment_field;
return $fields;
}
function saat() {
return human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' nce';
}
// Aktivasyon srasnda tabloyu olutur
function create_doviz_table_on_activation() {
global $wpdb;
$table_name = $wpdb->prefix . 'doviz';
$charset_collate = $wpdb->get_charset_collate();
$sql = "CREATE TABLE $table_name (
id INT NOT NULL AUTO_INCREMENT,
currency_code VARCHAR(10) NOT NULL,
satis DECIMAL(10, 4) NOT NULL,
alis DECIMAL(10, 4) NOT NULL,
degisim DECIMAL(5, 2) NOT NULL,
PRIMARY KEY (id)
) $charset_collate;";
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
dbDelta($sql);
}
register_activation_hook(__FILE__, 'create_doviz_table_on_activation');
// Cron job'u ayarla
function setup_custom_doviz_cron() {
if (!wp_next_scheduled('custom_doviz_cron_event')) {
wp_schedule_event(time(), 'hourly2', 'custom_doviz_cron_event');
}
}
add_action('wp', 'setup_custom_doviz_cron');
// Cron job'u altr
add_action('custom_doviz_cron_event', 'custom_doviz_cron_job');
// Cron job'u olutur
function custom_doviz_cron_job() {
// API URL
$api_url = 'https://api.genelpara.com/embed/doviz.json';
// API'den veriyi al
$response = wp_remote_get($api_url);
if (is_array($response) && !is_wp_error($response)) {
$data = json_decode($response['body'], true);
if ($data) {
global $wpdb;
$table_name = $wpdb->prefix . 'doviz';
foreach ($data as $currency_code => $entry) {
$wpdb->replace(
$table_name,
array(
'currency_code' => $currency_code,
'satis' => $entry['satis'],
'alis' => $entry['alis'],
'degisim' => $entry['degisim'],
)
);
}
}
}
}
Function Calls
None |
Stats
MD5 | 7d4942cb569dd866f0eff8db16ab8cf4 |
Eval Count | 0 |
Decode Time | 161 ms |