Mozahidur Rahman 1 éve
szülő
commit
da88522469

+ 14 - 0
css/theme-styles.css

@@ -1628,4 +1628,18 @@ hr {
 
 body.archive aside#secondary{
   display: none;
+}
+
+
+
+.portfolio-item {
+	border-bottom: 1px solid #999;
+}
+
+.portfolio-title {
+    clear: none;
+}
+
+.portfolio-logo {
+    outline: 2px solid #ebebeb;
 }

+ 3 - 1
functions.php

@@ -197,6 +197,8 @@ if (defined('JETPACK__VERSION')) {
 /**
  * Theme option and custom fields settings
  */
+// Custom Blocks
+include_once(get_stylesheet_directory() . '/inc/custom-blocks.php');
 
 // ACF
 include_once(get_template_directory() . '/inc/acf/acf.php');
@@ -217,7 +219,7 @@ include_once(get_stylesheet_directory() . '/inc/custom-post-type.php');
 // include_once( get_stylesheet_directory() . '/inc/menus.php' );
 
 // Theme Settings
-include_once( get_stylesheet_directory() . '/inc/theme-settings.php' );
+include_once(get_stylesheet_directory() . '/inc/theme-settings.php');
 
 // Shortcodes
 // include_once( get_stylesheet_directory() . '/inc/shortcodes.php' );

+ 90 - 0
inc/acf-json/group_64534cae361a7.json

@@ -0,0 +1,90 @@
+{
+    "key": "group_64534cae361a7",
+    "title": "Block - Faculty API",
+    "fields": [
+        {
+            "key": "field_64534cae08e9a",
+            "label": "Logo",
+            "name": "logo",
+            "aria-label": "",
+            "type": "image",
+            "instructions": "",
+            "required": 0,
+            "conditional_logic": 0,
+            "wrapper": {
+                "width": "",
+                "class": "",
+                "id": ""
+            },
+            "return_format": "array",
+            "preview_size": "medium",
+            "library": "all",
+            "min_width": 0,
+            "min_height": 0,
+            "min_size": 0,
+            "max_width": 0,
+            "max_height": 0,
+            "max_size": 0,
+            "mime_types": ""
+        },
+        {
+            "key": "field_64534cec08e9b",
+            "label": "Title",
+            "name": "title",
+            "aria-label": "",
+            "type": "text",
+            "instructions": "",
+            "required": 0,
+            "conditional_logic": 0,
+            "wrapper": {
+                "width": "",
+                "class": "",
+                "id": ""
+            },
+            "default_value": "",
+            "maxlength": "",
+            "placeholder": "",
+            "prepend": "",
+            "append": ""
+        },
+        {
+            "key": "field_64534cf308e9c",
+            "label": "Description",
+            "name": "description",
+            "aria-label": "",
+            "type": "wysiwyg",
+            "instructions": "",
+            "required": 0,
+            "conditional_logic": 0,
+            "wrapper": {
+                "width": "",
+                "class": "",
+                "id": ""
+            },
+            "tabs": "all",
+            "toolbar": "full",
+            "media_upload": 1,
+            "default_value": "",
+            "delay": 0
+        }
+    ],
+    "location": [
+        [
+            {
+                "param": "block",
+                "operator": "==",
+                "value": "acf\/portfolio-item"
+            }
+        ]
+    ],
+    "menu_order": 0,
+    "position": "normal",
+    "style": "default",
+    "label_placement": "top",
+    "instruction_placement": "label",
+    "hide_on_screen": "",
+    "active": true,
+    "description": "",
+    "show_in_rest": 0,
+    "modified": 1683180815
+}

+ 22 - 0
inc/custom-blocks.php

@@ -0,0 +1,22 @@
+<?php
+
+function acf_portfolio_item_block()
+{
+
+    // check function exists
+    if (function_exists('acf_register_block')) {
+
+        // register a portfolio item block
+        acf_register_block(array(
+            'name'                => 'portfolio-item',
+            'title'                => __('Portfolio Item'),
+            'description'        => __('A custom block for portfolio items.'),
+            'render_template'    => 'template-parts/blocks/portfolio-item/block-portfolio-item.php',
+            'category'            => 'layout',
+            'icon'                => 'excerpt-view',
+            'keywords'            => array('portfolio'),
+        ));
+    }
+}
+
+add_action('acf/init', 'acf_portfolio_item_block');

+ 1 - 1
inc/custom-post-type.php

@@ -41,7 +41,7 @@ function uiu_cpt_faculty()
         'label'                 => 'Faculty',
         'description'           => 'Faculty of Department of CSE',
         'labels'                => $labels,
-        'supports'              => array('title', 'thumbnail', 'revisions'),
+        'supports'              => array('title', 'editor', 'thumbnail', 'revisions'),
         // 'taxonomies'            => array('category', 'post_tag'),
         'hierarchical'          => false,
         'public'                => true,

+ 10 - 0
single-faculty.php

@@ -88,6 +88,16 @@ get_header(); ?>
 							<?php endwhile; ?>
 
 						<?php endif; ?>
+
+
+						<span class="contact-dets member-api"></span>
+
+						<div class="bio desc-block">
+							<h2 class="m-text">Publication</h2>
+							<p class="m-text">
+								<?php the_content(); ?>
+						</div>
+
 					</div>
 				</div>
 			</div>

+ 64 - 0
template-parts/blocks/portfolio-item/block-portfolio-item.php

@@ -0,0 +1,64 @@
+<?php
+
+$logo = get_field('logo');
+$title = get_field('title');
+$description = get_field('description');
+
+
+$url = 'http://103.109.52.3/webapi/api/EmployeeInfo';
+
+$response = wp_remote_post(
+    $url,
+    array(
+        // 'timeout'     => 120,
+        // 'httpversion' => '1.1',
+        'body' => array(
+            'user_login_id' => 'api_user',
+            'login_id' => 'SS',
+            'auth_token' => 'api_user20230419045143'
+        )
+
+    )
+);
+
+// $url = 'https://www.flickr.com/services/rest/';
+// $arguments = array(
+//     'api_key' => 'f49df4a290d8f224ecd56536af51FF77',
+//     'method'  => 'flickr.people.getPublicPhotos',
+//     'format'  => 'json',
+//     'user_id' => $user_id,
+//     'per_page'=> $photos_number,
+// );
+// $url_parameters = array();
+// foreach ($arguments as $key => $value){
+//     $url_parameters[] = $key.'='.$value;
+// }
+// $url = $url.implode('&', $url_parameters);
+
+
+
+// $request = wp_remote_get($url, $options);
+
+// return load_request($request);
+
+// function load_request($response)
+// {
+//     try {
+//         $json = json_decode($response['body']);
+//     } catch (Exception $ex) {
+//         $json = null;
+//     }
+//     return $json;
+// }
+
+
+echo '<div class="portfolio-item">';
+if (!empty($logo))
+    echo wp_get_attachment_image($logo['ID'], 'thumbnail', null, array('class' => 'portfolio-logo alignleft'));
+if (!empty($title))
+    echo '<h3 class="portfolio-title">' . $title . '</h3>';
+if (!empty($description))
+    echo '<div class="portfolio-description">' . $description . '</div>';
+var_dump($response);
+// echo '<div class="test">' . $request . '</div>';
+echo '</div>';