Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing option to change custom identifier for pages via Wordpress c… #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion disqus/public/class-disqus-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,20 @@ class Disqus_Public {

/**
* Returns the Disqus identifier for a given post.
* If custom field is defined for the page with
* key 'dsq_cusom_identifier' then the custom identifier is returned.
*
* @since 3.0
* @param WP_Post $post The WordPress post to create the title for.
* @return string The formatted identifier to be passed to Disqus.
*/
public static function dsq_identifier_for_post( $post ) {
return $post->ID . ' ' . $post->guid;
$dsq_custom_identifier = get_post_meta($post->ID, 'dsq_custom_identifier', true);
if (!empty($dsq_custom_identifier )) {
return $disqus_custom_identifier_meta . ' ' . get_the_guid($disqus_custom_identifier_meta);
} else {
return $post->ID . ' ' . $post->guid;
}
}

/**
Expand Down