Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
W
WordPress_SexHackMe_Plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SexHackMe
WordPress_SexHackMe_Plugin
Commits
ba34bb99
Commit
ba34bb99
authored
Sep 04, 2024
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redirect to video page when video post is called
parent
bfa30bcd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
class-post_types.php
includes/class-post_types.php
+12
-9
No files found.
includes/class-post_types.php
View file @
ba34bb99
...
@@ -24,15 +24,6 @@ namespace wp_SexHackMe;
...
@@ -24,15 +24,6 @@ namespace wp_SexHackMe;
// Exit if accessed directly
// Exit if accessed directly
if
(
!
defined
(
'ABSPATH'
)
)
exit
;
if
(
!
defined
(
'ABSPATH'
)
)
exit
;
/*
function replace__permalink( $post_link, $post, $leavename, $sample ) {
if ( 'custom_post_type' === $post->post_type ) {
$slug = 'custom-post-type';
$post_link = str_replace( '%' . $post->post_type . '%', $slug, $post_link );
}
return $post_link;
}
*/
if
(
!
class_exists
(
'SH_PostTypes'
))
{
if
(
!
class_exists
(
'SH_PostTypes'
))
{
class
SH_PostTypes
class
SH_PostTypes
...
@@ -68,6 +59,9 @@ if(!class_exists('SH_PostTypes')) {
...
@@ -68,6 +59,9 @@ if(!class_exists('SH_PostTypes')) {
// Fix the permalink for video pages
// Fix the permalink for video pages
add_filter
(
'post_type_link'
,
__CLASS__
.
"::replace_permalink"
,
10
,
4
);
add_filter
(
'post_type_link'
,
__CLASS__
.
"::replace_permalink"
,
10
,
4
);
// if the post get called instead of the video page, redirect!
add_action
(
'template_redirect'
,
__CLASS__
.
"::post_to_video"
);
// SexHack Videos
// SexHack Videos
// TODO: the idea is to have custom post type for models profiles and for videos.
// TODO: the idea is to have custom post type for models profiles and for videos.
// Ideally /$DEFAULTSLUG/nomevideo/ finisce sul corrispettivo prodotto woocommerce,
// Ideally /$DEFAULTSLUG/nomevideo/ finisce sul corrispettivo prodotto woocommerce,
...
@@ -146,6 +140,15 @@ if(!class_exists('SH_PostTypes')) {
...
@@ -146,6 +140,15 @@ if(!class_exists('SH_PostTypes')) {
return
$post_link
;
return
$post_link
;
}
}
public
static
function
post_to_video
()
{
$vpslug
=
get_query_var
(
'sexhack_video'
,
false
);
if
(
$vpslug
)
{
$video
=
sh_get_video_from_post
(
get_post
());
wp_redirect
(
get_site_url
()
.
"/"
.
get_option
(
'sexhack_gallery_slug'
,
'v'
)
.
"/"
.
$video
->
slug
);
}
}
public
static
function
add_rewrites
()
public
static
function
add_rewrites
()
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment