@다케미카코 님이 제작하신 네이버 META 검색 잘 걸리게 하기를 HOOK 기능을 만들어봤습니다.
https://sir.kr/yc5_tip/2326
[code]
// extend/user.extend.php 에 입력
if (! function_exists('common_header_shop_item_meta')) {
add_event('common_header', 'common_header_shop_item_meta');
function common_header_shop_item_meta()
{
global $g5, $config;
if($_REQUEST['it_id'] != "" && (!defined('G5_IS_ADMIN') || G5_IS_ADMIN == false)){
$it_id = $_REQUEST['it_id'];
$http_host = $_SERVER['HTTP_HOST'];
$request_uri = $_SERVER['REQUEST_URI'];
$ogUrl = 'https://' . $http_host . $request_uri;
$sql = "select * from g5_shop_item where it_id='$it_id'";
$item = sql_fetch($sql); // 쿼리 실행
$ogType = 'website'; // default website
$ogTitle = $g5['title'];
$ogImage = ''; // default image url 입력
if ($item) {
$ogTitle = $item['it_name'];
$ogImage = get_it_imageurl($it_id);
}
$config['cf_add_meta'] .= '<meta property="og:url" content="'.$ogUrl.'" />';
$config['cf_add_meta'] .= '<meta property="og:type" content="'.$ogType.'" />';
$config['cf_add_meta'] .= '<meta property="og:title" content="'.$ogTitle.'"/>';
$config['cf_add_meta'] .= '<meta property="og:image" content="'.$ogImage.'"/>';
}
}
}
[/code]
이상 있으시면 댓글 남겨 주세요.
댓글 38개
게시글 목록
| 번호 | 제목 |
|---|---|
| 2169 | |
| 2168 | |
| 2167 | |
| 2158 | |
| 2146 | |
| 2140 | |
| 2130 | |
| 2114 | |
| 2102 | |
| 2095 | |
| 2084 | |
| 2075 | |
| 2072 | |
| 2070 | |
| 2069 | |
| 2065 | |
| 2058 | |
| 2056 | |
| 2055 | |
| 2054 | |
| 2049 | |
| 2038 | |
| 2036 | |
| 1989 | |
| 1956 | |
| 1923 | |
| 1918 | |
| 1904 | |
| 1892 | |
| 1891 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기