From 54804943acccf08c44d9ebf2c8004c7234586550 Mon Sep 17 00:00:00 2001 From: heydar Date: Fri, 30 May 2025 19:55:20 +0330 Subject: [PATCH] =?UTF-8?q?=D8=A7=D8=B6=D8=A7=D9=81=D9=87=20=DA=A9=D8=B1?= =?UTF-8?q?=D8=AF=D9=86=20=D8=A7=D8=A8=D8=B2=D8=A7=D8=B1=DA=A9=20=D8=A7?= =?UTF-8?q?=D8=AE=D8=AA=D8=B5=D8=A7=D8=B5=DB=8C=20=D8=A2=D8=AE=D8=B1=DB=8C?= =?UTF-8?q?=D9=86=20=D9=85=D8=B7=D9=84=D8=A8=20=D9=88=20=D9=BE=D8=A7=DB=8C?= =?UTF-8?q?=D8=A7=D9=86=20=D8=AF=D8=A7=DB=8C=D9=86=D8=A7=D9=85=DB=8C=DA=A9?= =?UTF-8?q?=20=DA=A9=D8=B1=D8=AF=D9=86=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions.php | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++ index.php | 2 -- sidebar.php | 29 +++++------------- 3 files changed, 89 insertions(+), 23 deletions(-) diff --git a/functions.php b/functions.php index 716c2d5..7b2b2b6 100644 --- a/functions.php +++ b/functions.php @@ -64,6 +64,14 @@ function Hefz_Register_Widget(){ 'before_widget' => '
', 'after_widget' => "
\n", ) ); + + register_sidebar( array( + 'name' => __('سایدر سایت'), + 'id' => 'sidbar-widget', + 'description' => __('این بخش مربوط به ساید بار سایت میباشد'), + 'before_widget' => '
', + 'after_widget' => "
\n", + ) ); } add_action('widgets_init', 'Hefz_Register_Widget'); @@ -96,3 +104,76 @@ function custom_breadcrumbs() { echo 'نتایج جستجو برای "' . get_search_query() . '"'; } } + + + +class Hefz_Register_Widget_Post extends WP_Widget { + + function __construct() { + // Instantiate the parent object. + parent::__construct( false, __( 'حفظ | ابزارک آخرین مطالب') ); + + } + + + function widget( $args, $instance ) { + + //شروع بخش آخرین مقالات + $args = array('post_type' => 'post', + 'posts_per_page' => $instance['recentcont'] + ); + $query = new WP_Query($args); + // The Query. + $the_query = new WP_Query( $args ); + ?> +
+ + have_posts() ) { + while ( $the_query->have_posts() ) { + $the_query->the_post();?> +
+ +

+
+ +
+ + + + + > + -
- \ No newline at end of file diff --git a/sidebar.php b/sidebar.php index 149249e..37e14c7 100644 --- a/sidebar.php +++ b/sidebar.php @@ -1,23 +1,10 @@ \ No newline at end of file